add metadata provider

This commit is contained in:
David Tsay 2020-02-25 17:27:08 -08:00
parent 92ecf3af1d
commit 486dae54bd
2 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,37 @@
export default class ConditionSetMetadataProvider {
constructor(openmct) {
this.openmct = openmct;
}
supportsMetadata(domainObject) {
return domainObject.type === 'conditionSet';
}
getDomains(domainObject) {
return this.openmct.time.getAllTimeSystems().map(function (ts, i) {
return {
key: ts.key,
name: ts.name,
format: ts.timeFormat,
hints: {
domain: i
}
};
});
}
getMetadata(domainObject) {
return {
values: this.getDomains().concat([
{
name: 'Output',
key: 'output',
type: 'string',
hints: {
range: 1
}
}
])
};
}
}

View File

@ -21,6 +21,7 @@
*****************************************************************************/
import ConditionSetViewProvider from './ConditionSetViewProvider.js';
import ConditionSetCompositionPolicy from "./ConditionSetCompositionPolicy";
import ConditionSetMetadataProvider from './ConditionSetMetadataProvider';
import ConditionSetTelemetryProvider from './ConditionSetTelemetryProvider';
export default function ConditionPlugin() {
@ -51,6 +52,7 @@ export default function ConditionPlugin() {
});
openmct.composition.addPolicy(new ConditionSetCompositionPolicy(openmct).allow);
openmct.telemetry.addProvider(new ConditionSetMetadataProvider(openmct));
openmct.telemetry.addProvider(new ConditionSetTelemetryProvider(openmct));
openmct.objectViews.addProvider(new ConditionSetViewProvider(openmct));