mirror of
https://github.com/nasa/openmct.git
synced 2025-03-13 15:56:49 +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/core.scss',
|
||||||
'./styles-new/notebook.scss',
|
'./styles-new/notebook.scss',
|
||||||
'./ui/components/layout/Layout.vue',
|
'./ui/components/layout/Layout.vue',
|
||||||
|
'../platform/core/src/objects/DomainObjectImpl',
|
||||||
'../platform/core/src/capabilities/ContextualDomainObject',
|
'../platform/core/src/capabilities/ContextualDomainObject',
|
||||||
'vue'
|
'vue'
|
||||||
], function (
|
], function (
|
||||||
@ -64,6 +65,7 @@ define([
|
|||||||
coreStyles,
|
coreStyles,
|
||||||
NotebookStyles,
|
NotebookStyles,
|
||||||
Layout,
|
Layout,
|
||||||
|
DomainObjectImpl,
|
||||||
ContextualDomainObject,
|
ContextualDomainObject,
|
||||||
Vue
|
Vue
|
||||||
) {
|
) {
|
||||||
@ -251,6 +253,8 @@ define([
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
MCT.prototype.legacyObject = function (domainObject) {
|
MCT.prototype.legacyObject = function (domainObject) {
|
||||||
|
let capabilityService = this.$injector.get('capabilityService');
|
||||||
|
|
||||||
if (Array.isArray(domainObject)) {
|
if (Array.isArray(domainObject)) {
|
||||||
// an array of domain objects. [object, ...ancestors] representing
|
// an array of domain objects. [object, ...ancestors] representing
|
||||||
// a single object with a given chain of ancestors. We instantiate
|
// a single object with a given chain of ancestors. We instantiate
|
||||||
@ -259,7 +263,7 @@ define([
|
|||||||
.map((o) => {
|
.map((o) => {
|
||||||
let keyString = objectUtils.makeKeyString(o.identifier);
|
let keyString = objectUtils.makeKeyString(o.identifier);
|
||||||
let oldModel = objectUtils.toOldFormat(o);
|
let oldModel = objectUtils.toOldFormat(o);
|
||||||
return this.$injector.get('instantiate')(oldModel, keyString);
|
return instantiate(oldModel, keyString);
|
||||||
})
|
})
|
||||||
.reverse()
|
.reverse()
|
||||||
.reduce((parent, child) => {
|
.reduce((parent, child) => {
|
||||||
@ -269,7 +273,13 @@ define([
|
|||||||
} else {
|
} else {
|
||||||
let keyString = objectUtils.makeKeyString(domainObject.identifier);
|
let keyString = objectUtils.makeKeyString(domainObject.identifier);
|
||||||
let oldModel = objectUtils.toOldFormat(domainObject);
|
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);
|
document.addEventListener('click', this._hideActiveContextMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
_calculatePopupPosition(event, menuElement) {
|
_calculatePopupPosition(event, menuElement) {
|
||||||
let x = event.clientX;
|
let x = event.clientX;
|
||||||
let y = event.clientY;
|
let y = event.clientY;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user