From 4f3fd8db57c06e26406ab7a98d5843c3098487f6 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Mon, 18 Aug 2014 12:59:10 +0200 Subject: [PATCH] feature #2461: Do not ask for monitoring info and logs until the tab is clicked --- src/sunstone/public/js/plugins/vms-tab.js | 29 +++++++++++++---------- src/sunstone/public/js/sunstone.js | 10 +++++--- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/sunstone/public/js/plugins/vms-tab.js b/src/sunstone/public/js/plugins/vms-tab.js index b8bb233acd..95f50bf71c 100644 --- a/src/sunstone/public/js/plugins/vms-tab.js +++ b/src/sunstone/public/js/plugins/vms-tab.js @@ -1454,9 +1454,20 @@ function updateVMInfo(request,vm){ //Pop up the info panel and asynchronously get vm_log and stats Sunstone.popUpInfoPanel("vm_info_panel", "vms-tab"); - Sunstone.runAction("VM.log",vm_info.ID); - Sunstone.runAction("VM.monitor",vm_info.ID, - { monitor_resources : "CPU,MEMORY,NET_TX,NET_RX"}); + + $("[href='#vm_capacity_tab']").on("click", function(){ + Sunstone.runAction("VM.monitor",vm_info.ID, + { monitor_resources : "CPU,MEMORY"}); + }) + + $("[href='#vm_network_tab']").on("click", function(){ + Sunstone.runAction("VM.monitor",vm_info.ID, + { monitor_resources : "NET_TX,NET_RX"}); + }) + + $("[href='#vm_log_tab']").on("click", function(){ + Sunstone.runAction("VM.log",vm_info.ID); + }) var $info_panel = $('div#vm_info_panel'); var $hotplugging_tab = $('div#vm_hotplugging_tab', $info_panel); @@ -2320,25 +2331,17 @@ function printCapacity(vm_info){ \
\
\ -
\ +
\
\
\
\ -
\ -
\ -
\ -
\
\
\
\

'+tr("REAL MEMORY")+'

\
\
\ -
\ -
\ -
\ -
\ -
\ +
\
\
\
\ diff --git a/src/sunstone/public/js/sunstone.js b/src/sunstone/public/js/sunstone.js index 88634f833b..91e5dbdc37 100644 --- a/src/sunstone/public/js/sunstone.js +++ b/src/sunstone/public/js/sunstone.js @@ -1860,7 +1860,7 @@ function plot_graph(response, info) { var data = response.monitoring[attribute]; - if(info.derivative == true) { + if(info.derivative == true && data) { derivative(data); } @@ -1889,11 +1889,13 @@ function plot_graph(response, info) { color: "#efefef", size: 8 }, - yaxis : { tickFormatter: function(val, axis) { + yaxis : { + tickFormatter: function(val, axis) { return humanize(val, info.convert_from_bytes, info.y_sufix); }, min: 0, color: "#efefef", + size: 8 }, series: { @@ -1934,7 +1936,9 @@ function plot_totals(response, info) { var data = response[id][attribute]; - derivative(data); + if (data) { + derivative(data); + } } }