[Entanglement] Add entanglement bundle

The entanglement bundle defines move, copy, and link actions, and
exposes them as context menu actions.

* The Move action moves an object from it's current parent to a new
parent object.
* The Copy action deep-copies an object to a new parent object.
* The Link action links an object to a new parent object.

These actions are implemented by three new services: moveService,
copyService, and linkService.

Mocks are provided for each service for easy testing of components
that depend on them.

Additionally, this bundle provides a DomainObjectFactory that simplifies
the construction of mockDomainObjects for tests.

These actions are exposed to the user as context menu options.
This commit is contained in:
larkin
2015-06-11 11:58:53 -07:00
parent 8811f2a53e
commit 9123078293
21 changed files with 2035 additions and 0 deletions

View File

@ -0,0 +1,61 @@
/*global define */
define(
function () {
"use strict";
/**
* The LocationService allows for easily prompting the user for a
* location in the root tree.
*/
function LocationService(dialogService) {
return {
/** Prompt the user to select a location. Returns a promise
* that is resolved with a domainObject representing the
* location selected by the user.
*
* @param {string} title - title of location dialog
* @param {string} label - label for location input field
* @param {function} validate - function that validates
* selections.
* @param {domainObject} initialLocation - tree location to
* display at start
* @returns {Promise} promise for a domain object.
*/
getLocationFromUser: function (title, label, validate, initialLocation) {
var formStructure,
formState;
formStructure = {
sections: [
{
name: 'Location',
rows: [
{
name: label,
control: "locator",
validate: validate,
key: 'location'
}
]
}
],
name: title
};
formState = {
location: initialLocation
};
return dialogService
.getUserInput(formStructure, formState)
.then(function (formState) {
return formState.location;
});
}
};
}
return LocationService;
}
);