Added notifications
This commit is contained in:
@@ -71,7 +71,7 @@ define(
|
||||
* @param {string} [suffix] a string to display in the dialog title;
|
||||
* default is "to a new location"
|
||||
*/
|
||||
function AbstractComposeAction(locationService, composeService, context, verb, suffix) {
|
||||
function AbstractComposeAction(locationService, composeService, context, verb, suffix, progressCallback) {
|
||||
if (context.selectedObject) {
|
||||
this.newParent = context.domainObject;
|
||||
this.object = context.selectedObject;
|
||||
@@ -87,6 +87,7 @@ define(
|
||||
this.composeService = composeService;
|
||||
this.verb = verb || "Compose";
|
||||
this.suffix = suffix || "to a new location";
|
||||
this.progressCallback = progressCallback;
|
||||
}
|
||||
|
||||
AbstractComposeAction.prototype.perform = function () {
|
||||
@@ -97,6 +98,7 @@ define(
|
||||
composeService = this.composeService,
|
||||
currentParent = this.currentParent,
|
||||
newParent = this.newParent,
|
||||
progressCallback = this.progressCallback,
|
||||
object = this.object;
|
||||
|
||||
if (newParent) {
|
||||
@@ -118,7 +120,7 @@ define(
|
||||
validateLocation,
|
||||
currentParent
|
||||
).then(function (newParent) {
|
||||
return composeService.perform(object, newParent);
|
||||
return composeService.perform(object, newParent, progressCallback);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -34,13 +34,43 @@ define(
|
||||
* @constructor
|
||||
* @memberof platform/entanglement
|
||||
*/
|
||||
function CopyAction(locationService, copyService, context) {
|
||||
function CopyAction(locationService, copyService, dialogService, notificationService, context) {
|
||||
var notification,
|
||||
notificationModel = {
|
||||
title: "Copying objects",
|
||||
unknownProgress: false,
|
||||
severity: "info",
|
||||
};
|
||||
|
||||
function progress(phase, totalObjects, processed){
|
||||
if (phase.toLowerCase() === 'preparing'){
|
||||
console.log('preparing');
|
||||
dialogService.showBlockingMessage({
|
||||
title: "Preparing to copy objects",
|
||||
unknownProgress: true,
|
||||
severity: "info",
|
||||
});
|
||||
} else if (phase.toLowerCase() === "copying") {
|
||||
console.log('copying');
|
||||
dialogService.dismiss();
|
||||
if (!notification) {
|
||||
notification = notificationService.notify(notificationModel);
|
||||
}
|
||||
notificationModel.progress = (processed / totalObjects) * 100;
|
||||
notificationModel.title = ["Copying ", processed, "of ", totalObjects, "objects"].join(" ");
|
||||
if (processed >= totalObjects){
|
||||
notification.dismiss();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new AbstractComposeAction(
|
||||
locationService,
|
||||
copyService,
|
||||
context,
|
||||
"Duplicate",
|
||||
"to a location"
|
||||
"to a location",
|
||||
progress
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user