|
48 | 48 | zonename: { label: 'label.zone' }, |
49 | 49 | hypervisor: { label: 'label.hypervisor' } |
50 | 50 | }, |
| 51 | + |
| 52 | + advSearchFields: { |
| 53 | + name: { label: 'Name' }, |
| 54 | + zoneid: { |
| 55 | + label: 'Zone', |
| 56 | + select: function(args) { |
| 57 | + $.ajax({ |
| 58 | + url: createURL('listZones'), |
| 59 | + data: { |
| 60 | + listAll: true |
| 61 | + }, |
| 62 | + success: function(json) { |
| 63 | + var zones = json.listzonesresponse.zone; |
| 64 | + |
| 65 | + args.response.success({ |
| 66 | + data: $.map(zones, function(zone) { |
| 67 | + return { |
| 68 | + id: zone.id, |
| 69 | + description: zone.name |
| 70 | + }; |
| 71 | + }) |
| 72 | + }); |
| 73 | + } |
| 74 | + }); |
| 75 | + } |
| 76 | + }, |
| 77 | + tagKey: { label: 'Tag Key' }, |
| 78 | + tagValue: { label: 'Tag Value' } |
| 79 | + }, |
| 80 | + |
51 | 81 | reorder: cloudStack.api.actions.sort('updateTemplate', 'templates'), |
52 | 82 | actions: { |
53 | 83 | add: { |
|
301 | 331 | } |
302 | 332 | }, |
303 | 333 |
|
304 | | - dataProvider: function(args) { |
305 | | - var array1 = []; |
| 334 | + dataProvider: function(args) { |
| 335 | + var data = {}; |
| 336 | + listViewDataProvider(args, data); |
| 337 | + |
306 | 338 | var ignoreProject = false; |
307 | | - if(args.filterBy != null) { |
| 339 | + if(args.filterBy != null) { //filter dropdown |
308 | 340 | if(args.filterBy.kind != null) { |
309 | 341 | switch(args.filterBy.kind) { |
310 | 342 | case "all": |
311 | 343 | ignoreProject = true; |
312 | | - array1.push("&templatefilter=all"); |
| 344 | + $.extend(data, { |
| 345 | + templatefilter: 'all' |
| 346 | + }); |
313 | 347 | break; |
314 | 348 | case "mine": |
315 | | - array1.push("&templatefilter=self"); |
| 349 | + $.extend(data, { |
| 350 | + templatefilter: 'self' |
| 351 | + }); |
316 | 352 | break; |
317 | 353 | case "featured": |
318 | 354 | ignoreProject = true; |
319 | | - array1.push("&templatefilter=featured"); |
| 355 | + $.extend(data, { |
| 356 | + templatefilter: 'featured' |
| 357 | + }); |
320 | 358 | break; |
321 | 359 | case "community": |
322 | 360 | ignoreProject = true; |
323 | | - array1.push("&templatefilter=community"); |
324 | | - break; |
325 | | - } |
326 | | - } |
327 | | - if(args.filterBy.search != null && args.filterBy.search.by != null && args.filterBy.search.value != null) { |
328 | | - switch(args.filterBy.search.by) { |
329 | | - case "name": |
330 | | - if(args.filterBy.search.value.length > 0) |
331 | | - array1.push("&keyword=" + args.filterBy.search.value); |
| 361 | + $.extend(data, { |
| 362 | + templatefilter: 'community' |
| 363 | + }); |
332 | 364 | break; |
333 | 365 | } |
334 | | - } |
| 366 | + } |
335 | 367 | } |
| 368 | + |
336 | 369 | $.ajax({ |
337 | | - url: createURL("listTemplates&page=" + args.page + "&pagesize=" + pageSize + array1.join(""), |
338 | | - { ignoreProject: ignoreProject }), |
339 | | - dataType: "json", |
340 | | - async: true, |
| 370 | + url: createURL('listTemplates', { ignoreProject: ignoreProject }), |
| 371 | + data: data, |
341 | 372 | success: function(json) { |
342 | 373 | var items = json.listtemplatesresponse.template; |
343 | 374 | args.response.success({ |
|
0 commit comments