Merge branch 'master' into persist-on-mutation-825
Conflicts: platform/commonUI/edit/src/actions/RemoveAction.js platform/commonUI/edit/test/actions/EditAndComposeActionSpec.js platform/commonUI/edit/test/actions/RemoveActionSpec.js platform/entanglement/src/services/LinkService.js platform/features/timeline/src/controllers/drag/TimelineDragHandler.js platform/features/timeline/src/controllers/swimlane/TimelineSwimlaneDecorator.js platform/features/timeline/test/controllers/drag/TimelineDragHandlerSpec.js platform/features/timeline/test/controllers/swimlane/TimelineSwimlaneDropHandlerSpec.js
This commit is contained in:
@@ -126,11 +126,11 @@ define(
|
||||
|
||||
label = this.verb + " To";
|
||||
|
||||
validateLocation = function (newParent) {
|
||||
validateLocation = function (newParentObj) {
|
||||
var newContext = self.cloneContext();
|
||||
newContext.selectedObject = object;
|
||||
newContext.domainObject = newParent;
|
||||
return composeService.validate(object, newParent) &&
|
||||
newContext.domainObject = newParentObj;
|
||||
return composeService.validate(object, newParentObj) &&
|
||||
self.policyService.allow("action", self, newContext);
|
||||
};
|
||||
|
||||
@@ -139,8 +139,8 @@ define(
|
||||
label,
|
||||
validateLocation,
|
||||
currentParent
|
||||
).then(function (newParent) {
|
||||
return composeService.perform(object, newParent);
|
||||
).then(function (newParentObj) {
|
||||
return composeService.perform(object, newParentObj);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ define(
|
||||
* @param totalObjects
|
||||
* @param processed
|
||||
*/
|
||||
CopyAction.prototype.progress = function(phase, totalObjects, processed){
|
||||
CopyAction.prototype.progress = function (phase, totalObjects, processed) {
|
||||
/*
|
||||
Copy has two distinct phases. In the first phase a copy plan is
|
||||
made in memory. During this phase of execution, the user is
|
||||
@@ -78,7 +78,7 @@ define(
|
||||
In the second phase, the copying is taking place, and the user
|
||||
is shown non-invasive banner notifications at the bottom of the screen.
|
||||
*/
|
||||
if (phase.toLowerCase() === 'preparing' && !this.dialog){
|
||||
if (phase.toLowerCase() === 'preparing' && !this.dialog) {
|
||||
this.dialog = this.dialogService.showBlockingMessage({
|
||||
title: "Preparing to copy objects",
|
||||
unknownProgress: true,
|
||||
@@ -105,15 +105,15 @@ define(
|
||||
* the AbstractComposeAction, but extends it to support notification
|
||||
* updates of progress on copy.
|
||||
*/
|
||||
CopyAction.prototype.perform = function() {
|
||||
CopyAction.prototype.perform = function () {
|
||||
var self = this;
|
||||
|
||||
function success(){
|
||||
function success() {
|
||||
self.notification.dismiss();
|
||||
self.notificationService.info("Copying complete.");
|
||||
}
|
||||
|
||||
function error(errorDetails){
|
||||
function error(errorDetails) {
|
||||
var errorMessage = {
|
||||
title: "Error copying objects.",
|
||||
severity: "error",
|
||||
@@ -121,7 +121,7 @@ define(
|
||||
minimized: true, // want the notification to be minimized initially (don't show banner)
|
||||
options: [{
|
||||
label: "OK",
|
||||
callback: function() {
|
||||
callback: function () {
|
||||
self.dialogService.dismiss();
|
||||
}
|
||||
}]
|
||||
@@ -138,7 +138,7 @@ define(
|
||||
self.dialogService.showBlockingMessage(errorMessage);
|
||||
|
||||
}
|
||||
function notification(details){
|
||||
function notification(details) {
|
||||
self.progress(details.phase, details.totalObjects, details.processed);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
|
||||
define(
|
||||
[ "./CopyTask" ],
|
||||
["./CopyTask"],
|
||||
function (CopyTask) {
|
||||
|
||||
/**
|
||||
@@ -83,11 +83,11 @@ define(
|
||||
|
||||
// Combines caller-provided filter (if any) with the
|
||||
// baseline behavior of respecting creation policy.
|
||||
function filterWithPolicy(domainObject) {
|
||||
return (!filter || filter(domainObject)) &&
|
||||
function filterWithPolicy(domainObj) {
|
||||
return (!filter || filter(domainObj)) &&
|
||||
policyService.allow(
|
||||
"creation",
|
||||
domainObject.getCapability("type")
|
||||
domainObj.getCapability("type")
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ define(
|
||||
* @param $q Angular's $q, for promises
|
||||
* @constructor
|
||||
*/
|
||||
function CopyTask (domainObject, parent, filter, $q){
|
||||
function CopyTask(domainObject, parent, filter, $q) {
|
||||
this.domainObject = domainObject;
|
||||
this.parent = parent;
|
||||
this.firstClone = undefined;
|
||||
@@ -89,11 +89,11 @@ define(
|
||||
* result in automatic request batching by the browser.
|
||||
*/
|
||||
function persistObjects(self) {
|
||||
return self.$q.all(self.clones.map(function(clone){
|
||||
return clone.getCapability("persistence").persist().then(function(){
|
||||
return self.$q.all(self.clones.map(function (clone) {
|
||||
return clone.getCapability("persistence").persist().then(function () {
|
||||
self.deferred.notify({phase: "copying", totalObjects: self.clones.length, processed: ++self.persisted});
|
||||
});
|
||||
})).then(function(){
|
||||
})).then(function () {
|
||||
return self;
|
||||
});
|
||||
}
|
||||
@@ -147,16 +147,16 @@ define(
|
||||
* @private
|
||||
* @returns {*}
|
||||
*/
|
||||
CopyTask.prototype.copyComposees = function(composees, clonedParent, originalParent){
|
||||
CopyTask.prototype.copyComposees = function (composees, clonedParent, originalParent) {
|
||||
var self = this,
|
||||
idMap = {};
|
||||
|
||||
return (composees || []).reduce(function(promise, originalComposee){
|
||||
return (composees || []).reduce(function (promise, originalComposee) {
|
||||
//If the composee is composed of other
|
||||
// objects, chain a promise..
|
||||
return promise.then(function(){
|
||||
return promise.then(function () {
|
||||
// ...to recursively copy it (and its children)
|
||||
return self.copy(originalComposee, originalParent).then(function(clonedComposee){
|
||||
return self.copy(originalComposee, originalParent).then(function (clonedComposee) {
|
||||
//Map the original composee's ID to that of its
|
||||
// clone so that we can replace any references to it
|
||||
// in the parent
|
||||
@@ -167,17 +167,18 @@ define(
|
||||
// set, however linked objects will not.
|
||||
return composeChild(clonedComposee, clonedParent, clonedComposee !== originalComposee);
|
||||
});
|
||||
});}, self.$q.when(undefined)
|
||||
).then(function(){
|
||||
//Replace any references in the cloned parent to
|
||||
// contained objects that have been composed with the
|
||||
// Ids of the clones
|
||||
self.rewriteIdentifiers(clonedParent.getModel(), idMap);
|
||||
});
|
||||
}, self.$q.when(undefined)
|
||||
).then(function () {
|
||||
//Replace any references in the cloned parent to
|
||||
// contained objects that have been composed with the
|
||||
// Ids of the clones
|
||||
self.rewriteIdentifiers(clonedParent.getModel(), idMap);
|
||||
|
||||
//Add the clone to the list of clones that will
|
||||
//be returned by this function
|
||||
self.clones.push(clonedParent);
|
||||
return clonedParent;
|
||||
//Add the clone to the list of clones that will
|
||||
//be returned by this function
|
||||
self.clones.push(clonedParent);
|
||||
return clonedParent;
|
||||
});
|
||||
};
|
||||
|
||||
@@ -192,7 +193,7 @@ define(
|
||||
* duplication, then a duplicate of the object, otherwise the object
|
||||
* itself (to allow linking to non duplicatable objects).
|
||||
*/
|
||||
CopyTask.prototype.copy = function(originalObject) {
|
||||
CopyTask.prototype.copy = function (originalObject) {
|
||||
var self = this,
|
||||
clone;
|
||||
|
||||
@@ -207,7 +208,7 @@ define(
|
||||
clone = this.parent.useCapability("instantiation", cloneObjectModel(originalObject.getModel()));
|
||||
|
||||
//Iterate through child tree
|
||||
return this.$q.when(originalObject.useCapability('composition')).then(function(composees){
|
||||
return this.$q.when(originalObject.useCapability('composition')).then(function (composees) {
|
||||
self.deferred.notify({phase: "preparing"});
|
||||
//Duplicate the object's children, and their children, and
|
||||
// so on down to the leaf nodes of the tree.
|
||||
@@ -234,10 +235,10 @@ define(
|
||||
* object being copied. The clones are all full composed with
|
||||
* references to their own children.
|
||||
*/
|
||||
CopyTask.prototype.buildCopyPlan = function() {
|
||||
CopyTask.prototype.buildCopyPlan = function () {
|
||||
var self = this;
|
||||
|
||||
return this.copy(self.domainObject, self.parent).then(function(domainObjectClone){
|
||||
return this.copy(self.domainObject, self.parent).then(function (domainObjectClone) {
|
||||
if (domainObjectClone !== self.domainObject) {
|
||||
domainObjectClone.getModel().location = self.parent.getId();
|
||||
}
|
||||
@@ -251,7 +252,7 @@ define(
|
||||
* @returns {promise} Which will resolve with a clone of the object
|
||||
* once complete.
|
||||
*/
|
||||
CopyTask.prototype.perform = function(){
|
||||
CopyTask.prototype.perform = function () {
|
||||
this.deferred = this.$q.defer();
|
||||
|
||||
this.buildCopyPlan()
|
||||
@@ -264,4 +265,4 @@ define(
|
||||
|
||||
return CopyTask;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -77,8 +77,8 @@ define(
|
||||
|
||||
return dialogService
|
||||
.getUserInput(formStructure, formState)
|
||||
.then(function (formState) {
|
||||
return formState.location;
|
||||
.then(function (userFormState) {
|
||||
return userFormState.location;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user