Created
March 5, 2016 11:07
-
-
Save rohityadavcloud/7fccbc338ba3076aafb0 to your computer and use it in GitHub Desktop.
Nux - vms on dashboard
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/ui/css/cloudstack3.css b/ui/css/cloudstack3.css | |
index 22f7409..e91b349 100644 | |
--- a/ui/css/cloudstack3.css | |
+++ b/ui/css/cloudstack3.css | |
@@ -4479,6 +4479,7 @@ textarea { | |
height: 316px; | |
overflow: auto; | |
overflow-x: hidden; | |
+ overflow-y: auto; | |
/*+placement:shift 0px 0px;*/ | |
position: relative; | |
left: 0px; | |
diff --git a/ui/scripts/dashboard.js b/ui/scripts/dashboard.js | |
index f2b5682..3013b96 100644 | |
--- a/ui/scripts/dashboard.js | |
+++ b/ui/scripts/dashboard.js | |
@@ -253,7 +253,7 @@ | |
var capacities = json.listcapacityresponse.capacity ? | |
json.listcapacityresponse.capacity : []; | |
- complete($.extend(data, { | |
+ data = $.extend(data, { | |
zoneCapacities: $.map(capacities, function(capacity) { | |
if (capacity.podname) { | |
capacity.zonename = capacity.zonename.concat(', ' + _l('label.pod') + ': ' + capacity.podname); | |
@@ -274,7 +274,52 @@ | |
total: cloudStack.converters.convertByType(capacity.type, capacity.capacitytotal) | |
}; | |
}) | |
- })); | |
+ }); | |
+ | |
+ // Calculate VMs | |
+ var totalInstanceCount = 0; | |
+ $.ajax({ | |
+ url: createURL("listVirtualMachines"), | |
+ data: { | |
+ listAll: true, | |
+ page: 1, | |
+ pageSize: 1 | |
+ }, | |
+ async: false, | |
+ success: function(json) { | |
+ if (json.listvirtualmachinesresponse.count != undefined) { | |
+ totalInstanceCount = json.listvirtualmachinesresponse.count; | |
+ } | |
+ } | |
+ }); | |
+ | |
+ var runningInstanceCount = 0; | |
+ $.ajax({ | |
+ url: createURL("listVirtualMachines"), | |
+ data: { | |
+ listAll: true, | |
+ page: 1, | |
+ pageSize: 1, | |
+ state: "Running" | |
+ }, | |
+ async: false, | |
+ success: function(json) { | |
+ if (json.listvirtualmachinesresponse.count != undefined) { | |
+ runningInstanceCount = json.listvirtualmachinesresponse.count; | |
+ } | |
+ } | |
+ }); | |
+ | |
+ var vms = { | |
+ total: totalInstanceCount, | |
+ used: runningInstanceCount, | |
+ percent: runningInstanceCount * 100 / totalInstanceCount, | |
+ type: "Running VMs", | |
+ zoneID: "1234", | |
+ zoneName: "All zones" | |
+ }; | |
+ data.zoneCapacities.push(vms); | |
+ complete(data); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment