Skip to content

Commit 58e937a

Browse files
committed
Show zone details on dashboard capacity items
1 parent ec9d350 commit 58e937a

4 files changed

Lines changed: 73 additions & 3 deletions

File tree

ui/css/cloudstack3.css

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3199,12 +3199,17 @@ Dialogs*/
31993199
height: 73px;
32003200
float: left;
32013201
position: relative;
3202+
cursor: pointer;
3203+
}
3204+
3205+
.dashboard.admin .zone-stats ul li:hover {
3206+
background: #FFF2DA;
32023207
}
32033208

32043209
.dashboard.admin .zone-stats ul li .label {
3205-
width: 103px;
3210+
width: 138px;
32063211
float: left;
3207-
padding: 32px 26px 0 13px;
3212+
padding: 22px 0px 0 10px;
32083213
}
32093214

32103215
.dashboard.admin .zone-stats ul li .info {

ui/scripts/dashboard.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,48 @@
5656

5757
// Admin dashboard
5858
admin: {
59+
zoneDetailView: {
60+
isMaximized: true,
61+
tabs: {
62+
details: {
63+
title: 'Details',
64+
fields: [
65+
{
66+
name: { label: 'Zone', isEditable: true }
67+
},
68+
{
69+
id: { label: 'ID' },
70+
allocationstate: { label: 'Allocation State' },
71+
dns1: { label: 'DNS 1', isEditable: true },
72+
dns2: { label: 'DNS 2', isEditable: true },
73+
internaldns1: { label: 'Internal DNS 1', isEditable: true },
74+
internaldns2: { label: 'Internal DNS 2', isEditable: true },
75+
networktype: { label: 'Network Type' },
76+
securitygroupsenabled: {
77+
label: 'Security Groups Enabled',
78+
converter:cloudStack.converters.toBooleanText
79+
},
80+
domain: {
81+
label: 'Network domain',
82+
isEditable: true
83+
}
84+
}
85+
],
86+
dataProvider: function(args) {
87+
$.ajax({
88+
url: createURL('listZones'),
89+
data: {
90+
id: args.context.physicalResources[0].id
91+
},
92+
success: function(json) {
93+
args.response.success({ data: json.listzonesresponse.zone[0] });
94+
}
95+
});
96+
}
97+
}
98+
}
99+
},
100+
59101
dataProvider: function(args) {
60102
var dataFns = {
61103
zones: function(data) {
@@ -232,6 +274,7 @@
232274
complete($.extend(data, {
233275
zoneCapacities: $.map(zoneCapacities.sort(sortFn), function(capacity) {
234276
return {
277+
zoneID: capacity.zoneid,
235278
zoneName: capacity.zoneName,
236279
type: cloudStack.converters.toAlertType(capacity.type),
237280
percent: parseInt(capacity.percentused),

ui/scripts/ui-custom/dashboard.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
cloudStack.sections.dashboard[dashboardType].dataProvider({
1010
response: {
1111
success: function(args) {
12+
var $browser = $dashboard.closest('#browser .container');
1213
var data = args.data;
1314

1415
// Iterate over data; populate corresponding DOM elements
@@ -23,6 +24,26 @@
2324
var item = this;
2425
var $li = $liTmpl.clone().appendTo($elem).hide();
2526

27+
if ($li.is('.zone-stats li')) {
28+
$li.click(function() {
29+
$browser.cloudBrowser('addPanel', {
30+
title: 'Zone details',
31+
parent: $dashboard.closest('.panel'),
32+
complete: function($newPanel) {
33+
$newPanel.detailView($.extend(true, {},
34+
cloudStack.sections.dashboard.admin.zoneDetailView,
35+
{
36+
$browser: $browser,
37+
context: $.extend(true, {}, cloudStack.context, {
38+
physicalResources: [{ id: item.zoneID }]
39+
})
40+
}
41+
));
42+
}
43+
})
44+
});
45+
}
46+
2647
$.each(item, function(arrayKey, arrayValue) {
2748
var $arrayElem = $li.find('[data-list-item=' + arrayKey + ']');
2849

ui/scripts/ui/widgets/detailView.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,8 @@
442442
viewAllID.custom({
443443
$browser: $browser,
444444
context: $detailView.data('view-args').context,
445-
listViewArgs: $detailView.data('list-view').data('view-args')
445+
listViewArgs: $detailView.data('list-view') ?
446+
$detailView.data('list-view').data('view-args') : null
446447
})
447448
);
448449
}

0 commit comments

Comments
 (0)