Skip to content

Commit 18a09c9

Browse files
author
Jessica Wang
committed
cloudstack UI - advanced search - implement advanced search on snapshot page.
1 parent 92864aa commit 18a09c9

1 file changed

Lines changed: 16 additions & 19 deletions

File tree

‎ui/scripts/storage.js‎

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -976,7 +976,7 @@
976976
pollAgainIfValueIsIn: {
977977
'UploadNotStarted': 1
978978
},
979-
pollAgainFn: function(context) { //???
979+
pollAgainFn: function(context) {
980980
var toClearInterval = false;
981981
$.ajax({
982982
url: createURL("listVolumes&id=" + context.volumes[0].id),
@@ -1072,30 +1072,27 @@
10721072
}
10731073
},
10741074

1075-
dataProvider: function(args) {
1076-
var array1 = [];
1077-
if(args.filterBy != null) {
1078-
if(args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) {
1079-
switch(args.filterBy.search.by) {
1080-
case "name":
1081-
if(args.filterBy.search.value.length > 0)
1082-
array1.push("&keyword=" + args.filterBy.search.value);
1083-
break;
1084-
}
1085-
}
1086-
}
1087-
1088-
var apiCmd = "listSnapshots&listAll=true&page=" + args.page + "&pagesize=" + pageSize + array1.join("");
1075+
advSearchFields: {
1076+
name: { label: 'Name' },
1077+
tagKey: { label: 'Tag Key' },
1078+
tagValue: { label: 'Tag Value' }
1079+
},
1080+
1081+
dataProvider: function(args) {
1082+
var data = {};
1083+
listViewDataProvider(args, data);
1084+
10891085
if(args.context != null) {
10901086
if("volumes" in args.context) {
1091-
apiCmd += "&volumeid=" + args.context.volumes[0].id;
1087+
$.extend(data, {
1088+
volumeid: args.context.volumes[0].id
1089+
});
10921090
}
10931091
}
10941092

10951093
$.ajax({
1096-
url: createURL(apiCmd),
1097-
dataType: "json",
1098-
async: true,
1094+
url: createURL('listSnapshots'),
1095+
data: data,
10991096
success: function(json) {
11001097
var items = json.listsnapshotsresponse.snapshot;
11011098
args.response.success({

0 commit comments

Comments
 (0)