mirror of
https://github.com/nasa/openmct.git
synced 2025-06-14 21:28:12 +00:00
[Persistence] Handle overwrite/cancel
Handle Overwrite/Cancel more correctly when revision conflicts are detected. WTD-1033.
This commit is contained in:
@ -22,10 +22,10 @@ define(
|
||||
// Issue a new persist call for the domain object associated with
|
||||
// this failure.
|
||||
function persist(failure) {
|
||||
var undecoratedPersistence =
|
||||
var decoratedPersistence =
|
||||
failure.domainObject.getCapability('persistence');
|
||||
return undecoratedPersistence &&
|
||||
undecoratedPersistence.persist();
|
||||
return decoratedPersistence &&
|
||||
decoratedPersistence.persist(true);
|
||||
}
|
||||
|
||||
// Retry persistence for this set of failed attempts
|
||||
@ -38,6 +38,16 @@ define(
|
||||
});
|
||||
}
|
||||
|
||||
// Discard changes for a failed refresh
|
||||
function discard(failure) {
|
||||
return failure.persistence.refresh(true);
|
||||
}
|
||||
|
||||
// Discard changes associated with a failed save
|
||||
function discardAll(failures) {
|
||||
return $q.all(failures.map(discard));
|
||||
}
|
||||
|
||||
// Handle failures in persistence
|
||||
function handleFailures(failures) {
|
||||
// Prepare dialog for display
|
||||
@ -49,6 +59,8 @@ define(
|
||||
// If so, try again
|
||||
if (key === PersistenceFailureConstants.OVERWRITE_KEY) {
|
||||
return retry(revisionErrors);
|
||||
} else {
|
||||
return discardAll(revisionErrors);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user