mirror of
https://github.com/nasa/openmct.git
synced 2025-06-17 06:38:17 +00:00
Display layout fixes 062320 (#3111)
* fix for persisting new domainObject * convert stacked plot to alpha
This commit is contained in:
@ -78,6 +78,30 @@ import ImageView from './ImageView.vue'
|
||||
import EditMarquee from './EditMarquee.vue'
|
||||
import _ from 'lodash'
|
||||
|
||||
const TELEMETRY_IDENTIFIER_FUNCTIONS = {
|
||||
'table': (domainObject) => {
|
||||
return Promise.resolve(domainObject.composition);
|
||||
},
|
||||
'telemetry.plot.overlay': (domainObject) => {
|
||||
return Promise.resolve(domainObject.composition);
|
||||
},
|
||||
'telemetry.plot.stacked': (domainObject, openmct) => {
|
||||
let composition = openmct.composition.get(domainObject);
|
||||
|
||||
return composition.load().then((objects) => {
|
||||
let identifiers = [];
|
||||
objects.forEach(object => {
|
||||
if (object.type === 'telemetry.plot.overlay') {
|
||||
identifiers.push(...object.composition);
|
||||
} else {
|
||||
identifiers.push(object.identifier);
|
||||
}
|
||||
});
|
||||
return Promise.resolve(identifiers);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const ITEM_TYPE_VIEW_MAP = {
|
||||
'subobject-view': SubobjectView,
|
||||
'telemetry-view': TelemetryView,
|
||||
@ -549,7 +573,7 @@ export default {
|
||||
object.identifier = identifier;
|
||||
object.location = parentKeyString;
|
||||
|
||||
this.openmct.objects.mutate(object, 'persisted', Date.now());
|
||||
this.openmct.objects.mutate(object, 'created', Date.now());
|
||||
|
||||
return object;
|
||||
},
|
||||
@ -671,31 +695,42 @@ export default {
|
||||
this.removeItem(selection);
|
||||
this.initSelectIndex = this.layoutItems.length - 1;
|
||||
},
|
||||
getTelemetryIdentifiers(domainObject) {
|
||||
let method = TELEMETRY_IDENTIFIER_FUNCTIONS[domainObject.type];
|
||||
|
||||
if (method) {
|
||||
return method(domainObject, this.openmct);
|
||||
} else {
|
||||
throw 'No method identified for domainObject type';
|
||||
}
|
||||
},
|
||||
switchViewType(context, viewType, selection) {
|
||||
let domainObject = context.item,
|
||||
layoutItem = context.layoutItem,
|
||||
position = [layoutItem.x, layoutItem.y],
|
||||
newDomainObject,
|
||||
layoutType = 'subobject-view';
|
||||
|
||||
if (layoutItem.type === 'telemetry-view') {
|
||||
newDomainObject = this.createNewDomainObject(domainObject, [domainObject.identifier], viewType);
|
||||
} else {
|
||||
if (viewType !== 'telemetry-view') {
|
||||
newDomainObject = this.createNewDomainObject(domainObject, domainObject.composition, viewType);
|
||||
} else {
|
||||
domainObject.composition.forEach((identifier , index) => {
|
||||
let positionX = position[0] + (index * DUPLICATE_OFFSET),
|
||||
positionY = position[1] + (index * DUPLICATE_OFFSET);
|
||||
let newDomainObject = this.createNewDomainObject(domainObject, [domainObject.identifier], viewType);
|
||||
|
||||
this.convertToTelemetryView(identifier, [positionX, positionY]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (newDomainObject) {
|
||||
this.composition.add(newDomainObject);
|
||||
this.addItem(layoutType, newDomainObject, position);
|
||||
} else {
|
||||
this.getTelemetryIdentifiers(domainObject).then((identifiers) => {
|
||||
if (viewType === 'telemetry-view') {
|
||||
identifiers.forEach((identifier, index) => {
|
||||
let positionX = position[0] + (index * DUPLICATE_OFFSET),
|
||||
positionY = position[1] + (index * DUPLICATE_OFFSET);
|
||||
|
||||
this.convertToTelemetryView(identifier, [positionX, positionY]);
|
||||
});
|
||||
} else {
|
||||
let newDomainObject = this.createNewDomainObject(domainObject, identifiers, viewType);
|
||||
|
||||
this.composition.add(newDomainObject);
|
||||
this.addItem(layoutType, newDomainObject, position);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.removeItem(selection);
|
||||
|
Reference in New Issue
Block a user