cloudstack UI - advanced search - implement advanced search on network page.

This commit is contained in:
Jessica Wang 2012-10-03 14:42:49 -07:00
parent ab280d9136
commit ea91662485
2 changed files with 38 additions and 18 deletions

View File

@ -191,7 +191,8 @@
url: createURL('listNetworks', { ignoreProject: true }),
data: {
supportedServices: 'SecurityGroup',
listAll: true
listAll: true,
details: 'min'
},
async: false,
success: function(data) {
@ -436,24 +437,42 @@
}
*/
},
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;
}
}
}
advSearchFields: {
zoneid: {
label: 'Zone',
select: function(args) {
$.ajax({
url: createURL('listZones'),
data: {
listAll: true
},
success: function(json) {
var zones = json.listzonesresponse.zone;
args.response.success({
data: $.map(zones, function(zone) {
return {
id: zone.id,
description: zone.name
};
})
});
}
});
}
},
tagKey: { label: 'Tag Key' },
tagValue: { label: 'Tag Value' }
},
dataProvider: function(args) {
var data = {};
listViewDataProvider(args, data);
$.ajax({
url: createURL("listNetworks&page=" + args.page + "&pagesize=" + pageSize + array1.join("")),
data: {
listAll: true
},
dataType: 'json',
url: createURL('listNetworks'),
data: data,
async: false,
success: function(data) {
args.response.success({

View File

@ -445,6 +445,7 @@ function listViewDataProvider(args, data) {
//pagination
$.extend(data, {
listAll: true,
details: 'min',
page: args.page,
pagesize: pageSize
});