From 4643e5609d59c1191ddc70c13fb7e94b0465b3d8 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Fri, 18 Sep 2015 12:39:14 +0530 Subject: [PATCH] metrics: implement a general refresh metrics framework Signed-off-by: Rohit Yadav --- ui/css/cloudstack3.css | 8 ++++++++ ui/scripts/metrics.js | 18 +++++------------- ui/scripts/ui-custom/metricsView.js | 16 ++++++++++++++++ 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/ui/css/cloudstack3.css b/ui/css/cloudstack3.css index daa6398af4c..7913a69b405 100644 --- a/ui/css/cloudstack3.css +++ b/ui/css/cloudstack3.css @@ -12428,6 +12428,14 @@ div.ui-dialog div.autoscaler div.field-group div.form-container form div.form-it background-position: -40px -32px; } +.refreshMetrics .icon { + background-position: 0px -62px; +} + +.refreshMetrics:hover .icon { + background-position: 0px -62px; +} + .attach .icon, .attachISO .icon, .attachDisk .icon, diff --git a/ui/scripts/metrics.js b/ui/scripts/metrics.js index 748d93e5a97..90dc0cb7450 100644 --- a/ui/scripts/metrics.js +++ b/ui/scripts/metrics.js @@ -24,6 +24,9 @@ label: 'metrics' } }, + refreshMetrics: function() { + console.log("Refreshing metrics"); + }, hideSearchBar: true } }; @@ -68,19 +71,8 @@ dataProvider: function(args) { console.log(args); }, - actions: { - refreshMetric: { - label: 'label.refresh', - isHeader: true, - addRow: true, - action: { - custom: function (args) { - return function() { - return console.log("Cluster Refresh metrics"); - }; - } - } - } + refreshMetrics: function() { + console.log("Refreshing Cluster metrics"); }, hideSearchBar: true, needsRefresh: true diff --git a/ui/scripts/ui-custom/metricsView.js b/ui/scripts/ui-custom/metricsView.js index fb5a0157492..06d880d6fbf 100644 --- a/ui/scripts/ui-custom/metricsView.js +++ b/ui/scripts/ui-custom/metricsView.js @@ -29,6 +29,20 @@ } else if (args.resource == 'volumes') { } + metricsListView.actions = { + refreshMetrics: { + label: 'label.refresh', + isHeader: true, + addRow: true, + action: { + custom: function (args) { + return function() { + }; + } + } + } + }; + var $browser = $('#browser .container'); return $browser.cloudBrowser('addPanel', { title: 'Metrics', @@ -41,6 +55,8 @@ }); // Make metrics tables horizontally scrollable $('.panel::has(.data-table)::not(.reduced)').css({overflow: 'auto'}); + // Refresh metrics when refresh button is clicked + $('.refreshMetrics').click(metricsListView.refreshMetrics); } }); };