mirror of
https://github.com/nasa/openmct.git
synced 2025-06-16 22:28:13 +00:00
@ -248,6 +248,13 @@ define([
|
|||||||
}.bind(this)
|
}.bind(this)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.types.listKeys().forEach(function (typeKey) {
|
||||||
|
var type = this.types.get(typeKey);
|
||||||
|
var legacyDefinition = type.toLegacyDefinition();
|
||||||
|
legacyDefinition.key = typeKey;
|
||||||
|
this.legacyExtension('types', legacyDefinition);
|
||||||
|
}.bind(this));
|
||||||
|
|
||||||
legacyRegistry.register('adapter', this.legacyBundle);
|
legacyRegistry.register('adapter', this.legacyBundle);
|
||||||
legacyRegistry.enable('adapter');
|
legacyRegistry.enable('adapter');
|
||||||
/**
|
/**
|
||||||
|
@ -55,5 +55,29 @@ define(function () {
|
|||||||
return domainObject.type === this.key;
|
return domainObject.type === this.key;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a definition for this type that can be registered using the
|
||||||
|
* legacy bundle format.
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
Type.prototype.toLegacyDefinition = function () {
|
||||||
|
var def = {};
|
||||||
|
def.name = this.definition.label;
|
||||||
|
def.cssclass = this.definition.cssclass;
|
||||||
|
def.description = this.definition.description;
|
||||||
|
def.properties = this.definition.form;
|
||||||
|
|
||||||
|
if (this.definition.initialize) {
|
||||||
|
def.model = {};
|
||||||
|
this.definition.initialize(def.model);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.definition.creatable) {
|
||||||
|
def.features = ['creation'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return def;
|
||||||
|
};
|
||||||
|
|
||||||
return Type;
|
return Type;
|
||||||
});
|
});
|
||||||
|
@ -44,6 +44,26 @@ define([], function () {
|
|||||||
this.types[typeKey] = type;
|
this.types[typeKey] = type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List keys for all registered types.
|
||||||
|
* @method list
|
||||||
|
* @memberof module:openmct.TypeRegistry#
|
||||||
|
* @returns {string[]} all registered type keys
|
||||||
|
*/
|
||||||
|
TypeRegistry.prototype.listKeys = function () {
|
||||||
|
return Object.keys(this.types);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieve a registered type by its key.
|
||||||
|
* @method get
|
||||||
|
* @param {string} typeKey the key for htis type
|
||||||
|
* @memberof module:openmct.TypeRegistry#
|
||||||
|
* @returns {module:openmct.Type} the registered type
|
||||||
|
*/
|
||||||
|
TypeRegistry.prototype.get = function (typeKey) {
|
||||||
|
return this.types[typeKey];
|
||||||
|
}
|
||||||
|
|
||||||
return TypeRegistry;
|
return TypeRegistry;
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user