Skip to content

Commit b8a3524

Browse files
author
Jessica Wang
committed
cloudstack UI - advanced search - implement advanced search on project page.
1 parent d9f52a6 commit b8a3524

1 file changed

Lines changed: 37 additions & 18 deletions

File tree

ui/scripts/projects.js

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -622,29 +622,48 @@
622622
}
623623
},
624624

625+
advSearchFields: {
626+
name: { label: 'Name' },
627+
zoneid: {
628+
label: 'Zone',
629+
select: function(args) {
630+
$.ajax({
631+
url: createURL('listZones'),
632+
data: {
633+
listAll: true
634+
},
635+
success: function(json) {
636+
var zones = json.listzonesresponse.zone;
637+
638+
args.response.success({
639+
data: $.map(zones, function(zone) {
640+
return {
641+
id: zone.id,
642+
description: zone.name
643+
};
644+
})
645+
});
646+
}
647+
});
648+
}
649+
},
650+
tagKey: { label: 'Tag Key' },
651+
tagValue: { label: 'Tag Value' }
652+
},
653+
625654
dataProvider: function(args) {
626-
var array1 = [];
627-
if(args.filterBy != null) {
628-
if(args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) {
629-
switch(args.filterBy.search.by) {
630-
case "name":
631-
if(args.filterBy.search.value.length > 0)
632-
array1.push("&keyword=" + args.filterBy.search.value);
633-
break;
634-
}
635-
}
636-
}
637-
638-
var apiCmd = "listProjects&page=" + args.page + "&pagesize=" + pageSize + array1.join("") + '&listAll=true';
639-
655+
var data = {};
656+
listViewDataProvider(args, data);
657+
640658
if (isDomainAdmin()) {
641-
apiCmd += '&domainid=' + args.context.users[0].domainid;
659+
$.extend(data, {
660+
domainid: args.context.users[0].domainid
661+
});
642662
}
643663

644664
$.ajax({
645-
url: createURL(apiCmd, { ignoreProject: true }),
646-
dataType: 'json',
647-
async: true,
665+
url: createURL('listProjects', { ignoreProject: true }),
666+
data: data,
648667
success: function(data) {
649668
args.response.success({
650669
data: data.listprojectsresponse.project,

0 commit comments

Comments
 (0)