diff --git a/src/sunstone/etc/sunstone-views/admin.yaml b/src/sunstone/etc/sunstone-views/admin.yaml index 61e5109979..50126b97f1 100644 --- a/src/sunstone/etc/sunstone-views/admin.yaml +++ b/src/sunstone/etc/sunstone-views/admin.yaml @@ -394,6 +394,7 @@ tabs: #- 7 # Search data actions: Service.refresh: true + Service.create_dialog: true Service.chown: true Service.chgrp: true Service.chmod: true diff --git a/src/sunstone/etc/sunstone-views/admin_vcenter.yaml b/src/sunstone/etc/sunstone-views/admin_vcenter.yaml index 146507daca..578729b520 100644 --- a/src/sunstone/etc/sunstone-views/admin_vcenter.yaml +++ b/src/sunstone/etc/sunstone-views/admin_vcenter.yaml @@ -394,6 +394,7 @@ tabs: #- 7 # Search data actions: Service.refresh: true + Service.create_dialog: true Service.chown: true Service.chgrp: true Service.chmod: true diff --git a/src/sunstone/etc/sunstone-views/groupadmin.yaml b/src/sunstone/etc/sunstone-views/groupadmin.yaml index 6fd771df7d..9a2998f46e 100644 --- a/src/sunstone/etc/sunstone-views/groupadmin.yaml +++ b/src/sunstone/etc/sunstone-views/groupadmin.yaml @@ -394,6 +394,7 @@ tabs: #- 7 # Search data actions: Service.refresh: true + Service.create_dialog: true Service.chown: true Service.chgrp: false Service.chmod: false diff --git a/src/sunstone/etc/sunstone-views/groupadmin_vcenter.yaml b/src/sunstone/etc/sunstone-views/groupadmin_vcenter.yaml index de51f2edc5..dab14b7133 100644 --- a/src/sunstone/etc/sunstone-views/groupadmin_vcenter.yaml +++ b/src/sunstone/etc/sunstone-views/groupadmin_vcenter.yaml @@ -396,6 +396,7 @@ tabs: #- 7 # Search data actions: Service.refresh: true + Service.create_dialog: true Service.chown: true Service.chgrp: false Service.chmod: false diff --git a/src/sunstone/etc/sunstone-views/user.yaml b/src/sunstone/etc/sunstone-views/user.yaml index 95b8719f18..3656972904 100644 --- a/src/sunstone/etc/sunstone-views/user.yaml +++ b/src/sunstone/etc/sunstone-views/user.yaml @@ -395,6 +395,7 @@ tabs: #- 7 # Search data actions: Service.refresh: true + Service.create_dialog: true Service.chown: false Service.chgrp: false Service.chmod: true diff --git a/src/sunstone/public/app/tabs/oneflow-services-tab.js b/src/sunstone/public/app/tabs/oneflow-services-tab.js index c1515819e3..b669f5290c 100644 --- a/src/sunstone/public/app/tabs/oneflow-services-tab.js +++ b/src/sunstone/public/app/tabs/oneflow-services-tab.js @@ -39,6 +39,7 @@ define(function(require) { ]; var _formPanels = [ + require('./oneflow-services-tab/form-panels/create') ]; var Tab = { diff --git a/src/sunstone/public/app/tabs/oneflow-services-tab/actions.js b/src/sunstone/public/app/tabs/oneflow-services-tab/actions.js index d7b4fac7ef..048409042f 100644 --- a/src/sunstone/public/app/tabs/oneflow-services-tab/actions.js +++ b/src/sunstone/public/app/tabs/oneflow-services-tab/actions.js @@ -29,6 +29,7 @@ define(function(require) { var ROLES_PANEL_ID = require('./panels/roles/panelId'); var SCALE_DIALOG_ID = require('./dialogs/scale/dialogId'); + var CREATE_DIALOG_ID = require('./form-panels/create/formPanelId'); var _commonActions = new CommonActions(OpenNebulaResource, RESOURCE, TAB_ID, XML_ROOT, Locale.tr("Service created")); @@ -81,7 +82,12 @@ define(function(require) { "Service.rename": _commonActions.singleAction('rename'), "Service.shutdown": _commonActions.multipleAction('shutdown'), "Service.recover": _commonActions.multipleAction('recover'), - + "Service.create_dialog" : { + type: "custom", + call: function() { + Sunstone.showFormPanel(TAB_ID, CREATE_DIALOG_ID, "create"); + } + }, "Service.list" : { type: "list", call: OpenNebulaResource.list, diff --git a/src/sunstone/public/app/tabs/oneflow-services-tab/buttons.js b/src/sunstone/public/app/tabs/oneflow-services-tab/buttons.js index 2519047246..5d32a41035 100644 --- a/src/sunstone/public/app/tabs/oneflow-services-tab/buttons.js +++ b/src/sunstone/public/app/tabs/oneflow-services-tab/buttons.js @@ -23,6 +23,11 @@ define(function(require) { layout: "refresh", alwaysActive: true }, + "Service.create_dialog" : { + type: "action", + layout: "create", + alwaysActive: true + }, "Service.chown" : { type: "confirm_with_select", text: Locale.tr("Change owner"), diff --git a/src/sunstone/public/app/tabs/oneflow-services-tab/form-panels/create.js b/src/sunstone/public/app/tabs/oneflow-services-tab/form-panels/create.js new file mode 100644 index 0000000000..b30895bc42 --- /dev/null +++ b/src/sunstone/public/app/tabs/oneflow-services-tab/form-panels/create.js @@ -0,0 +1,89 @@ +/* -------------------------------------------------------------------------- */ +/* Copyright 2002-2016, OpenNebula Project, OpenNebula Systems */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ +/* not use this file except in compliance with the License. You may obtain */ +/* a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/* -------------------------------------------------------------------------- */ + +define(function(require) { + /* + DEPENDENCIES + */ + + var InstantiateTemplateFormPanel = require('tabs/oneflow-templates-tab/form-panels/instantiate'); + var Locale = require('utils/locale'); + var Tips = require('utils/tips'); + var TemplatesTable = require('tabs/oneflow-templates-tab/datatable'); + /* + CONSTANTS + */ + + var FORM_PANEL_ID = require('./create/formPanelId'); + var TAB_ID = require('../tabId'); + + /* + CONSTRUCTOR + */ + + function FormPanel() { + InstantiateTemplateFormPanel.call(this); + + this.formPanelId = FORM_PANEL_ID; + this.tabId = TAB_ID; + this.actions = { + 'create': { + 'title': Locale.tr("Create Service"), + 'buttonText': Locale.tr("Create"), + 'resetButton': true + } + }; + + this.templatesTable = new TemplatesTable('service_create', {'select': true}); + } + + FormPanel.FORM_PANEL_ID = FORM_PANEL_ID; + FormPanel.prototype = Object.create(InstantiateTemplateFormPanel.prototype); + FormPanel.prototype.constructor = FormPanel; + FormPanel.prototype.onShow = _onShow; + FormPanel.prototype.setup = _setup; + + return FormPanel; + + /* + FUNCTION DEFINITIONS + */ + function _setup(context) { + var that = this; + InstantiateTemplateFormPanel.prototype.setup.call(this, context); + + $(".selectTemplateTable", context).html( + '
' + this.templatesTable.dataTableHTML + '
'); + + this.templatesTable.initialize(); + + $(".instantiate_wrapper", context).hide(); + + this.templatesTable.idInput().on("change", function(){ + $(".instantiate_wrapper", context).show(); + + var template_id = $(this).val(); + that.setTemplateId(context, template_id); + }); + + Tips.setup(context); + } + + function _onShow(context) { + this.templatesTable.refreshResourceTableSelect(); + InstantiateTemplateFormPanel.prototype.onShow.call(this, context); + } +}); diff --git a/src/sunstone/public/app/tabs/oneflow-services-tab/form-panels/create/formPanelId.js b/src/sunstone/public/app/tabs/oneflow-services-tab/form-panels/create/formPanelId.js new file mode 100644 index 0000000000..efe8d7e775 --- /dev/null +++ b/src/sunstone/public/app/tabs/oneflow-services-tab/form-panels/create/formPanelId.js @@ -0,0 +1,19 @@ +/* -------------------------------------------------------------------------- */ +/* Copyright 2002-2016, OpenNebula Project, OpenNebula Systems */ +/* */ +/* Licensed under the Apache License, Version 2.0 (the "License"); you may */ +/* not use this file except in compliance with the License. You may obtain */ +/* a copy of the License at */ +/* */ +/* http://www.apache.org/licenses/LICENSE-2.0 */ +/* */ +/* Unless required by applicable law or agreed to in writing, software */ +/* distributed under the License is distributed on an "AS IS" BASIS, */ +/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ +/* See the License for the specific language governing permissions and */ +/* limitations under the License. */ +/* -------------------------------------------------------------------------- */ + +define(function(require){ + return 'createServiceForm'; +}) diff --git a/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/instantiate/html.hbs b/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/instantiate/html.hbs index 25e0648e0b..8d856276fe 100644 --- a/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/instantiate/html.hbs +++ b/src/sunstone/public/app/tabs/oneflow-templates-tab/form-panels/instantiate/html.hbs @@ -16,28 +16,34 @@
-
- - -
-
- - +
-
- - -
-
- -
-
+
+
+
+ + +
+
+ + +
+
+
+ + +
+
+ +
+
+
diff --git a/src/sunstone/public/app/tabs/vms-tab/form-panels/create.js b/src/sunstone/public/app/tabs/vms-tab/form-panels/create.js index 6451768734..ab4982b247 100644 --- a/src/sunstone/public/app/tabs/vms-tab/form-panels/create.js +++ b/src/sunstone/public/app/tabs/vms-tab/form-panels/create.js @@ -19,15 +19,9 @@ define(function(require) { DEPENDENCIES */ -// require('foundation.tab'); var InstantiateTemplateFormPanel = require('tabs/templates-tab/form-panels/instantiate'); - var Sunstone = require('sunstone'); var Locale = require('utils/locale'); var Tips = require('utils/tips'); - var Notifier = require('utils/notifier'); - var WizardFields = require('utils/wizard-fields'); - var UserInputs = require('utils/user-inputs'); - var OpenNebulaTemplate = require('opennebula/template'); var TemplatesTable = require('tabs/templates-tab/datatable'); /* CONSTANTS @@ -76,7 +70,7 @@ define(function(require) { this.templatesTable.initialize(); - $("#selected_resource_id_vm_create", context).on("change", function(){ + this.templatesTable.idInput().on("change", function(){ $(".nameContainer", context).show(); $(".persistentContainer", context).show();