cloudstack UI - advanced search - implement advanced search on snapshot page.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/18a09c96 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/18a09c96 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/18a09c96 Branch: refs/heads/regions Commit: 18a09c966493be45c7bd40cb81bed2822325da2c Parents: 92864aa Author: Jessica Wang <[email protected]> Authored: Tue Oct 2 17:02:11 2012 -0700 Committer: Jessica Wang <[email protected]> Committed: Tue Oct 2 17:03:23 2012 -0700 ---------------------------------------------------------------------- ui/scripts/storage.js | 35 ++++++++++++++++------------------- 1 files changed, 16 insertions(+), 19 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/18a09c96/ui/scripts/storage.js ---------------------------------------------------------------------- diff --git a/ui/scripts/storage.js b/ui/scripts/storage.js index 9b207c5..2e7aac1 100644 --- a/ui/scripts/storage.js +++ b/ui/scripts/storage.js @@ -976,7 +976,7 @@ pollAgainIfValueIsIn: { 'UploadNotStarted': 1 }, - pollAgainFn: function(context) { //??? + pollAgainFn: function(context) { var toClearInterval = false; $.ajax({ url: createURL("listVolumes&id=" + context.volumes[0].id), @@ -1072,30 +1072,27 @@ } }, - dataProvider: function(args) { - var array1 = []; - if(args.filterBy != null) { - if(args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { - switch(args.filterBy.search.by) { - case "name": - if(args.filterBy.search.value.length > 0) - array1.push("&keyword=" + args.filterBy.search.value); - break; - } - } - } - - var apiCmd = "listSnapshots&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join(""); + advSearchFields: { + name: { label: 'Name' }, + tagKey: { label: 'Tag Key' }, + tagValue: { label: 'Tag Value' } + }, + + dataProvider: function(args) { + var data = {}; + listViewDataProvider(args, data); + if(args.context != null) { if("volumes" in args.context) { - apiCmd += "&volumeid=" + args.context.volumes[0].id; + $.extend(data, { + volumeid: args.context.volumes[0].id + }); } } $.ajax({ - url: createURL(apiCmd), - dataType: "json", - async: true, + url: createURL('listSnapshots'), + data: data, success: function(json) { var items = json.listsnapshotsresponse.snapshot; args.response.success({
