mirror of
https://github.com/nasa/openmct.git
synced 2025-03-21 03:25:44 +00:00
update helper method name, simplify isAnnotatableType method
This commit is contained in:
parent
850c015889
commit
19ee3e532e
@ -95,7 +95,6 @@ export default class AnnotationAPI extends EventEmitter {
|
||||
this.availableTags = {};
|
||||
this.namespaceToSaveAnnotations = '';
|
||||
this.#targetComparatorMap = new Map();
|
||||
this.annotatableTypes = [];
|
||||
|
||||
this.ANNOTATION_TYPES = ANNOTATION_TYPES;
|
||||
this.ANNOTATION_TYPE = ANNOTATION_TYPE;
|
||||
@ -116,17 +115,6 @@ export default class AnnotationAPI extends EventEmitter {
|
||||
domainObject.annotationType = domainObject.annotationType || 'plotspatial';
|
||||
}
|
||||
});
|
||||
|
||||
this.openmct.on('start', () => {
|
||||
const types = this.openmct.types.getTypes();
|
||||
const typeKeys = Object.keys(types);
|
||||
|
||||
typeKeys.forEach((key) => {
|
||||
if (types[key].definition.annotatable) {
|
||||
this.annotatableTypes.push(key);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Creates an annotation on a given domain object (e.g., a plot) and a set of targets (e.g., telemetry objects)
|
||||
@ -601,6 +589,8 @@ export default class AnnotationAPI extends EventEmitter {
|
||||
* @returns {boolean} Returns true if the type is annotatable
|
||||
*/
|
||||
isAnnotatableType(type) {
|
||||
return this.annotatableTypes.some((annotatableType) => annotatableType === type);
|
||||
const types = this.openmct.types.getAllTypes();
|
||||
|
||||
return types[type]?.definition?.annotatable;
|
||||
}
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ export default class TypeRegistry {
|
||||
* List all registered types.
|
||||
* @returns {Type[]} all registered types
|
||||
*/
|
||||
getTypes() {
|
||||
getAllTypes() {
|
||||
return this.types;
|
||||
}
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user