mirror of
https://github.com/nasa/openmct.git
synced 2024-12-20 13:43:09 +00:00
Telemetry Panels now created correctly
This commit is contained in:
parent
f0e293a513
commit
16c3229a84
@ -63,14 +63,10 @@ define(
|
||||
return editor.cancel();
|
||||
}
|
||||
|
||||
// Discard the current root view (which will be the editing
|
||||
// UI, which will have been pushed atop the Browise UI.)
|
||||
//Discard current 'editable' object, and retrieve original
|
||||
// un-edited object.
|
||||
function returnToBrowse() {
|
||||
self.objectService.getObjects([self.domainObject.getId()]).then(function(objects){
|
||||
return self.navigationService.setNavigation(objects[self.domainObject.getId()]);
|
||||
})
|
||||
//return
|
||||
// self.navigationService.setNavigation(self.domainObject.getDomainObject());
|
||||
return self.navigationService.setNavigation(self.domainObject.getOriginalObject());
|
||||
}
|
||||
|
||||
return doCancel(getEditorCapability())
|
||||
|
@ -99,8 +99,9 @@ define(
|
||||
return domainObject.useCapability('composition')
|
||||
.then(function(composees){
|
||||
return self.$q.all(composees.map(function(composee){
|
||||
return object.getCapability('composition').add(composee);
|
||||
}));
|
||||
object.getCapability('composition').add(composee);
|
||||
return object;
|
||||
})).then(function(){return object});
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -120,7 +121,9 @@ define(
|
||||
//This is a new 'virtual panel' that has not been persisted
|
||||
// yet.
|
||||
if (domainObject.getModel().type === 'telemetry.panel' && !domainObject.getModel().persisted){
|
||||
return self.getObjectService().getObjects([domainObject.getModel().location]).then(function(objs){ doWizardSave(domainObject, objs[domainObject.getModel().location])});
|
||||
return self.getObjectService()
|
||||
.getObjects([domainObject.getModel().location])
|
||||
.then(function(objs){ return doWizardSave(domainObject, objs[domainObject.getModel().location])});
|
||||
} else {
|
||||
return domainObject.getCapability("editor").save();
|
||||
}
|
||||
@ -128,8 +131,8 @@ define(
|
||||
|
||||
// Discard the current root view (which will be the editing
|
||||
// UI, which will have been pushed atop the Browse UI.)
|
||||
function returnToBrowse() {
|
||||
return self.navigationService.setNavigation(self.domainObject.getDomainObject());
|
||||
function returnToBrowse(object) {
|
||||
self.navigationService.setNavigation(object)
|
||||
}
|
||||
|
||||
return doSave().then(returnToBrowse);
|
||||
|
@ -78,7 +78,8 @@ define(
|
||||
// different versions of the same editable domain object
|
||||
// are not shown in different sections of the same Edit
|
||||
// UI, which might thereby fall out of sync.
|
||||
var cache;
|
||||
var cache,
|
||||
originalObject = domainObject;
|
||||
|
||||
// Constructor for EditableDomainObject, which adheres
|
||||
// to the same shared cache.
|
||||
@ -102,9 +103,14 @@ define(
|
||||
capability;
|
||||
};
|
||||
|
||||
editableObject.getDomainObject = function() {
|
||||
return domainObject;
|
||||
}
|
||||
|
||||
editableObject.setOriginalObject = function(object) {
|
||||
originalObject = object;
|
||||
};
|
||||
|
||||
editableObject.getOriginalObject = function() {
|
||||
return originalObject;
|
||||
};
|
||||
|
||||
return editableObject;
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
"key": "drop",
|
||||
"implementation": "gestures/DropGesture.js",
|
||||
"depends": [ "dndService", "$q", "navigationService",
|
||||
"objectService", "instantiate" ]
|
||||
"objectService", "instantiate", "typeService" ]
|
||||
},
|
||||
{
|
||||
"key": "menu",
|
||||
|
@ -42,7 +42,7 @@ define(
|
||||
* @param {DomainObject} domainObject the domain object whose
|
||||
* composition should be modified as a result of the drop.
|
||||
*/
|
||||
function DropGesture(dndService, $q, navigationService, objectService, instantiate, element, domainObject) {
|
||||
function DropGesture(dndService, $q, navigationService, objectService, instantiate, typeService, element, domainObject) {
|
||||
var actionCapability = domainObject.getCapability('action'),
|
||||
editableDomainObject,
|
||||
action; // Action for the drop, when it occurs
|
||||
@ -108,16 +108,28 @@ define(
|
||||
}
|
||||
|
||||
function createVirtualPanel(base, overlayId){
|
||||
var model = {
|
||||
name: 'New telemetry panel',
|
||||
type: 'telemetry.panel',
|
||||
composition: [base.getId(), overlayId],
|
||||
location: base.getModel().location
|
||||
},
|
||||
id = uuid();
|
||||
|
||||
var typeKey = 'telemetry.panel',
|
||||
type = typeService.getType(typeKey),
|
||||
model = type.getInitialModel(),
|
||||
id = uuid(),
|
||||
newPanel = undefined;
|
||||
|
||||
model.type = typeKey;
|
||||
model.name = 'New telemetry panel';
|
||||
newPanel = instantiate(model, id);
|
||||
|
||||
[base.getId(), overlayId].forEach(function(id){
|
||||
newPanel.getCapability('composition').add(id)
|
||||
});
|
||||
|
||||
newPanel.getCapability('location').setPrimaryLocation(base.getCapability('location').getContextualLocation());
|
||||
|
||||
//ObjectService is wrapped by a decorator which is obscuring
|
||||
// the newObject method.
|
||||
return instantiate(model, id);
|
||||
var virtualPanel = new EditableDomainObject(newPanel, $q);
|
||||
virtualPanel.setOriginalObject(base);
|
||||
return virtualPanel;
|
||||
|
||||
}
|
||||
|
||||
@ -137,8 +149,7 @@ define(
|
||||
// the change.
|
||||
if (id) {
|
||||
if (shouldCreateVirtualPanel(domainObject)){
|
||||
virtualObj = new EditableDomainObject(createVirtualPanel(domainObject, id));
|
||||
navigationService.setNavigation(virtualObj);
|
||||
navigationService.setNavigation(createVirtualPanel(domainObject, id));
|
||||
broadcastDrop(id, event);
|
||||
} else {
|
||||
$q.when(action && action.perform()).then(function (result) {
|
||||
|
Loading…
Reference in New Issue
Block a user