Improvements to copy notifications

This commit is contained in:
Henry
2015-10-29 17:40:17 -07:00
parent 05722d9b11
commit f44819a7fe
3 changed files with 4 additions and 8 deletions

View File

@@ -66,15 +66,12 @@ define(
} }
notificationModel.progress = (processed / totalObjects) * 100; notificationModel.progress = (processed / totalObjects) * 100;
notificationModel.title = ["Copied ", processed, "of ", totalObjects, "objects"].join(" "); notificationModel.title = ["Copied ", processed, "of ", totalObjects, "objects"].join(" ");
if (processed === totalObjects){
notification.dismiss();
self.notificationService.info(["Successfully copied ", totalObjects, " items."].join(""));
}
} }
} }
AbstractComposeAction.prototype.perform.call(this, progress) AbstractComposeAction.prototype.perform.call(this, progress)
.then(function(){ .then(function(){
notification.dismiss();
self.notificationService.info("Copying complete."); self.notificationService.info("Copying complete.");
}) })
.catch(function (error){ .catch(function (error){

View File

@@ -114,7 +114,6 @@ define(
return modelClone; return modelClone;
}); });
}); });
}; };
return copy(domainObject, parent).then(function(){ return copy(domainObject, parent).then(function(){
return clones; return clones;
@@ -137,7 +136,7 @@ define(
return self.$q.all(objectClones.map(function(clone, index){ return self.$q.all(objectClones.map(function(clone, index){
return self.persistenceService.createObject(clone.persistenceSpace, clone.model.id, clone.model) return self.persistenceService.createObject(clone.persistenceSpace, clone.model.id, clone.model)
.then(function(){ .then(function(){
progress("copying", objectClones.length, ++persisted); progress && progress("copying", objectClones.length, ++persisted);
}); });
})).then(function(){ return objectClones}); })).then(function(){ return objectClones});
} }
@@ -177,7 +176,7 @@ define(
var $q = this.$q, var $q = this.$q,
self = this; self = this;
if (this.validate(domainObject, parent)) { if (this.validate(domainObject, parent)) {
progress("preparing"); progress && progress("preparing");
return this.buildCopyPlan(domainObject, parent) return this.buildCopyPlan(domainObject, parent)
.then(self.persistObjects(progress)) .then(self.persistObjects(progress))
.then(self.addClonesToParent(parent, progress)); .then(self.addClonesToParent(parent, progress));

View File

@@ -140,7 +140,7 @@ define(
.args[0](newParent); .args[0](newParent);
expect(composeService.perform) expect(composeService.perform)
.toHaveBeenCalledWith(selectedObject, newParent); .toHaveBeenCalledWith(selectedObject, newParent, undefined);
}); });
}); });
}); });