mirror of
https://github.com/nasa/openmct.git
synced 2025-06-10 19:31:42 +00:00
[Persistence] Remove persistence usage from TimelineSwimlaneDropHandler
This commit is contained in:
parent
bea9f22a0c
commit
f85ac79b4a
@ -31,16 +31,6 @@ define(
|
|||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function TimelineSwimlaneDropHandler(swimlane) {
|
function TimelineSwimlaneDropHandler(swimlane) {
|
||||||
// Utility function; like $q.when, but synchronous (to reduce
|
|
||||||
// performance impact when wrapping synchronous values)
|
|
||||||
function asPromise(value) {
|
|
||||||
return (value && value.then) ? value : {
|
|
||||||
then: function (callback) {
|
|
||||||
return asPromise(callback(value));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if we are in edit mode
|
// Check if we are in edit mode
|
||||||
function inEditMode() {
|
function inEditMode() {
|
||||||
return swimlane.domainObject.hasCapability("editor");
|
return swimlane.domainObject.hasCapability("editor");
|
||||||
@ -76,16 +66,7 @@ define(
|
|||||||
|
|
||||||
// Initiate mutation of a domain object
|
// Initiate mutation of a domain object
|
||||||
function doMutate(domainObject, mutator) {
|
function doMutate(domainObject, mutator) {
|
||||||
return asPromise(
|
return domainObject.useCapability("mutation", mutator);
|
||||||
domainObject.useCapability("mutation", mutator)
|
|
||||||
).then(function () {
|
|
||||||
// Persist the results of mutation
|
|
||||||
var persistence = domainObject.getCapability("persistence");
|
|
||||||
if (persistence) {
|
|
||||||
// Persist the changes
|
|
||||||
persistence.persist();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if this swimlane is in a state where a drop-after will
|
// Check if this swimlane is in a state where a drop-after will
|
||||||
|
Loading…
x
Reference in New Issue
Block a user