mirror of
https://github.com/nasa/openmct.git
synced 2025-03-23 12:35:48 +00:00
[Edit Mode] Visual indication of object being edited #278
This commit is contained in:
parent
9631d95a52
commit
10a44c026c
@ -80,6 +80,7 @@ define(
|
||||
EditorCapability.prototype.save = function (nonrecursive) {
|
||||
var domainObject = this.domainObject,
|
||||
editableObject = this.editableObject,
|
||||
self = this,
|
||||
cache = this.cache;
|
||||
|
||||
// Update the underlying, "real" domain object's model
|
||||
@ -95,8 +96,10 @@ define(
|
||||
return domainObject.getCapability('persistence').persist();
|
||||
}
|
||||
|
||||
editableObject.getCapability("status").set("editing", false);
|
||||
|
||||
return nonrecursive ?
|
||||
resolvePromise(doMutate()).then(doPersist) :
|
||||
resolvePromise(doMutate()).then(doPersist).then(function(){self.cancel()}) :
|
||||
resolvePromise(cache.saveAll());
|
||||
};
|
||||
|
||||
@ -109,6 +112,8 @@ define(
|
||||
* @memberof platform/commonUI/edit.EditorCapability#
|
||||
*/
|
||||
EditorCapability.prototype.cancel = function () {
|
||||
this.editableObject.getCapability("status").set("editing", false);
|
||||
//TODO: Reset the cache as well here.
|
||||
return resolvePromise(undefined);
|
||||
};
|
||||
|
||||
|
@ -116,7 +116,6 @@ define(
|
||||
}
|
||||
|
||||
cache = new EditableDomainObjectCache(EditableDomainObjectImpl, $q);
|
||||
|
||||
return cache.getEditableObject(domainObject);
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,8 @@ define(
|
||||
EditableDomainObjectCache.prototype.getEditableObject = function (domainObject) {
|
||||
var type = domainObject.getCapability('type'),
|
||||
EditableDomainObject = this.EditableDomainObject,
|
||||
editableObject;
|
||||
editableObject,
|
||||
statusListener;
|
||||
|
||||
// Track the top-level domain object; this will have
|
||||
// some special behavior for its context capability.
|
||||
@ -92,6 +93,14 @@ define(
|
||||
this.cache.getCachedModel(domainObject)
|
||||
);
|
||||
editableObject.getCapability("status").set('editing', true);
|
||||
if (!this.isRoot(domainObject)){
|
||||
statusListener = this.root.getCapability("status").listen(function(statuses){
|
||||
if (statuses.indexOf("editing") < 0 ){
|
||||
editableObject.getCapability("status").set("editing", false);
|
||||
statusListener();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return editableObject;
|
||||
};
|
||||
|
@ -23,7 +23,7 @@
|
||||
<span ng-controller="TreeNodeController as treeNode">
|
||||
<span
|
||||
class="tree-item menus-to-left"
|
||||
ng-class="{selected: treeNode.isSelected()}"
|
||||
ng-class="{selected: treeNode.isSelected(), active: editing}"
|
||||
>
|
||||
<span
|
||||
mct-device="desktop"
|
||||
|
@ -144,6 +144,15 @@ define(
|
||||
this.$timeout = $timeout;
|
||||
this.$scope = $scope;
|
||||
|
||||
//$scope.editing =
|
||||
// $scope.domainObject.getCapability('status').get().indexOf('editing') >=0;
|
||||
|
||||
//TODO: Temporary hack until css classes are defined for status
|
||||
// change
|
||||
$scope.domainObject.getCapability('status').listen(function(status){
|
||||
$scope.editing = status.indexOf('editing') >=0;
|
||||
});
|
||||
|
||||
// Listen for changes which will effect display parameters
|
||||
$scope.$watch("ngModel.selectedObject", setSelection);
|
||||
$scope.$watch("domainObject", checkSelection);
|
||||
|
Loading…
x
Reference in New Issue
Block a user