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();
|
return editor.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Discard the current root view (which will be the editing
|
//Discard current 'editable' object, and retrieve original
|
||||||
// UI, which will have been pushed atop the Browise UI.)
|
// un-edited object.
|
||||||
function returnToBrowse() {
|
function returnToBrowse() {
|
||||||
self.objectService.getObjects([self.domainObject.getId()]).then(function(objects){
|
return self.navigationService.setNavigation(self.domainObject.getOriginalObject());
|
||||||
return self.navigationService.setNavigation(objects[self.domainObject.getId()]);
|
|
||||||
})
|
|
||||||
//return
|
|
||||||
// self.navigationService.setNavigation(self.domainObject.getDomainObject());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return doCancel(getEditorCapability())
|
return doCancel(getEditorCapability())
|
||||||
|
@ -99,8 +99,9 @@ define(
|
|||||||
return domainObject.useCapability('composition')
|
return domainObject.useCapability('composition')
|
||||||
.then(function(composees){
|
.then(function(composees){
|
||||||
return self.$q.all(composees.map(function(composee){
|
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
|
//This is a new 'virtual panel' that has not been persisted
|
||||||
// yet.
|
// yet.
|
||||||
if (domainObject.getModel().type === 'telemetry.panel' && !domainObject.getModel().persisted){
|
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 {
|
} else {
|
||||||
return domainObject.getCapability("editor").save();
|
return domainObject.getCapability("editor").save();
|
||||||
}
|
}
|
||||||
@ -128,8 +131,8 @@ define(
|
|||||||
|
|
||||||
// Discard the current root view (which will be the editing
|
// Discard the current root view (which will be the editing
|
||||||
// UI, which will have been pushed atop the Browse UI.)
|
// UI, which will have been pushed atop the Browse UI.)
|
||||||
function returnToBrowse() {
|
function returnToBrowse(object) {
|
||||||
return self.navigationService.setNavigation(self.domainObject.getDomainObject());
|
self.navigationService.setNavigation(object)
|
||||||
}
|
}
|
||||||
|
|
||||||
return doSave().then(returnToBrowse);
|
return doSave().then(returnToBrowse);
|
||||||
|
@ -78,7 +78,8 @@ define(
|
|||||||
// different versions of the same editable domain object
|
// different versions of the same editable domain object
|
||||||
// are not shown in different sections of the same Edit
|
// are not shown in different sections of the same Edit
|
||||||
// UI, which might thereby fall out of sync.
|
// UI, which might thereby fall out of sync.
|
||||||
var cache;
|
var cache,
|
||||||
|
originalObject = domainObject;
|
||||||
|
|
||||||
// Constructor for EditableDomainObject, which adheres
|
// Constructor for EditableDomainObject, which adheres
|
||||||
// to the same shared cache.
|
// to the same shared cache.
|
||||||
@ -101,10 +102,15 @@ define(
|
|||||||
new Factory(capability, editableObject, domainObject, cache) :
|
new Factory(capability, editableObject, domainObject, cache) :
|
||||||
capability;
|
capability;
|
||||||
};
|
};
|
||||||
|
|
||||||
editableObject.getDomainObject = function() {
|
|
||||||
return domainObject;
|
editableObject.setOriginalObject = function(object) {
|
||||||
}
|
originalObject = object;
|
||||||
|
};
|
||||||
|
|
||||||
|
editableObject.getOriginalObject = function() {
|
||||||
|
return originalObject;
|
||||||
|
};
|
||||||
|
|
||||||
return editableObject;
|
return editableObject;
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
"key": "drop",
|
"key": "drop",
|
||||||
"implementation": "gestures/DropGesture.js",
|
"implementation": "gestures/DropGesture.js",
|
||||||
"depends": [ "dndService", "$q", "navigationService",
|
"depends": [ "dndService", "$q", "navigationService",
|
||||||
"objectService", "instantiate" ]
|
"objectService", "instantiate", "typeService" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "menu",
|
"key": "menu",
|
||||||
|
@ -42,7 +42,7 @@ define(
|
|||||||
* @param {DomainObject} domainObject the domain object whose
|
* @param {DomainObject} domainObject the domain object whose
|
||||||
* composition should be modified as a result of the drop.
|
* 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'),
|
var actionCapability = domainObject.getCapability('action'),
|
||||||
editableDomainObject,
|
editableDomainObject,
|
||||||
action; // Action for the drop, when it occurs
|
action; // Action for the drop, when it occurs
|
||||||
@ -108,16 +108,28 @@ define(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createVirtualPanel(base, overlayId){
|
function createVirtualPanel(base, overlayId){
|
||||||
var model = {
|
|
||||||
name: 'New telemetry panel',
|
var typeKey = 'telemetry.panel',
|
||||||
type: 'telemetry.panel',
|
type = typeService.getType(typeKey),
|
||||||
composition: [base.getId(), overlayId],
|
model = type.getInitialModel(),
|
||||||
location: base.getModel().location
|
id = uuid(),
|
||||||
},
|
newPanel = undefined;
|
||||||
id = uuid();
|
|
||||||
|
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
|
//ObjectService is wrapped by a decorator which is obscuring
|
||||||
// the newObject method.
|
// 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.
|
// the change.
|
||||||
if (id) {
|
if (id) {
|
||||||
if (shouldCreateVirtualPanel(domainObject)){
|
if (shouldCreateVirtualPanel(domainObject)){
|
||||||
virtualObj = new EditableDomainObject(createVirtualPanel(domainObject, id));
|
navigationService.setNavigation(createVirtualPanel(domainObject, id));
|
||||||
navigationService.setNavigation(virtualObj);
|
|
||||||
broadcastDrop(id, event);
|
broadcastDrop(id, event);
|
||||||
} else {
|
} else {
|
||||||
$q.when(action && action.perform()).then(function (result) {
|
$q.when(action && action.perform()).then(function (result) {
|
||||||
|
Loading…
Reference in New Issue
Block a user