From 5b5d3d0be23da25d735d197558f6c7331f3b3c0c Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Thu, 20 Jun 2013 14:40:00 -0700 Subject: [PATCH] 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 --- ui/scripts/system.js | 122 +++++++++++++++------- ui/scripts/ui-custom/physicalResources.js | 6 +- 2 files changed, 90 insertions(+), 38 deletions(-) diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 227b67e40bf..f5b2bdfec94 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -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] + }; + } + } + } } } } diff --git a/ui/scripts/ui-custom/physicalResources.js b/ui/scripts/ui-custom/physicalResources.js index 65b87e4415a..529adcf5a4e 100644 --- a/ui/scripts/ui-custom/physicalResources.js +++ b/ui/scripts/ui-custom/physicalResources.js @@ -20,7 +20,9 @@ var target = args.sections.physicalResources.listView[targetID]; var listViewArgs = $.isFunction(target) ? target() : target; - return $('
').listView(listViewArgs.listView ? listViewArgs : { listView: listViewArgs }); + return $('
').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)); \ No newline at end of file +}(cloudStack, jQuery));