From 8f5256f8872ced838b210b6ba99bb5f6eb4b7820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Wed, 10 Jun 2015 12:34:31 +0200 Subject: [PATCH] Feature #3748: Oneflow template create wizard --- .../public/app/tabs/oneflow-templates-tab.js | 2 +- .../app/tabs/oneflow-templates-tab/actions.js | 2 +- .../form-panels/create.js | 354 ++++++++++++++++++ .../form-panels/create/advanced.hbs | 12 + .../form-panels/create/formPanelId.js | 3 + .../form-panels/create/wizard.hbs | 100 +++++ .../oneflow-templates-tab/utils/role-tab.js | 211 +++++++++++ .../utils/role-tab/elasticity-row.hbs | 30 ++ .../utils/role-tab/html.hbs | 205 ++++++++++ .../utils/role-tab/sche-row.hbs | 27 ++ 10 files changed, 944 insertions(+), 2 deletions(-) create mode 100644 src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/create.js create mode 100644 src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/create/advanced.hbs create mode 100644 src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/create/formPanelId.js create mode 100644 src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/create/wizard.hbs create mode 100644 src/sunstone/public/app/tabs/oneflow-templates-tab/utils/role-tab.js create mode 100644 src/sunstone/public/app/tabs/oneflow-templates-tab/utils/role-tab/elasticity-row.hbs create mode 100644 src/sunstone/public/app/tabs/oneflow-templates-tab/utils/role-tab/html.hbs create mode 100644 src/sunstone/public/app/tabs/oneflow-templates-tab/utils/role-tab/sche-row.hbs diff --git a/src/sunstone/public/app/tabs/oneflow-templates-tab.js b/src/sunstone/public/app/tabs/oneflow-templates-tab.js index d0068d024f..b59f418a1f 100644 --- a/src/sunstone/public/app/tabs/oneflow-templates-tab.js +++ b/src/sunstone/public/app/tabs/oneflow-templates-tab.js @@ -18,7 +18,7 @@ define(function(require) { ]; var _formPanels = [ - //require('./oneflow-templates-tab/form-panels/create') + require('./oneflow-templates-tab/form-panels/create') ]; var Tab = { diff --git a/src/sunstone/public/app/tabs/oneflow-templates-tab/actions.js b/src/sunstone/public/app/tabs/oneflow-templates-tab/actions.js index e4e9fff2de..b9c99b83e3 100644 --- a/src/sunstone/public/app/tabs/oneflow-templates-tab/actions.js +++ b/src/sunstone/public/app/tabs/oneflow-templates-tab/actions.js @@ -6,7 +6,7 @@ define(function(require) { var CommonActions = require('utils/common-actions'); var TAB_ID = require('./tabId'); - //var CREATE_DIALOG_ID = require('./form-panels/create/formPanelId'); + var CREATE_DIALOG_ID = require('./form-panels/create/formPanelId'); //var INSTANTIATE_DIALOG_ID = require('./dialogs/instantiate/dialogId'); var XML_ROOT = "DOCUMENT"; var RESOURCE = "ServiceTemplate"; diff --git a/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/create.js b/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/create.js new file mode 100644 index 0000000000..879ab2e479 --- /dev/null +++ b/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/create.js @@ -0,0 +1,354 @@ +define(function(require) { + /* + DEPENDENCIES + */ + + require('foundation.tab'); + var BaseFormPanel = require('utils/form-panels/form-panel'); + var Sunstone = require('sunstone'); + var Locale = require('utils/locale'); + var Tips = require('utils/tips'); + var RoleTab = require('tabs/oneflow-templates-tab/utils/role-tab'); + + /* + TEMPLATES + */ + + var TemplateWizardHTML = require('hbs!./create/wizard'); + var TemplateAdvancedHTML = require('hbs!./create/advanced'); + + /* + CONSTANTS + */ + + var FORM_PANEL_ID = require('./create/formPanelId'); + var TAB_ID = require('../tabId'); + + /* + CONSTRUCTOR + */ + + function FormPanel() { + this.formPanelId = FORM_PANEL_ID; + this.tabId = TAB_ID; + this.actions = { + 'create': { + 'title': Locale.tr("Create Service Template"), + 'buttonText': Locale.tr("Create"), + 'resetButton': true + }, + 'update': { + 'title': Locale.tr("Update Service Template"), + 'buttonText': Locale.tr("Update"), + 'resetButton': false + } + }; + + BaseFormPanel.call(this); + } + + FormPanel.FORM_PANEL_ID = FORM_PANEL_ID; + FormPanel.prototype = Object.create(BaseFormPanel.prototype); + FormPanel.prototype.constructor = FormPanel; + FormPanel.prototype.htmlWizard = _htmlWizard; + FormPanel.prototype.htmlAdvanced = _htmlAdvanced; + FormPanel.prototype.submitWizard = _submitWizard; + FormPanel.prototype.submitAdvanced = _submitAdvanced; + FormPanel.prototype.onShow = _onShow; + FormPanel.prototype.fill = _fill; + FormPanel.prototype.setup = _setup; + FormPanel.prototype.addRoleTab = _add_role_tab; + + return FormPanel; + + /* + FUNCTION DEFINITIONS + */ + + function _htmlWizard() { + return TemplateWizardHTML({ + 'formPanelId': this.formPanelId + }); + } + + function _htmlAdvanced() { + return TemplateAdvancedHTML({ + 'formPanelId': this.formPanelId + }); + } + + function _setup(context) { + this.roleTabObjects = {}; + var that = this; + + var roles_index = 0; + + $(".add_service_network", context).on("click", function(){ + $(".service_networks tbody").append( + '\ + \ + \ + '+Locale.tr("Only word characters are allowed")+'\ + \ + \ + + + + \ No newline at end of file diff --git a/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/create/formPanelId.js b/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/create/formPanelId.js new file mode 100644 index 0000000000..470c675aca --- /dev/null +++ b/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/create/formPanelId.js @@ -0,0 +1,3 @@ +define(function(require){ + return 'createServiceTemplateForm'; +}); \ No newline at end of file diff --git a/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/create/wizard.hbs b/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/create/wizard.hbs new file mode 100644 index 0000000000..a68412f1b0 --- /dev/null +++ b/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/create/wizard.hbs @@ -0,0 +1,100 @@ +
+
+
+ + +
+
+
+
+
+
+ +