[Common UI] Initial commonUI bundles

Bring in work on general-purpose and over-arching
user interface bundles from the sandbox transition
branch. WTD-574.
This commit is contained in:
Victor Woeltjen
2014-11-23 15:41:20 -08:00
parent 0cd331e8a5
commit 1b0303e517
73 changed files with 6035 additions and 0 deletions

View File

@@ -0,0 +1,67 @@
/*global define,Promise*/
/**
* Module defining CreateAction. Created by vwoeltje on 11/10/14.
*/
define(
['./CreateWizard'],
function (CreateWizard) {
"use strict";
/**
*
* @constructor
*/
function CreateAction(type, parent, context, dialogService, creationService) {
/*
1. Show dialog
a. Prepare dialog contents
b. Invoke dialogService
2. Create new object in persistence service
a. Generate UUID
b. Store model
3. Mutate destination container
a. Get mutation capability
b. Add new id to composition
4. Persist destination container
a. ...use persistence capability.
*/
function perform() {
var wizard = new CreateWizard(type, parent);
function persistResult(formValue) {
var parent = wizard.getLocation(formValue),
newModel = wizard.createModel(formValue);
return creationService.createObject(newModel, parent);
}
function doNothing() {
// Create cancelled, do nothing
return false;
}
return dialogService.getUserInput(
wizard.getFormModel()
).then(persistResult, doNothing);
}
return {
perform: perform,
getMetadata: function () {
return {
key: 'create',
glyph: type.getGlyph(),
name: type.getName(),
description: type.getDescription(),
context: context
};
}
};
}
return CreateAction;
}
);