mirror of
https://github.com/nasa/openmct.git
synced 2025-06-14 05:08:15 +00:00
Addressing issues from code review
This commit is contained in:
@ -36,8 +36,9 @@ define(
|
||||
* @memberof platform/commonUI/edit
|
||||
* @constructor
|
||||
*/
|
||||
function EditObjectController($scope, $location) {
|
||||
function EditObjectController($scope, $location, policyService) {
|
||||
this.scope = $scope;
|
||||
this.policyService = policyService;
|
||||
|
||||
var navigatedObject;
|
||||
function setViewForDomainObject(domainObject) {
|
||||
@ -73,16 +74,14 @@ define(
|
||||
*/
|
||||
EditObjectController.prototype.getUnloadWarning = function () {
|
||||
var navigatedObject = this.scope.domainObject,
|
||||
editorCapability = navigatedObject &&
|
||||
navigatedObject.getCapability("editor"),
|
||||
statusCapability = navigatedObject &&
|
||||
navigatedObject.getCapability("status"),
|
||||
hasChanges = statusCapability && statusCapability.get('editing')
|
||||
&& editorCapability && editorCapability.dirty();
|
||||
policyMessage;
|
||||
|
||||
this.policyService.allow("navigation", navigatedObject, undefined, function(message) {
|
||||
policyMessage = message;
|
||||
});
|
||||
|
||||
return policyMessage;
|
||||
|
||||
return hasChanges ?
|
||||
"Unsaved changes will be lost if you leave this page." :
|
||||
undefined;
|
||||
};
|
||||
|
||||
return EditObjectController;
|
||||
|
Reference in New Issue
Block a user