mirror of
https://github.com/nasa/openmct.git
synced 2025-04-12 05:40:17 +00:00
Display layout fixes 062320 (#3111)
* fix for persisting new domainObject * convert stacked plot to alpha
This commit is contained in:
parent
8e54b8a819
commit
3748927e87
@ -1,6 +1,6 @@
|
||||
# Open MCT License
|
||||
|
||||
Open MCT, Copyright (c) 2014-2019, United States Government as represented by the Administrator of the National Aeronautics and Space Administration. All rights reserved.
|
||||
Open MCT, Copyright (c) 2014-2020, United States Government as represented by the Administrator of the National Aeronautics and Space Administration. All rights reserved.
|
||||
|
||||
Open MCT is licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
|
||||
|
@ -73,7 +73,7 @@ define(['lodash'], function (_) {
|
||||
]
|
||||
}
|
||||
},
|
||||
viewTypes = {
|
||||
VIEW_TYPES = {
|
||||
'telemetry-view': {
|
||||
value: 'telemetry-view',
|
||||
name: 'Alphanumeric',
|
||||
@ -95,28 +95,34 @@ define(['lodash'], function (_) {
|
||||
class: 'icon-tabular-realtime'
|
||||
}
|
||||
},
|
||||
applicableViews = {
|
||||
APPLICABLE_VIEWS = {
|
||||
'telemetry-view': [
|
||||
viewTypes['telemetry.plot.overlay'],
|
||||
viewTypes.table
|
||||
VIEW_TYPES['telemetry.plot.overlay'],
|
||||
VIEW_TYPES['telemetry.plot.stacked'],
|
||||
VIEW_TYPES.table
|
||||
],
|
||||
'telemetry.plot.overlay': [
|
||||
viewTypes['telemetry.plot.stacked'],
|
||||
viewTypes.table,
|
||||
viewTypes['telemetry-view']
|
||||
VIEW_TYPES['telemetry.plot.stacked'],
|
||||
VIEW_TYPES.table,
|
||||
VIEW_TYPES['telemetry-view']
|
||||
],
|
||||
'telemetry.plot.stacked': [
|
||||
VIEW_TYPES['telemetry.plot.overlay'],
|
||||
VIEW_TYPES.table,
|
||||
VIEW_TYPES['telemetry-view']
|
||||
],
|
||||
'table': [
|
||||
viewTypes['telemetry.plot.overlay'],
|
||||
viewTypes['telemetry.plot.stacked'],
|
||||
viewTypes['telemetry-view']
|
||||
VIEW_TYPES['telemetry.plot.overlay'],
|
||||
VIEW_TYPES['telemetry.plot.stacked'],
|
||||
VIEW_TYPES['telemetry-view']
|
||||
],
|
||||
'telemetry-view-multi': [
|
||||
viewTypes['telemetry.plot.overlay'],
|
||||
viewTypes['telemetry.plot.stacked'],
|
||||
viewTypes.table
|
||||
VIEW_TYPES['telemetry.plot.overlay'],
|
||||
VIEW_TYPES['telemetry.plot.stacked'],
|
||||
VIEW_TYPES.table
|
||||
],
|
||||
'telemetry.plot.overlay-multi': [
|
||||
viewTypes['telemetry.plot.stacked']
|
||||
VIEW_TYPES['telemetry.plot.stacked']
|
||||
]
|
||||
};
|
||||
|
||||
@ -510,7 +516,7 @@ define(['lodash'], function (_) {
|
||||
selectedItemType = 'telemetry-view';
|
||||
}
|
||||
|
||||
let viewOptions = applicableViews[selectedItemType];
|
||||
let viewOptions = APPLICABLE_VIEWS[selectedItemType];
|
||||
|
||||
if (viewOptions) {
|
||||
return {
|
||||
@ -533,7 +539,7 @@ define(['lodash'], function (_) {
|
||||
domainObject: selectedParent,
|
||||
icon: "icon-object",
|
||||
title: "Merge into a telemetry table or plot",
|
||||
options: applicableViews['telemetry-view-multi'],
|
||||
options: APPLICABLE_VIEWS['telemetry-view-multi'],
|
||||
method: function (option) {
|
||||
displayLayoutContext.mergeMultipleTelemetryViews(selection, option.value);
|
||||
}
|
||||
@ -546,7 +552,7 @@ define(['lodash'], function (_) {
|
||||
domainObject: selectedParent,
|
||||
icon: "icon-object",
|
||||
title: "Merge into a stacked plot",
|
||||
options: applicableViews['telemetry.plot.overlay-multi'],
|
||||
options: APPLICABLE_VIEWS['telemetry.plot.overlay-multi'],
|
||||
method: function (option) {
|
||||
displayLayoutContext.mergeMultipleOverlayPlots(selection, option.value);
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user