Skip to content

Commit 3605ee5

Browse files
author
Jessica Wang
committed
cloudstack UI - advanced search - implement advanced search on ISO page.
1 parent 5dc1d46 commit 3605ee5

1 file changed

Lines changed: 49 additions & 19 deletions

File tree

‎ui/scripts/templates.js‎

Lines changed: 49 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -907,43 +907,73 @@
907907
}
908908
},
909909

910+
advSearchFields: {
911+
name: { label: 'Name' },
912+
zoneid: {
913+
label: 'Zone',
914+
select: function(args) {
915+
$.ajax({
916+
url: createURL('listZones'),
917+
data: {
918+
listAll: true
919+
},
920+
success: function(json) {
921+
var zones = json.listzonesresponse.zone;
922+
923+
args.response.success({
924+
data: $.map(zones, function(zone) {
925+
return {
926+
id: zone.id,
927+
description: zone.name
928+
};
929+
})
930+
});
931+
}
932+
});
933+
}
934+
},
935+
tagKey: { label: 'Tag Key' },
936+
tagValue: { label: 'Tag Value' }
937+
},
938+
910939
dataProvider: function(args) {
911-
var array1 = [];
940+
var data = {};
941+
listViewDataProvider(args, data);
942+
912943
var ignoreProject = false;
913-
if(args.filterBy != null) {
944+
if(args.filterBy != null) { //filter dropdown
914945
if(args.filterBy.kind != null) {
915946
switch(args.filterBy.kind) {
916947
case "all":
917948
ignoreProject = true;
918-
array1.push("&isofilter=all");
949+
$.extend(data, {
950+
isofilter: 'all'
951+
});
919952
break;
920953
case "mine":
921-
array1.push("&isofilter=self");
954+
$.extend(data, {
955+
isofilter: 'self'
956+
});
922957
break;
923958
case "featured":
924959
ignoreProject = true;
925-
array1.push("&isofilter=featured");
960+
$.extend(data, {
961+
isofilter: 'featured'
962+
});
926963
break;
927964
case "community":
928965
ignoreProject = true;
929-
array1.push("&isofilter=community");
930-
break;
931-
}
932-
}
933-
if(args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) {
934-
switch(args.filterBy.search.by) {
935-
case "name":
936-
if(args.filterBy.search.value.length > 0)
937-
array1.push("&keyword=" + args.filterBy.search.value);
966+
$.extend(data, {
967+
isofilter: 'community'
968+
});
938969
break;
939970
}
940-
}
941-
}
971+
}
972+
}
942973

943974
$.ajax({
944-
url: createURL("listIsos&page=" + args.page + "&pagesize=" + pageSize + array1.join(""), { ignoreProject: ignoreProject }),
945-
dataType: "json",
946-
async: true,
975+
url: createURL('listIsos', { ignoreProject: ignoreProject }),
976+
data: data,
947977
success: function(json) {
948978
var items = json.listisosresponse.iso;
949979
args.response.success({

0 commit comments

Comments
 (0)