LAD Table (Set) Composition Policy (#2962)

* added LAD Table composition policy, with a check for lad table sets, child can only be lad table
Co-authored-by: Andrew Henry <akhenry@gmail.com>
Co-authored-by: Deep Tailor <deep.j.tailor@nasa.gov>
This commit is contained in:
Jamie V 2020-06-24 13:26:22 -07:00 committed by GitHub
parent 9e5eddec9b
commit 8e54b8a819
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 12 deletions

View File

@ -20,20 +20,13 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
export default class LADTableCompositionPolicy {
constructor(openmct) {
this.openmct = openmct;
return this.allow.bind(this);
}
allow(parent, child) {
export default function ladTableCompositionPolicy(openmct) {
return function (parent, child) {
if(parent.type === 'LadTable') {
return this.openmct.telemetry.isTelemetryObject(child);
return openmct.telemetry.isTelemetryObject(child);
} else if(parent.type === 'LadTableSet') {
return child.type === 'LadTable';
}
return true;
}
}

View File

@ -21,7 +21,7 @@
*****************************************************************************/
import LADTableViewProvider from './LADTableViewProvider';
import LADTableSetViewProvider from './LADTableSetViewProvider';
import LADTableCompositionPolicy from './LADTableCompositionPolicy';
import ladTableCompositionPolicy from './LADTableCompositionPolicy';
export default function plugin() {
return function install(openmct) {
@ -49,6 +49,6 @@ export default function plugin() {
}
});
openmct.composition.addPolicy(new LADTableCompositionPolicy(openmct));
openmct.composition.addPolicy(ladTableCompositionPolicy(openmct));
};
}