cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhais...@apache.org
Subject [2/5] git commit: updated refs/heads/4.9 to 305400b
Date Tue, 01 Nov 2016 08:36:00 GMT
CLOUDSTACK-9550: Use context to filter items in a metrics view

Use available context to filter a metrics view based on zone, cluster, host
in the context object. This fixes metrics view filtering when metrics view is
viewed via Zone->Compute and Storage-> for a resource.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/2767e1ad
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/2767e1ad
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/2767e1ad

Branch: refs/heads/4.9
Commit: 2767e1ade6cd9918ea952be4898d02ae30479feb
Parents: 9eb8b2e
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
Authored: Wed Oct 19 11:41:08 2016 +0530
Committer: Rohit Yadav <rohit.yadav@shapeblue.com>
Committed: Wed Oct 19 12:23:11 2016 +0530

----------------------------------------------------------------------
 ui/scripts/metrics.js | 60 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/2767e1ad/ui/scripts/metrics.js
----------------------------------------------------------------------
diff --git a/ui/scripts/metrics.js b/ui/scripts/metrics.js
index 6ac376e..e9a947d 100644
--- a/ui/scripts/metrics.js
+++ b/ui/scripts/metrics.js
@@ -358,9 +358,19 @@
             dataProvider: function(args) {
                 var data = {};
                 listViewDataProvider(args, data);
+
+                if ("zones" in args.context && args.context.zones[0]) {
+                    data['zoneid'] = args.context.zones[0].id;
+                }
+
+                if ("pods" in args.context && args.context.pods[0]) {
+                    data['podid'] = args.context.pods[0].id;
+                }
+
                 if (args.context.metricsFilterData && args.context.metricsFilterData.key
&& args.context.metricsFilterData.value) {
                     data[args.context.metricsFilterData.key] = args.context.metricsFilterData.value;
                 }
+
                 $.ajax({
                     url: createURL('listClusters'),
                     data: data,
@@ -623,9 +633,29 @@
                 var data = {};
                 data.type = 'routing';
                 listViewDataProvider(args, data);
+
+                if (!args.context.instances) {
+                    if ("zones" in args.context && args.context.zones[0]) {
+                        data['zoneid'] = args.context.zones[0].id;
+                    }
+
+                    if ("pods" in args.context && args.context.pods[0]) {
+                        data['podid'] = args.context.pods[0].id;
+                    }
+
+                    if ("clusters" in args.context && args.context.clusters[0]) {
+                        data['clusterid'] = args.context.clusters[0].id;
+                    }
+                } else {
+                    if (args.context.instances[0]) {
+                        data['id'] = args.context.instances[0].hostid;
+                    }
+                }
+
                 if (args.context.metricsFilterData && args.context.metricsFilterData.key
&& args.context.metricsFilterData.value) {
                     data[args.context.metricsFilterData.key] = args.context.metricsFilterData.value;
                 }
+
                 $.ajax({
                     url: createURL('listHosts'),
                     data: data,
@@ -843,9 +873,15 @@
             dataProvider: function(args) {
                 var data = {};
                 listViewDataProvider(args, data);
+
+                if ("hosts" in args.context && args.context.hosts[0]) {
+                    data['hostid'] = args.context.hosts[0].id;
+                }
+
                 if (args.context.metricsFilterData && args.context.metricsFilterData.key
&& args.context.metricsFilterData.value) {
                     data[args.context.metricsFilterData.key] = args.context.metricsFilterData.value;
                 }
+
                 $.ajax({
                     url: createURL('listVirtualMachines'),
                     data: data,
@@ -942,9 +978,19 @@
             dataProvider: function(args) {
                 var data = {listAll: true};
                 listViewDataProvider(args, data);
+
+                if ("instances" in args.context && args.context.instances[0]) {
+                    data['virtualmachineid'] = args.context.instances[0].id;
+                }
+
+                if ("primarystorages" in args.context && args.context.primarystorages[0])
{
+                    data['storageid'] = args.context.primarystorages[0].id;
+                }
+
                 if (args.context.metricsFilterData && args.context.metricsFilterData.key
&& args.context.metricsFilterData.value) {
                     data[args.context.metricsFilterData.key] = args.context.metricsFilterData.value;
                 }
+
                 $.ajax({
                     url: createURL('listVolumes'),
                     data: data,
@@ -1044,9 +1090,23 @@
             dataProvider: function(args) {
                 var data = {};
                 listViewDataProvider(args, data);
+
+                if ("zones" in args.context && args.context.zones[0]) {
+                    data['zoneid'] = args.context.zones[0].id;
+                }
+
+                if ("pods" in args.context && args.context.pods[0]) {
+                    data['podid'] = args.context.pods[0].id;
+                }
+
+                if ("clusters" in args.context && args.context.clusters[0]) {
+                    data['clusterid'] = args.context.clusters[0].id;
+                }
+
                 if (args.context.metricsFilterData && args.context.metricsFilterData.key
&& args.context.metricsFilterData.value) {
                     data[args.context.metricsFilterData.key] = args.context.metricsFilterData.value;
                 }
+
                 $.ajax({
                     url: createURL('listStoragePools'),
                     data: data,


Mime
View raw message