Merge pull request #665 from nasa/open660

[Edit Mode] Added ability to clear all dirty cache
This commit is contained in:
Victor Woeltjen 2016-02-10 09:19:19 -08:00
commit 5daf2f54cd
2 changed files with 9 additions and 2 deletions

View File

@ -125,7 +125,7 @@ define(
EditorCapability.prototype.cancel = function () {
this.editableObject.getCapability("status").set("editing", false);
//TODO: Reset the cache as well here.
this.cache.markClean(this.editableObject);
this.cache.markClean();
return resolvePromise(undefined);
};

View File

@ -126,7 +126,14 @@ define(
* @param {DomainObject} domainObject the domain object
*/
EditableDomainObjectCache.prototype.markClean = function (domainObject) {
delete this.dirtyObjects[domainObject.getId()];
var self = this;
if (!domainObject) {
Object.keys(this.dirtyObjects).forEach(function(key) {
delete self.dirtyObjects[key];
});
} else {
delete this.dirtyObjects[domainObject.getId()];
}
};
/**