From 2f6f87c59e9858a6e945e295cc7ccb2b704d7e21 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Thu, 24 Sep 2015 17:30:33 +0200 Subject: [PATCH 01/10] feature #2977: Add isProvisionTabEnabled instead of isPanelTabEnabled Panels will be used to include vms panel tabs --- src/sunstone/public/app/sunstone-config.js | 9 ++++++ src/sunstone/public/app/tabs/provision-tab.js | 4 +-- .../public/app/tabs/provision-tab/content.hbs | 12 +++---- .../public/app/tabs/provision-tab/header.hbs | 12 +++---- .../helpers/isProvisionTabEnabled.js | 32 +++++++++++++++++++ 5 files changed, 55 insertions(+), 14 deletions(-) create mode 100644 src/sunstone/public/app/templates/helpers/isProvisionTabEnabled.js diff --git a/src/sunstone/public/app/sunstone-config.js b/src/sunstone/public/app/sunstone-config.js index 4de6cf7568..d4e292e426 100644 --- a/src/sunstone/public/app/sunstone-config.js +++ b/src/sunstone/public/app/sunstone-config.js @@ -50,6 +50,15 @@ define(function(require) { } }, + "isProvisionTabEnabled": function(tabName, panelTabName) { + if (_config['view']['tabs'][tabName]) { + var enabled = _config['view']['tabs'][tabName]['provision_tabs'][panelTabName]; + return enabled; + } else { + return false; + } + }, + "isFeatureEnabled": function(featureName) { if (_config['view']['features'] && _config['view']['features'][featureName]) { return true; diff --git a/src/sunstone/public/app/tabs/provision-tab.js b/src/sunstone/public/app/tabs/provision-tab.js index ff9b5546d6..0b512c26d3 100644 --- a/src/sunstone/public/app/tabs/provision-tab.js +++ b/src/sunstone/public/app/tabs/provision-tab.js @@ -841,7 +841,7 @@ define(function(require) { provision_vdc_templates_datatable.fnFilter("^(?!\-$)", 2, true, false); provision_vdc_templates_datatable.fnFilter("^1$", 3, true, false); - if (Config.isTabPanelEnabled("provision-tab", "templates")) { + if (Config.isProvisionTabEnabled("provision-tab", "templates")) { ProvisionTemplatesList.updateDatatable(provision_saved_templates_datatable); provision_saved_templates_datatable.fnFilter("^(?!\-$)", 2, true, false); provision_saved_templates_datatable.fnFilter("^0$", 3, true, false); @@ -993,7 +993,7 @@ define(function(require) { ProvisionVmsList.generate($(".provision_vms_list_section"), {active: true}); - if (Config.isTabPanelEnabled("provision-tab", "templates")) { + if (Config.isProvisionTabEnabled("provision-tab", "templates")) { ProvisionTemplatesList.generate($(".provision_templates_list_section"), {active: true}); } diff --git a/src/sunstone/public/app/tabs/provision-tab/content.hbs b/src/sunstone/public/app/tabs/provision-tab/content.hbs index 952247c4e7..38fbe6f563 100644 --- a/src/sunstone/public/app/tabs/provision-tab/content.hbs +++ b/src/sunstone/public/app/tabs/provision-tab/content.hbs @@ -20,17 +20,17 @@ {{> tabs/provision-tab/vms/create}} -{{#isTabPanelEnabled "provision-tab" "templates"}} +{{#isProvisionTabEnabled "provision-tab" "templates"}} -{{/isTabPanelEnabled}} +{{/isProvisionTabEnabled}} -{{#isTabPanelEnabled "provision-tab" "users"}} +{{#isProvisionTabEnabled "provision-tab" "users"}} {{> tabs/provision-tab/group/info}} {{> tabs/provision-tab/users/create}} -{{/isTabPanelEnabled}} +{{/isProvisionTabEnabled}} -{{#isTabPanelEnabled "provision-tab" "flows"}} +{{#isProvisionTabEnabled "provision-tab" "flows"}} {{> tabs/provision-tab/flows/create}} -{{/isTabPanelEnabled}} +{{/isProvisionTabEnabled}} diff --git a/src/sunstone/public/app/tabs/provision-tab/header.hbs b/src/sunstone/public/app/tabs/provision-tab/header.hbs index 9a4b69b082..7459c7763c 100644 --- a/src/sunstone/public/app/tabs/provision-tab/header.hbs +++ b/src/sunstone/public/app/tabs/provision-tab/header.hbs @@ -18,7 +18,7 @@
    - {{#isTabPanelEnabled "provision-tab" "users"}} + {{#isProvisionTabEnabled "provision-tab" "users"}}
  • @@ -31,29 +31,29 @@ {{tr "Users"}}
  • - {{/isTabPanelEnabled}} + {{/isProvisionTabEnabled}}
  • {{tr "VMs"}}
  • - {{#isTabPanelEnabled "provision-tab" "templates"}} + {{#isProvisionTabEnabled "provision-tab" "templates"}}
  • {{tr "Templates"}}
  • - {{/isTabPanelEnabled}} - {{#isTabPanelEnabled "provision-tab" "flows"}} + {{/isProvisionTabEnabled}} + {{#isProvisionTabEnabled "provision-tab" "flows"}}
  • {{tr "Services"}}
  • - {{/isTabPanelEnabled}} + {{/isProvisionTabEnabled}} {{!
  • diff --git a/src/sunstone/public/app/templates/helpers/isProvisionTabEnabled.js b/src/sunstone/public/app/templates/helpers/isProvisionTabEnabled.js new file mode 100644 index 0000000000..46bc29c8e4 --- /dev/null +++ b/src/sunstone/public/app/templates/helpers/isProvisionTabEnabled.js @@ -0,0 +1,32 @@ +/* -------------------------------------------------------------------------- */ +/* Copyright 2002-2015, OpenNebula Project (OpenNebula.org), C12G Labs */ +/* */ +/* 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) { + var Handlebars = require('hbs/handlebars'); + var Config = require('sunstone-config'); + + var isProvisionTabEnabled = function(tabName, panel, options) { + if (Config.isProvisionTabEnabled(tabName, panel)) { + return options.fn(this); + } else { + return options.inverse(this); + } + }; + + Handlebars.registerHelper('isProvisionTabEnabled', isProvisionTabEnabled); + + return isProvisionTabEnabled; +}) From de120906e4a414db9cf6d213abd143e290d66060 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Thu, 24 Sep 2015 17:37:30 +0200 Subject: [PATCH 02/10] feature #3977: Rename graph containers --- .../app/tabs/provision-tab/vms/info.hbs | 125 +++++++++--------- .../public/app/tabs/provision-tab/vms/list.js | 12 +- 2 files changed, 71 insertions(+), 66 deletions(-) diff --git a/src/sunstone/public/app/tabs/provision-tab/vms/info.hbs b/src/sunstone/public/app/tabs/provision-tab/vms/info.hbs index 1a8405a6c8..45a00d9224 100644 --- a/src/sunstone/public/app/tabs/provision-tab/vms/info.hbs +++ b/src/sunstone/public/app/tabs/provision-tab/vms/info.hbs @@ -78,7 +78,7 @@
-
+
@@ -95,7 +95,7 @@
-
+
@@ -107,75 +107,80 @@

-
-
-
-

- {{tr "Net RX"}} -

+
+
+
+

+ {{tr "Net RX"}} +

+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+

+ {{tr "Net TX"}} +

+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-

- {{tr "Net TX"}} -

+
+
+
+

+ {{tr "Net Download Speed"}} +

+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+

+ {{tr "Net Upload Speed"}} +

+
-
-
-
-
-
-
-
-
-

- {{tr "Net Download Speed"}} -

+
+
+
+
-
-
-
-
+
+
-
-
-
-
-
-
-
-

- {{tr "Net Upload Speed"}} -

-
-
-
-
-
-
-
-
-
-

-
+
+
+
+
+
diff --git a/src/sunstone/public/app/tabs/provision-tab/vms/list.js b/src/sunstone/public/app/tabs/provision-tab/vms/list.js index ac055aa695..880f64a9d2 100644 --- a/src/sunstone/public/app/tabs/provision-tab/vms/list.js +++ b/src/sunstone/public/app/tabs/provision-tab/vms/list.js @@ -392,27 +392,27 @@ define(function(require) { monitor_resources : "MONITORING/CPU", labels : "Real CPU", humanize_figures : false, - div_graph : $(".vm_cpu_graph", context) + div_graph : $(".vm_cpu_provision_graph", context) }, { monitor_resources : "MONITORING/MEMORY", labels : "Real MEM", humanize_figures : true, - div_graph : $(".vm_memory_graph", context) + div_graph : $(".vm_memory_provision_graph", context) }, { labels : "Network reception", monitor_resources : "MONITORING/NETRX", humanize_figures : true, convert_from_bytes : true, - div_graph : $(".vm_net_rx_graph", context) + div_graph : $(".vm_net_rx_provision_graph", context) }, { labels : "Network transmission", monitor_resources : "MONITORING/NETTX", humanize_figures : true, convert_from_bytes : true, - div_graph : $(".vm_net_tx_graph", context) + div_graph : $(".vm_net_tx_provision_graph", context) }, { labels : "Network reception speed", @@ -421,7 +421,7 @@ define(function(require) { convert_from_bytes : true, y_sufix : "B/s", derivative : true, - div_graph : $(".vm_net_rx_speed_graph", context) + div_graph : $(".vm_net_rx_speed_provision_graph", context) }, { labels : "Network transmission speed", @@ -430,7 +430,7 @@ define(function(require) { convert_from_bytes : true, y_sufix : "B/s", derivative : true, - div_graph : $(".vm_net_tx_speed_graph", context) + div_graph : $(".vm_net_tx_speed_provision_graph", context) } ]; From d9df000f05d8e5b439410448c4dfa533611fccec Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Thu, 24 Sep 2015 17:37:48 +0200 Subject: [PATCH 03/10] feature #2977: Refresh vm info if provision is enabled --- src/sunstone/public/app/tabs/vms-tab/actions.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/sunstone/public/app/tabs/vms-tab/actions.js b/src/sunstone/public/app/tabs/vms-tab/actions.js index 04d4e38d91..d50e1c84ad 100644 --- a/src/sunstone/public/app/tabs/vms-tab/actions.js +++ b/src/sunstone/public/app/tabs/vms-tab/actions.js @@ -15,6 +15,7 @@ /* -------------------------------------------------------------------------- */ define(function(require) { + var Config = require('sunstone-config'); var Sunstone = require('sunstone'); var Notifier = require('utils/notifier'); var Locale = require('utils/locale'); @@ -38,7 +39,21 @@ define(function(require) { var _actions = { "VM.list": _commonActions.list(), - "VM.show": _commonActions.show(), + "VM.show": { + type: "single", + call: OpenNebulaVM.show, + callback: function(request, response) { + if (Config.isTabEnabled("provision-tab")) { + $(".provision_refresh_info", ".provision_list_vms").click(); + } else { + Sunstone.getDataTable(TAB_ID).updateElement(request, response); + if (Sunstone.rightInfoVisible($('#' + TAB_ID))) { + Sunstone.insertPanels(TAB_ID, response); + } + } + }, + error: Notifier.onError + }, "VM.refresh": _commonActions.refresh(), "VM.delete": _commonActions.del(), "VM.chown": _commonActions.multipleAction('chown'), From 8f9f303fa9f6f4e44a324f548cfdd69f27af5603 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Thu, 24 Sep 2015 17:38:09 +0200 Subject: [PATCH 04/10] feature #2977: Add vm panels to cloud view --- src/sunstone/public/app/tabs/provision-tab.js | 35 +++++++++++++++++-- .../public/app/tabs/provision-tab/vms/list.js | 5 +++ 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/src/sunstone/public/app/tabs/provision-tab.js b/src/sunstone/public/app/tabs/provision-tab.js index 0b512c26d3..579bf7c949 100644 --- a/src/sunstone/public/app/tabs/provision-tab.js +++ b/src/sunstone/public/app/tabs/provision-tab.js @@ -969,12 +969,43 @@ define(function(require) { $(".alert-box-error", context).html(""); } + var _panels = [ + require('./vms-tab/panels/info'), + require('./vms-tab/panels/capacity'), + require('./vms-tab/panels/storage'), + require('./vms-tab/panels/network'), + require('./vms-tab/panels/snapshots'), + require('./vms-tab/panels/placement'), + require('./vms-tab/panels/actions'), + require('./vms-tab/panels/template'), + require('./vms-tab/panels/log') + ]; + + + var _dialogs = [ + //require('./vms-tab/dialogs/deploy'), + //require('./vms-tab/dialogs/migrate'), + require('./vms-tab/dialogs/resize'), + require('./vms-tab/dialogs/attach-disk'), + require('./vms-tab/dialogs/disk-snapshot'), + require('./vms-tab/dialogs/disk-saveas'), + require('./vms-tab/dialogs/attach-nic'), + require('./vms-tab/dialogs/snapshot'), + //require('./vms-tab/dialogs/vnc'), + //require('./vms-tab/dialogs/spice'), + //require('./vms-tab/dialogs/saveas-template') + ]; + + var Actions = require('./vms-tab/actions'); + var Tab = { tabId: TAB_ID, list_header: "", - actions: povision_actions, + actions: $.extend(povision_actions, Actions), content: TemplateContent(), - setup: _setup + setup: _setup, + panels: _panels, + dialogs: _dialogs }; return Tab; diff --git a/src/sunstone/public/app/tabs/provision-tab/vms/list.js b/src/sunstone/public/app/tabs/provision-tab/vms/list.js index 880f64a9d2..834bb18d20 100644 --- a/src/sunstone/public/app/tabs/provision-tab/vms/list.js +++ b/src/sunstone/public/app/tabs/provision-tab/vms/list.js @@ -16,6 +16,7 @@ define(function(require) { require('foundation.alert'); + var Sunstone = require('sunstone'); var OpenNebula = require('opennebula'); var OpenNebulaVM = require('opennebula/vm'); var Locale = require('utils/locale'); @@ -27,6 +28,7 @@ define(function(require) { var TemplateVmsList = require('hbs!./list'); + var TAB_ID = require('../tabId'); var _accordionId = 0; return { @@ -247,6 +249,9 @@ define(function(require) { }, error: Notifier.onError, success: function(request, response){ + $(".provision-right-info").html(""); + Sunstone.insertPanels(TAB_ID, response, TAB_ID, $(".provision-right-info", context)); + var data = response.VM var state = get_provision_vm_state(data); From d5e3a37976f6c758c5d3a645d1653a50d0fad6f0 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Thu, 24 Sep 2015 17:38:28 +0200 Subject: [PATCH 05/10] feature #2977: Fix this context in tab-datatable --- src/sunstone/public/app/utils/tab-datatable.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/sunstone/public/app/utils/tab-datatable.js b/src/sunstone/public/app/utils/tab-datatable.js index 79103bc52b..5c24ed7251 100644 --- a/src/sunstone/public/app/utils/tab-datatable.js +++ b/src/sunstone/public/app/utils/tab-datatable.js @@ -393,7 +393,7 @@ define(function(require) { var row_id_index = this.dataTable.attr("row_id"); if (row_id_index != undefined) { - $.each($(this.dataTable.fnGetNodes()), function() { + $.each($(that.dataTable.fnGetNodes()), function() { if ($('td.markrow', this).length != 0) { var aData = that.dataTable.fnGetData(this); @@ -403,7 +403,7 @@ define(function(require) { }); } - $.each($(this.dataTable.fnGetNodes()), function() { + $.each($(that.dataTable.fnGetNodes()), function() { if ($('td.markrowchecked', this).length != 0) { if (!isNaN($($('td', $(this))[1]).html())) { checked_row_ids.push($($('td', $(this))[1]).html()); @@ -416,11 +416,11 @@ define(function(require) { // dataTable.fnSettings is undefined when the table has been detached from // the DOM - if (this.dataTable && this.dataTable.fnSettings()) { - var dTable_settings = this.dataTable.fnSettings(); + if (that.dataTable && that.dataTable.fnSettings()) { + var dTable_settings = that.dataTable.fnSettings(); var prev_start = dTable_settings._iDisplayStart; - this.dataTable.fnClearTable(false); + that.dataTable.fnClearTable(false); var item_list; if (fromArray) { @@ -435,7 +435,6 @@ define(function(require) { }); } - var that = this; if (item_list.length > 0) { that.dataTable.fnAddData(item_list, false); } @@ -451,11 +450,11 @@ define(function(require) { dTable_settings.iInitDisplayStart = new_start; - this.dataTable.fnDraw(true); + that.dataTable.fnDraw(true); }; if (selected_row_id != undefined) { - $.each($(this.dataTable.fnGetNodes()), function() { + $.each($(that.dataTable.fnGetNodes()), function() { var aData = that.dataTable.fnGetData(this); @@ -466,7 +465,7 @@ define(function(require) { } if (checked_row_ids.length != 0) { - $.each($(this.dataTable.fnGetNodes()), function() { + $.each($(that.dataTable.fnGetNodes()), function() { var current_id = $($('td', this)[1]).html(); if (isNaN(current_id)) { From 088572599432c9ecc5d50e55e037abc0ca71b8b2 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Wed, 30 Sep 2015 16:02:32 +0200 Subject: [PATCH 06/10] feature #2977: Use isProvisionTabEnabled for templates --- src/sunstone/public/app/tabs/provision-tab/vms/info.hbs | 4 ++-- src/sunstone/public/app/tabs/provision-tab/vms/list.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sunstone/public/app/tabs/provision-tab/vms/info.hbs b/src/sunstone/public/app/tabs/provision-tab/vms/info.hbs index 45a00d9224..7af41a525c 100644 --- a/src/sunstone/public/app/tabs/provision-tab/vms/info.hbs +++ b/src/sunstone/public/app/tabs/provision-tab/vms/info.hbs @@ -30,14 +30,14 @@ - {{#isTabPanelEnabled "provision-tab" "templates"}} + {{#isProvisionTabEnabled "provision-tab" "templates"}} - {{/isTabPanelEnabled}} + {{/isProvisionTabEnabled}}
  • diff --git a/src/sunstone/public/app/tabs/provision-tab/vms/list.js b/src/sunstone/public/app/tabs/provision-tab/vms/list.js index 834bb18d20..c774921133 100644 --- a/src/sunstone/public/app/tabs/provision-tab/vms/list.js +++ b/src/sunstone/public/app/tabs/provision-tab/vms/list.js @@ -451,7 +451,7 @@ define(function(require) { }) } - if (Config.isTabPanelEnabled("provision-tab", "templates")) { + if (Config.isProvisionTabEnabled("provision-tab", "templates")) { context.on("click", ".provision_snapshot_button", function(){ $(".provision_confirm_action:first", context).html( '
    '+ From 5e5d15065d731a19c7b9de61ca1f8aa72f4eb016 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Wed, 30 Sep 2015 16:13:24 +0200 Subject: [PATCH 07/10] feature #2977: Use shutdown hard instead of delete in poff state --- src/sunstone/public/app/tabs/provision-tab/vms/list.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sunstone/public/app/tabs/provision-tab/vms/list.js b/src/sunstone/public/app/tabs/provision-tab/vms/list.js index c774921133..fe7cece7c9 100644 --- a/src/sunstone/public/app/tabs/provision-tab/vms/list.js +++ b/src/sunstone/public/app/tabs/provision-tab/vms/list.js @@ -282,8 +282,8 @@ define(function(require) { $(".provision_reboot_confirm_button", context).hide(); $(".provision_poweroff_confirm_button", context).hide(); $(".provision_poweron_button", context).show(); - $(".provision_delete_confirm_button", context).show(); - $(".provision_shutdownhard_confirm_button", context).hide(); + $(".provision_delete_confirm_button", context).hide(); + $(".provision_shutdownhard_confirm_button", context).show(); $(".provision_snapshot_button", context).show(); $(".provision_vnc_button", context).hide(); $(".provision_snapshot_button_disabled", context).hide(); From 0ed527c2d8c36fb79dee49fa90575249b3b5b00e Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Fri, 2 Oct 2015 15:28:31 +0200 Subject: [PATCH 08/10] feature #2977: Add undeploy action --- .../public/app/tabs/provision-tab/vms/list.js | 77 ++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) diff --git a/src/sunstone/public/app/tabs/provision-tab/vms/list.js b/src/sunstone/public/app/tabs/provision-tab/vms/list.js index fe7cece7c9..feb5de9efa 100644 --- a/src/sunstone/public/app/tabs/provision-tab/vms/list.js +++ b/src/sunstone/public/app/tabs/provision-tab/vms/list.js @@ -259,6 +259,7 @@ define(function(require) { case "deploying": $(".provision_reboot_confirm_button", context).hide(); $(".provision_poweroff_confirm_button", context).hide(); + $(".provision_undeploy_confirm_button", context).hide(); $(".provision_poweron_button", context).hide(); $(".provision_delete_confirm_button", context).show(); $(".provision_shutdownhard_confirm_button", context).hide(); @@ -270,6 +271,7 @@ define(function(require) { case "running": $(".provision_reboot_confirm_button", context).show(); $(".provision_poweroff_confirm_button", context).show(); + $(".provision_undeploy_confirm_button", context).show(); $(".provision_poweron_button", context).hide(); $(".provision_delete_confirm_button", context).hide(); $(".provision_shutdownhard_confirm_button", context).show(); @@ -281,6 +283,7 @@ define(function(require) { case "off": $(".provision_reboot_confirm_button", context).hide(); $(".provision_poweroff_confirm_button", context).hide(); + $(".provision_undeploy_confirm_button", context).hide(); $(".provision_poweron_button", context).show(); $(".provision_delete_confirm_button", context).hide(); $(".provision_shutdownhard_confirm_button", context).show(); @@ -289,10 +292,23 @@ define(function(require) { $(".provision_snapshot_button_disabled", context).hide(); $(".provision_vnc_button_disabled", context).show(); break; + case "undeployed": + $(".provision_reboot_confirm_button", context).hide(); + $(".provision_poweroff_confirm_button", context).hide(); + $(".provision_undeploy_confirm_button", context).hide(); + $(".provision_poweron_button", context).show(); + $(".provision_delete_confirm_button", context).hide(); + $(".provision_shutdownhard_confirm_button", context).show(); + $(".provision_snapshot_button", context).hide(); + $(".provision_vnc_button", context).hide(); + $(".provision_snapshot_button_disabled", context).hide(); + $(".provision_vnc_button_disabled", context).show(); + break; case "powering_off": case "error": $(".provision_reboot_confirm_button", context).hide(); $(".provision_poweroff_confirm_button", context).hide(); + $(".provision_undeploy_confirm_button", context).hide(); $(".provision_poweron_button", context).hide(); $(".provision_delete_confirm_button", context).show(); $(".provision_shutdownhard_confirm_button", context).hide(); @@ -305,6 +321,7 @@ define(function(require) { color = 'secondary'; $(".provision_reboot_confirm_button", context).hide(); $(".provision_poweroff_confirm_button", context).hide(); + $(".provision_undeploy_confirm_button", context).hide(); $(".provision_poweron_button", context).hide(); $(".provision_delete_confirm_button", context).show(); $(".provision_shutdownhard_confirm_button", context).hide(); @@ -587,6 +604,37 @@ define(function(require) { '
    '); }); + context.on("click", ".provision_undeploy_confirm_button", function(){ + $(".provision_confirm_action:first", context).html( + '
    '); + }); + context.on("click", ".provision_reboot_confirm_button", function(){ $(".provision_confirm_action:first", context).html( '
    '+ @@ -687,6 +735,29 @@ define(function(require) { return false; }); + context.on("click", ".provision_undeploy_button", function(){ + var button = $(this); + button.attr("disabled", "disabled"); + var vm_id = $(".provision_info_vm", context).attr("vm_id"); + var undeploy_action = $('input[name=provision_undeploy_radio]:checked').val() + + OpenNebula.VM[undeploy_action]({ + data : { + id: vm_id + }, + success: function(request, response){ + update_provision_vm_info(vm_id, context); + button.removeAttr("disabled"); + }, + error: function(request, response){ + Notifier.onError(request, response); + button.removeAttr("disabled"); + } + }) + + return false; + }); + context.on("click", ".provision_reboot_button", function(){ var button = $(this); button.attr("disabled", "disabled"); @@ -938,11 +1009,15 @@ define(function(require) { case OpenNebulaVM.STATES.STOPPED: case OpenNebulaVM.STATES.SUSPENDED: case OpenNebulaVM.STATES.POWEROFF: - case OpenNebulaVM.STATES.UNDEPLOYED: case OpenNebulaVM.STATES.DONE: state_color = 'off'; state_str = Locale.tr("OFF"); + break; + case OpenNebulaVM.STATES.UNDEPLOYED: + state_color = 'undeployed'; + state_str = Locale.tr("UNDEPLOYED"); + break; default: state_color = 'powering_off'; From 4c090bc240167cab28d87c38093b10f8c91c3af0 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Fri, 2 Oct 2015 15:28:49 +0200 Subject: [PATCH 09/10] feature #2977: Use yaml files to configure actions --- .../public/app/tabs/provision-tab/vms/info.hbs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/sunstone/public/app/tabs/provision-tab/vms/info.hbs b/src/sunstone/public/app/tabs/provision-tab/vms/info.hbs index 7af41a525c..0a9167fcef 100644 --- a/src/sunstone/public/app/tabs/provision-tab/vms/info.hbs +++ b/src/sunstone/public/app/tabs/provision-tab/vms/info.hbs @@ -40,21 +40,36 @@ {{/isProvisionTabEnabled}}
  • + {{#isTabActionEnabled "provision-tab" "VM.delete"}} + {{/isTabActionEnabled}} + {{#isTabActionEnabled "provision-tab" "VM.shutdown_hard"}} + {{/isTabActionEnabled}} + {{#isTabActionEnabled "provision-tab" "VM.poweroff"}} + {{/isTabActionEnabled}} + {{#isTabActionEnabled "provision-tab" "VM.undeploy"}} + + + + {{/isTabActionEnabled}} + {{#isTabActionEnabled "provision-tab" "VM.resume"}} + {{/isTabActionEnabled}} + {{#isTabActionEnabled "provision-tab" "VM.reboot"}} + {{/isTabActionEnabled}}
  • From 151690b82ee277a044534f6e45373ec181a89c42 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Fri, 2 Oct 2015 15:29:39 +0200 Subject: [PATCH 10/10] feature #2977: Update yaml files with new options --- src/sunstone/etc/sunstone-views/cloud.yaml | 62 +++++++++++++++++- .../etc/sunstone-views/cloud_vcenter.yaml | 64 +++++++++++++++++- .../etc/sunstone-views/groupadmin.yaml | 63 +++++++++++++++++- .../sunstone-views/groupadmin_vcenter.yaml | 65 ++++++++++++++++++- 4 files changed, 248 insertions(+), 6 deletions(-) diff --git a/src/sunstone/etc/sunstone-views/cloud.yaml b/src/sunstone/etc/sunstone-views/cloud.yaml index 298a12b6a2..85fb5b4e8c 100644 --- a/src/sunstone/etc/sunstone-views/cloud.yaml +++ b/src/sunstone/etc/sunstone-views/cloud.yaml @@ -8,12 +8,43 @@ features: tabs: provision-tab: panel_tabs: + vm_info_tab: false + vm_capacity_tab: false + vm_hotplugging_tab: false + vm_network_tab: false + vm_snapshot_tab: false + vm_placement_tab: false + vm_actions_tab: false + vm_template_tab: false + vm_log_tab: false + provision_tabs: users: false flows: true templates: true - actions: + actions: &provisionactions Template.chmod: false Template.delete: true + VM.resume: true + VM.reboot: true + VM.reboot_hard: true + VM.poweroff: true + VM.poweroff_hard: true + VM.undeploy: false + VM.undeploy_hard: false + VM.shutdown_hard: true + VM.delete: true + VM.resize: false + VM.attachdisk: false + VM.detachdisk: false + VM.disk_saveas: false + VM.attachnic: false + VM.detachnic: false + VM.snapshot_create: false + VM.snapshot_revert: false + VM.snapshot_delete: false + VM.disk_snapshot_create: false + VM.disk_snapshot_revert: false + VM.disk_snapshot_delete: false dashboard: quotas: true vms: true @@ -33,3 +64,32 @@ tabs: user_showback_tab: true actions: User.quotas_dialog: false + vms-tab: + actions: *provisionactions + images-tab: + table_columns: + - 0 # Checkbox + - 1 # ID + - 2 # Owner + - 3 # Group + - 4 # Name + - 5 # Datastore + #- 6 # Size + - 7 # Type + #- 8 # Registration time + #- 9 # Persistent + - 10 # Status + - 11 # #VMs + #- 12 # Target + vnets-tab: + table_columns: + - 0 # Checkbox + - 1 # ID + - 2 # Owner + - 3 # Group + - 4 # Name + - 5 # Reservation + - 6 # Cluster + #- 7 # Bridge + - 8 # Leases + #- 9 # VLAN ID diff --git a/src/sunstone/etc/sunstone-views/cloud_vcenter.yaml b/src/sunstone/etc/sunstone-views/cloud_vcenter.yaml index 55ab8eb8a7..9495e19cef 100644 --- a/src/sunstone/etc/sunstone-views/cloud_vcenter.yaml +++ b/src/sunstone/etc/sunstone-views/cloud_vcenter.yaml @@ -8,12 +8,43 @@ features: tabs: provision-tab: panel_tabs: + vm_info_tab: false + vm_capacity_tab: false + vm_hotplugging_tab: false + vm_network_tab: false + vm_snapshot_tab: false + vm_placement_tab: false + vm_actions_tab: false + vm_template_tab: false + vm_log_tab: false + provision_tabs: users: false flows: true templates: false - actions: + actions: &provisionactions Template.chmod: false Template.delete: true + VM.resume: true + VM.reboot: true + VM.reboot_hard: true + VM.poweroff: true + VM.poweroff_hard: true + VM.undeploy: false + VM.undeploy_hard: false + VM.shutdown_hard: true + VM.delete: true + VM.resize: false + VM.attachdisk: false + VM.detachdisk: false + VM.disk_saveas: false + VM.attachnic: false + VM.detachnic: false + VM.snapshot_create: false + VM.snapshot_revert: false + VM.snapshot_delete: false + VM.disk_snapshot_create: false + VM.disk_snapshot_revert: false + VM.disk_snapshot_delete: false dashboard: quotas: true vms: true @@ -31,4 +62,33 @@ tabs: user_accounting_tab: true user_showback_tab: true actions: - User.quotas_dialog: false \ No newline at end of file + User.quotas_dialog: false + vms-tab: + actions: *provisionactions + images-tab: + table_columns: + - 0 # Checkbox + - 1 # ID + - 2 # Owner + - 3 # Group + - 4 # Name + - 5 # Datastore + #- 6 # Size + - 7 # Type + #- 8 # Registration time + #- 9 # Persistent + - 10 # Status + - 11 # #VMs + #- 12 # Target + vnets-tab: + table_columns: + - 0 # Checkbox + - 1 # ID + - 2 # Owner + - 3 # Group + - 4 # Name + - 5 # Reservation + - 6 # Cluster + #- 7 # Bridge + - 8 # Leases + #- 9 # VLAN ID diff --git a/src/sunstone/etc/sunstone-views/groupadmin.yaml b/src/sunstone/etc/sunstone-views/groupadmin.yaml index 992fb3bf69..fc82168c55 100644 --- a/src/sunstone/etc/sunstone-views/groupadmin.yaml +++ b/src/sunstone/etc/sunstone-views/groupadmin.yaml @@ -8,12 +8,43 @@ features: tabs: provision-tab: panel_tabs: + vm_info_tab: false + vm_capacity_tab: false + vm_hotplugging_tab: false + vm_network_tab: false + vm_snapshot_tab: false + vm_placement_tab: false + vm_actions_tab: false + vm_template_tab: false + vm_log_tab: false + provision_tabs: users: true flows: true templates: true - actions: + actions: &provisionactions Template.chmod: true Template.delete: true + VM.resume: true + VM.reboot: true + VM.reboot_hard: true + VM.poweroff: true + VM.poweroff_hard: true + VM.undeploy: false + VM.undeploy_hard: false + VM.shutdown_hard: true + VM.delete: true + VM.resize: false + VM.attachdisk: false + VM.detachdisk: false + VM.disk_saveas: false + VM.attachnic: false + VM.detachnic: false + VM.snapshot_create: false + VM.snapshot_revert: false + VM.snapshot_delete: false + VM.disk_snapshot_create: false + VM.disk_snapshot_revert: false + VM.disk_snapshot_delete: false dashboard: quotas: false vms: false @@ -33,3 +64,33 @@ tabs: user_showback_tab: true actions: User.quotas_dialog: false + vms-tab: + actions: *provisionactions + images-tab: + table_columns: + - 0 # Checkbox + - 1 # ID + - 2 # Owner + - 3 # Group + - 4 # Name + - 5 # Datastore + #- 6 # Size + - 7 # Type + #- 8 # Registration time + #- 9 # Persistent + - 10 # Status + - 11 # #VMs + #- 12 # Target + vnets-tab: + table_columns: + - 0 # Checkbox + - 1 # ID + - 2 # Owner + - 3 # Group + - 4 # Name + - 5 # Reservation + - 6 # Cluster + #- 7 # Bridge + - 8 # Leases + #- 9 # VLAN ID + diff --git a/src/sunstone/etc/sunstone-views/groupadmin_vcenter.yaml b/src/sunstone/etc/sunstone-views/groupadmin_vcenter.yaml index f9aa865470..2f2b78d2d9 100644 --- a/src/sunstone/etc/sunstone-views/groupadmin_vcenter.yaml +++ b/src/sunstone/etc/sunstone-views/groupadmin_vcenter.yaml @@ -8,12 +8,43 @@ features: tabs: provision-tab: panel_tabs: + vm_info_tab: false + vm_capacity_tab: false + vm_hotplugging_tab: false + vm_network_tab: false + vm_snapshot_tab: false + vm_placement_tab: false + vm_actions_tab: false + vm_template_tab: false + vm_log_tab: false + provision_tabs: users: true flows: true templates: false - actions: - Template.chmod: true + actions: &provisionactions + Template.chmod: false Template.delete: true + VM.resume: true + VM.reboot: true + VM.reboot_hard: true + VM.poweroff: true + VM.poweroff_hard: true + VM.undeploy: false + VM.undeploy_hard: false + VM.shutdown_hard: true + VM.delete: true + VM.resize: false + VM.attachdisk: false + VM.detachdisk: false + VM.disk_saveas: false + VM.attachnic: false + VM.detachnic: false + VM.snapshot_create: false + VM.snapshot_revert: false + VM.snapshot_delete: false + VM.disk_snapshot_create: false + VM.disk_snapshot_revert: false + VM.disk_snapshot_delete: false dashboard: quotas: false vms: false @@ -32,3 +63,33 @@ tabs: user_showback_tab: true actions: User.quotas_dialog: false + vms-tab: + actions: *provisionactions + images-tab: + table_columns: + - 0 # Checkbox + - 1 # ID + - 2 # Owner + - 3 # Group + - 4 # Name + - 5 # Datastore + #- 6 # Size + - 7 # Type + #- 8 # Registration time + #- 9 # Persistent + - 10 # Status + - 11 # #VMs + #- 12 # Target + vnets-tab: + table_columns: + - 0 # Checkbox + - 1 # ID + - 2 # Owner + - 3 # Group + - 4 # Name + - 5 # Reservation + - 6 # Cluster + #- 7 # Bridge + - 8 # Leases + #- 9 # VLAN ID +