mirror of
https://github.com/nasa/openmct.git
synced 2025-05-14 22:43:40 +00:00
[Mobile] RemoveAction Tweak
If you remove an object you are currently within/opened, then on removal of it you navigate to the parent of whatever you removed.
This commit is contained in:
parent
7e35e55f0b
commit
18348476c6
@ -59,7 +59,7 @@
|
|||||||
"glyph": "Z",
|
"glyph": "Z",
|
||||||
"name": "Remove",
|
"name": "Remove",
|
||||||
"description": "Remove this object from its containing object.",
|
"description": "Remove this object from its containing object.",
|
||||||
"depends": [ "$q" ]
|
"depends": [ "$q", "navigationService" ]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"key": "save",
|
"key": "save",
|
||||||
|
@ -40,7 +40,7 @@ define(
|
|||||||
* @constructor
|
* @constructor
|
||||||
* @memberof module:editor/actions/remove-action
|
* @memberof module:editor/actions/remove-action
|
||||||
*/
|
*/
|
||||||
function RemoveAction($q, context) {
|
function RemoveAction($q, navigationService, context) {
|
||||||
var object = (context || {}).domainObject;
|
var object = (context || {}).domainObject;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -69,6 +69,15 @@ define(
|
|||||||
return persistence && persistence.persist();
|
return persistence && persistence.persist();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function checkCurrentObjectNavigation(parent) {
|
||||||
|
var currParent = navigationService.getNavigation().getCapability('context').getParent()
|
||||||
|
if(currParent.getId() === parent.getId()) {
|
||||||
|
navigationService.setNavigation(parent);
|
||||||
|
} else {
|
||||||
|
console.log("ALL GOOD");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the object from its parent, as identified by its context
|
* Remove the object from its parent, as identified by its context
|
||||||
* capability.
|
* capability.
|
||||||
@ -77,6 +86,9 @@ define(
|
|||||||
*/
|
*/
|
||||||
function removeFromContext(contextCapability) {
|
function removeFromContext(contextCapability) {
|
||||||
var parent = contextCapability.getParent();
|
var parent = contextCapability.getParent();
|
||||||
|
// Goes to parent if deleting currently
|
||||||
|
// opened object
|
||||||
|
checkCurrentObjectNavigation(parent);
|
||||||
$q.when(
|
$q.when(
|
||||||
parent.useCapability('mutation', doMutate)
|
parent.useCapability('mutation', doMutate)
|
||||||
).then(function () {
|
).then(function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user