Zone chart: Update secondary storage link to show both sub-sections

-Show both 'secondary storage' and 'image stores' via dropdown on link
 to list view
This commit is contained in:
Brian Federle 2013-06-20 14:40:00 -07:00
parent ae6e8b448f
commit 5b5d3d0be2
2 changed files with 90 additions and 38 deletions

View File

@ -6845,49 +6845,99 @@
secondaryStorage: function() {
var listView = $.extend(
true, {},
cloudStack.sections.system.subsections['secondary-storage'].sections.secondaryStorage, {
listView: {
dataProvider: function (args) {
var searchByArgs = args.filterBy.search.value.length ?
'&name=' + args.filterBy.search.value : '';
cloudStack.sections.system.subsections['secondary-storage'], {
sections: {
secondaryStorage: {
listView: {
dataProvider: function (args) {
var searchByArgs = args.filterBy.search.value.length ?
'&name=' + args.filterBy.search.value : '';
var data = {
type: 'SecondaryStorage',
page: args.page,
pageSize: pageSize,
listAll: true
};
var data = {
type: 'SecondaryStorage',
page: args.page,
pageSize: pageSize,
listAll: true
};
$.ajax({
url: createURL('listImageStores' + searchByArgs),
data: data,
success: function (json) {
args.response.success({ data: json.listimagestoreresponse.imagestore });
$.ajax({
url: createURL('listImageStores' + searchByArgs),
data: data,
success: function (json) {
args.response.success({ data: json.listimagestoreresponse.imagestore });
},
error: function (json) {
args.response.error(parseXMLHttpResponse(json));
}
});
},
error: function (json) {
args.response.error(parseXMLHttpResponse(json));
}
});
},
detailView: {
updateContext: function (args) {
var zone;
detailView: {
updateContext: function (args) {
var zone;
$.ajax({
url: createURL('listZones'),
data: { id: args.context.secondarystorages[0].zoneid },
async: false,
success: function (json) {
zone = json.listzonesresponse.zone[0];
$.ajax({
url: createURL('listZones'),
data: { id: args.context.secondarystorages[0].zoneid },
async: false,
success: function (json) {
zone = json.listzonesresponse.zone[0];
}
});
selectedZoneObj = zone;
return {
zones: [zone]
};
}
});
}
}
},
imageStores: {
listView: {
dataProvider: function (args) {
var searchByArgs = args.filterBy.search.value.length ?
'&name=' + args.filterBy.search.value : '';
selectedZoneObj = zone;
var data = {
type: 'SecondaryStorage',
page: args.page,
pageSize: pageSize,
listAll: true
};
return {
zones: [zone]
};
}
$.ajax({
url: createURL('listImageStores' + searchByArgs),
data: data,
success: function (json) {
args.response.success({ data: json.listimagestoreresponse.imagestore });
},
error: function (json) {
args.response.error(parseXMLHttpResponse(json));
}
});
},
detailView: {
updateContext: function (args) {
var zone;
$.ajax({
url: createURL('listZones'),
data: { id: args.context.secondarystorages[0].zoneid },
async: false,
success: function (json) {
zone = json.listzonesresponse.zone[0];
}
});
selectedZoneObj = zone;
return {
zones: [zone]
};
}
}
}
}
}
}

View File

@ -20,7 +20,9 @@
var target = args.sections.physicalResources.listView[targetID];
var listViewArgs = $.isFunction(target) ? target() : target;
return $('<div>').listView(listViewArgs.listView ? listViewArgs : { listView: listViewArgs });
return $('<div>').listView(
(listViewArgs.listView || listViewArgs.sections) ? listViewArgs : { listView: listViewArgs }
);
};
var $dashboard = $('#template').find('.system-dashboard-view').clone();
var getData = function() {
@ -131,4 +133,4 @@
return resourceChart(args);
};
};
}(cloudStack, jQuery));
}(cloudStack, jQuery));