From 277da84abd28d2e57d61cdd794397ee45b80089c Mon Sep 17 00:00:00 2001 From: Abel Coronado Date: Thu, 14 Dec 2017 12:00:12 +0100 Subject: [PATCH] F #1511: Better DashBoard for Sunstone (#1582) Simplifies widgets and improves response times on large deployments --- src/sunstone/etc/sunstone-views/admin.yaml | 4 +- .../etc/sunstone-views/admin_vcenter.yaml | 4 +- src/sunstone/etc/sunstone-views/cloud.yaml | 2 +- .../etc/sunstone-views/groupadmin.yaml | 4 +- .../sunstone-views/groupadmin_vcenter.yaml | 4 +- src/sunstone/public/app/tabs/dashboard-tab.js | 25 +----- .../public/app/tabs/dashboard-tab/hosts.hbs | 37 ++++----- .../public/app/tabs/dashboard-tab/html.hbs | 14 ++-- .../public/app/tabs/dashboard-tab/network.hbs | 35 +++++---- .../public/app/tabs/dashboard-tab/storage.hbs | 35 +++++---- .../public/app/tabs/dashboard-tab/users.hbs | 46 ++++------- .../public/app/tabs/dashboard-tab/vms.hbs | 52 +++++-------- .../public/app/tabs/groups-tab/datatable.js | 4 +- .../public/app/tabs/hosts-tab/datatable.js | 26 ++++--- .../public/app/tabs/images-tab/datatable.js | 10 ++- src/sunstone/public/app/tabs/provision-tab.js | 23 +----- .../provision-tab/dashboard/group-quotas.hbs | 10 ++- .../app/tabs/provision-tab/dashboard/vms.hbs | 76 +++++-------------- .../public/app/tabs/users-tab/datatable.js | 4 +- .../public/app/tabs/vms-tab/datatable.js | 17 ++++- .../public/app/tabs/vnets-tab/datatable.js | 7 +- src/sunstone/public/app/utils/dashboard.js | 57 ++++++++++++++ src/sunstone/public/app/utils/humanize.js | 21 +++++ src/sunstone/public/css/custom.css | 36 +++++++++ 24 files changed, 299 insertions(+), 254 deletions(-) create mode 100644 src/sunstone/public/app/utils/dashboard.js diff --git a/src/sunstone/etc/sunstone-views/admin.yaml b/src/sunstone/etc/sunstone-views/admin.yaml index 0c1bdcc6e9..0f49d87e23 100644 --- a/src/sunstone/etc/sunstone-views/admin.yaml +++ b/src/sunstone/etc/sunstone-views/admin.yaml @@ -90,11 +90,11 @@ tabs: Dashboard.refresh: false Sunstone.toggle_top: false widgets_one_per_row: - - vms - hosts - - users widgets_three_per_row: widgets_two_per_row: + - vms + - users - storage - network widgets_one_footer: diff --git a/src/sunstone/etc/sunstone-views/admin_vcenter.yaml b/src/sunstone/etc/sunstone-views/admin_vcenter.yaml index 2b01e203f6..dea8aedfe4 100644 --- a/src/sunstone/etc/sunstone-views/admin_vcenter.yaml +++ b/src/sunstone/etc/sunstone-views/admin_vcenter.yaml @@ -90,11 +90,11 @@ tabs: Dashboard.refresh: false Sunstone.toggle_top: false widgets_one_per_row: - - vms - hosts - - users widgets_three_per_row: widgets_two_per_row: + - vms + - users widgets_one_footer: system-top-tab: panel_tabs: diff --git a/src/sunstone/etc/sunstone-views/cloud.yaml b/src/sunstone/etc/sunstone-views/cloud.yaml index 50f1eefdaf..a9e244cdd3 100644 --- a/src/sunstone/etc/sunstone-views/cloud.yaml +++ b/src/sunstone/etc/sunstone-views/cloud.yaml @@ -17,7 +17,7 @@ features: # will be set to the same value as VCPU, that will still be visible for the # end users instantiate_hide_cpu: false - + # False to not scale the CPU. Number [0, 1] to scale from VCPU instantiate_cpu_factor: false diff --git a/src/sunstone/etc/sunstone-views/groupadmin.yaml b/src/sunstone/etc/sunstone-views/groupadmin.yaml index 9dff28ef08..32546a4e8d 100644 --- a/src/sunstone/etc/sunstone-views/groupadmin.yaml +++ b/src/sunstone/etc/sunstone-views/groupadmin.yaml @@ -90,10 +90,10 @@ tabs: Dashboard.refresh: false Sunstone.toggle_top: false widgets_one_per_row: - - vms - - users widgets_three_per_row: widgets_two_per_row: + - vms + - users - groupquotas - quotas widgets_one_footer: diff --git a/src/sunstone/etc/sunstone-views/groupadmin_vcenter.yaml b/src/sunstone/etc/sunstone-views/groupadmin_vcenter.yaml index 46bd5c8db1..71402927a7 100644 --- a/src/sunstone/etc/sunstone-views/groupadmin_vcenter.yaml +++ b/src/sunstone/etc/sunstone-views/groupadmin_vcenter.yaml @@ -90,10 +90,10 @@ tabs: Dashboard.refresh: false Sunstone.toggle_top: false widgets_one_per_row: - - vms - - users widgets_three_per_row: widgets_two_per_row: + - vms + - users - groupquotas - quotas widgets_one_footer: diff --git a/src/sunstone/public/app/tabs/dashboard-tab.js b/src/sunstone/public/app/tabs/dashboard-tab.js index e5fc30a0f3..9a2ae69de7 100644 --- a/src/sunstone/public/app/tabs/dashboard-tab.js +++ b/src/sunstone/public/app/tabs/dashboard-tab.js @@ -87,29 +87,7 @@ define(function(require) { 'vms': { 'html': require('hbs!./dashboard-tab/vms'), 'onShow': function() { - var end_time = -1; // today - var start_time = Math.floor(new Date().getTime() / 1000); - start_time = start_time - 604800; // 604800 = 7 days = 7*24*60*60 - - var options = { - "start_time": start_time, - "end_time": end_time - } - - var no_table = true; - - $("#acct_cpu_graph, #acct_mem_graph, #acct_disk_graph", "#dashboard_vm_accounting").html(''+ - ''+ - '') - OpenNebulaVM.accounting({ - success: function(req, response) { - Accounting.fillAccounting($("#dashboard_vm_accounting"), req, response, no_table); - Accounting.fillAccounting($("#dashboard_user_accounting"), req, response, no_table); - Sunstone.runAction("VM.list"); - }, - error: Notifier.onError, - data: options - }); + Sunstone.runAction("VM.list"); } }, 'groupquotas': { @@ -278,7 +256,6 @@ define(function(require) { function _setup() { _initialized = true; - $(document).on("click", ".show_vms_tab", function(){ Sunstone.showTab(VMS_TAB_ID); return false; diff --git a/src/sunstone/public/app/tabs/dashboard-tab/hosts.hbs b/src/sunstone/public/app/tabs/dashboard-tab/hosts.hbs index 6e31396917..b23d5869cd 100644 --- a/src/sunstone/public/app/tabs/dashboard-tab/hosts.hbs +++ b/src/sunstone/public/app/tabs/dashboard-tab/hosts.hbs @@ -15,35 +15,28 @@ {{! -------------------------------------------------------------------------- }}
-
- - - +
+
+
+
{{tr "Hosts"}}
+
+
+ + +
+
- -
+
+
-
+
-
+
-
+
diff --git a/src/sunstone/public/app/tabs/dashboard-tab/html.hbs b/src/sunstone/public/app/tabs/dashboard-tab/html.hbs index 6e89c0756f..b5b66e45c1 100644 --- a/src/sunstone/public/app/tabs/dashboard-tab/html.hbs +++ b/src/sunstone/public/app/tabs/dashboard-tab/html.hbs @@ -15,6 +15,13 @@ {{! -------------------------------------------------------------------------- }}
+
+ {{#each twoPerRow}} +
+ {{{this}}} +
+ {{/each}} +
{{#each onePerRow}}
@@ -29,13 +36,6 @@
{{/each}}
-
- {{#each twoPerRow}} -
- {{{this}}} -
- {{/each}} -