mirror of
https://github.com/nasa/openmct.git
synced 2024-12-22 14:32:22 +00:00
Instantiate legacy objects inline
This commit is contained in:
parent
eeab6e9bde
commit
9ae4e66c91
14
src/MCT.js
14
src/MCT.js
@ -41,6 +41,7 @@ define([
|
||||
'./styles-new/core.scss',
|
||||
'./styles-new/notebook.scss',
|
||||
'./ui/components/layout/Layout.vue',
|
||||
'../platform/core/src/objects/DomainObjectImpl',
|
||||
'../platform/core/src/capabilities/ContextualDomainObject',
|
||||
'vue'
|
||||
], function (
|
||||
@ -64,6 +65,7 @@ define([
|
||||
coreStyles,
|
||||
NotebookStyles,
|
||||
Layout,
|
||||
DomainObjectImpl,
|
||||
ContextualDomainObject,
|
||||
Vue
|
||||
) {
|
||||
@ -251,6 +253,8 @@ define([
|
||||
* @private
|
||||
*/
|
||||
MCT.prototype.legacyObject = function (domainObject) {
|
||||
let capabilityService = this.$injector.get('capabilityService');
|
||||
|
||||
if (Array.isArray(domainObject)) {
|
||||
// an array of domain objects. [object, ...ancestors] representing
|
||||
// a single object with a given chain of ancestors. We instantiate
|
||||
@ -259,7 +263,7 @@ define([
|
||||
.map((o) => {
|
||||
let keyString = objectUtils.makeKeyString(o.identifier);
|
||||
let oldModel = objectUtils.toOldFormat(o);
|
||||
return this.$injector.get('instantiate')(oldModel, keyString);
|
||||
return instantiate(oldModel, keyString);
|
||||
})
|
||||
.reverse()
|
||||
.reduce((parent, child) => {
|
||||
@ -269,7 +273,13 @@ define([
|
||||
} else {
|
||||
let keyString = objectUtils.makeKeyString(domainObject.identifier);
|
||||
let oldModel = objectUtils.toOldFormat(domainObject);
|
||||
return this.$injector.get('instantiate')(oldModel, keyString);
|
||||
return instantiate(oldModel, keyString);
|
||||
}
|
||||
|
||||
function instantiate(model, keyString) {
|
||||
var capabilities = capabilityService.getCapabilities(model, keyString);
|
||||
model.id = keyString;
|
||||
return new DomainObjectImpl(keyString, model, capabilities);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -78,6 +78,9 @@ class ContextMenuRegistry {
|
||||
document.addEventListener('click', this._hideActiveContextMenu);
|
||||
}
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
_calculatePopupPosition(event, menuElement) {
|
||||
let x = event.clientX;
|
||||
let y = event.clientY;
|
||||
|
Loading…
Reference in New Issue
Block a user