[Edit] Cancel action depends on promise resolution

Cancel action no longer cares about return value, simply
will not execute if navigtion promise does not resolve.

https://github.com/nasa/openmct/issues/1360
This commit is contained in:
Pete Richards 2016-12-20 15:28:15 -08:00
parent fcda211800
commit 6328bd9354

View File

@ -56,13 +56,13 @@ define(
//navigate back to parent because nothing to show. //navigate back to parent because nothing to show.
return domainObject.getCapability("location").getOriginal().then(function (original) { return domainObject.getCapability("location").getOriginal().then(function (original) {
parent = original.getCapability("context").getParent(); parent = original.getCapability("context").getParent();
parent.getCapability("action").perform("navigate"); return parent.getCapability("action").perform("navigate");
}); });
} }
} }
function cancel(allowed) { function cancel() {
return allowed && domainObject.getCapability("editor").finish(); return domainObject.getCapability("editor").finish();
} }
//Do navigation first in order to trigger unsaved changes dialog //Do navigation first in order to trigger unsaved changes dialog