mirror of
https://github.com/nasa/openmct.git
synced 2025-05-29 21:54:20 +00:00
Invoke persist calls when leaving Edit mode in a group, instead of in-order, to allow these revision-checking to be handling for the group as a whole. WTD-1033.
34 lines
1.1 KiB
JavaScript
34 lines
1.1 KiB
JavaScript
/*global define,Promise*/
|
|
|
|
/**
|
|
* Module defining EditController. Created by vwoeltje on 11/14/14.
|
|
*/
|
|
define(
|
|
["../objects/EditableDomainObject"],
|
|
function (EditableDomainObject) {
|
|
"use strict";
|
|
|
|
/**
|
|
* Controller which is responsible for populating the scope for
|
|
* Edit mode; introduces an editable version of the currently
|
|
* navigated domain object into the scope.
|
|
* @constructor
|
|
*/
|
|
function EditController($scope, $q, navigationService) {
|
|
function setNavigation(domainObject) {
|
|
// Wrap the domain object such that all mutation is
|
|
// confined to edit mode (until Save)
|
|
$scope.navigatedObject =
|
|
domainObject && new EditableDomainObject(domainObject, $q);
|
|
}
|
|
|
|
setNavigation(navigationService.getNavigation());
|
|
navigationService.addListener(setNavigation);
|
|
$scope.$on("$destroy", function () {
|
|
navigationService.removeListener(setNavigation);
|
|
});
|
|
}
|
|
|
|
return EditController;
|
|
}
|
|
); |