mirror of
https://github.com/nasa/openmct.git
synced 2025-05-30 22:24:18 +00:00
[Persistence] Remove persistence usage from EditRepresenter
This commit is contained in:
parent
b0cbb5a2b4
commit
8756b7213f
@ -52,17 +52,13 @@ define(
|
|||||||
this.listenHandle = undefined;
|
this.listenHandle = undefined;
|
||||||
|
|
||||||
// Mutate and persist a new version of a domain object's model.
|
// Mutate and persist a new version of a domain object's model.
|
||||||
function doPersist(model) {
|
function doMutate(model) {
|
||||||
var domainObject = self.domainObject;
|
var domainObject = self.domainObject;
|
||||||
|
|
||||||
// First, mutate; then, persist.
|
// First, mutate; then, persist.
|
||||||
return $q.when(domainObject.useCapability("mutation", function () {
|
return $q.when(domainObject.useCapability("mutation", function () {
|
||||||
return model;
|
return model;
|
||||||
})).then(function (result) {
|
}));
|
||||||
// Only persist when mutation was successful
|
|
||||||
return result &&
|
|
||||||
domainObject.getCapability("persistence").persist();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle changes to model and/or view configuration
|
// Handle changes to model and/or view configuration
|
||||||
@ -82,14 +78,14 @@ define(
|
|||||||
].join(" "));
|
].join(" "));
|
||||||
|
|
||||||
// Update the configuration stored in the model, and persist.
|
// Update the configuration stored in the model, and persist.
|
||||||
if (domainObject && domainObject.hasCapability("persistence")) {
|
if (domainObject) {
|
||||||
// Configurations for specific views are stored by
|
// Configurations for specific views are stored by
|
||||||
// key in the "configuration" field of the model.
|
// key in the "configuration" field of the model.
|
||||||
if (self.key && configuration) {
|
if (self.key && configuration) {
|
||||||
model.configuration = model.configuration || {};
|
model.configuration = model.configuration || {};
|
||||||
model.configuration[self.key] = configuration;
|
model.configuration[self.key] = configuration;
|
||||||
}
|
}
|
||||||
doPersist(model);
|
doMutate(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user