You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by je...@apache.org on 2012/10/04 00:40:42 UTC
git commit: cloudstack UI - advanced search - implement advanced
search on template page.
Updated Branches:
refs/heads/master 2a0f2e01f -> 5dc1d468f
cloudstack UI - advanced search - implement advanced search on template page.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/5dc1d468
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/5dc1d468
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/5dc1d468
Branch: refs/heads/master
Commit: 5dc1d468fe8ee045ec8a5033b4a33b2ccd4c866b
Parents: 2a0f2e0
Author: Jessica Wang <je...@citrix.com>
Authored: Wed Oct 3 15:39:09 2012 -0700
Committer: Jessica Wang <je...@citrix.com>
Committed: Wed Oct 3 15:40:26 2012 -0700
----------------------------------------------------------------------
ui/scripts/templates.js | 71 ++++++++++++++++++++++++++++++------------
1 files changed, 51 insertions(+), 20 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5dc1d468/ui/scripts/templates.js
----------------------------------------------------------------------
diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js
index 7a99d79..efb1b6d 100644
--- a/ui/scripts/templates.js
+++ b/ui/scripts/templates.js
@@ -48,6 +48,36 @@
zonename: { label: 'label.zone' },
hypervisor: { label: 'label.hypervisor' }
},
+
+ advSearchFields: {
+ name: { label: 'Name' },
+ 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' }
+ },
+
reorder: cloudStack.api.actions.sort('updateTemplate', 'templates'),
actions: {
add: {
@@ -301,43 +331,44 @@
}
},
- dataProvider: function(args) {
- var array1 = [];
+ dataProvider: function(args) {
+ var data = {};
+ listViewDataProvider(args, data);
+
var ignoreProject = false;
- if(args.filterBy != null) {
+ if(args.filterBy != null) { //filter dropdown
if(args.filterBy.kind != null) {
switch(args.filterBy.kind) {
case "all":
ignoreProject = true;
- array1.push("&templatefilter=all");
+ $.extend(data, {
+ templatefilter: 'all'
+ });
break;
case "mine":
- array1.push("&templatefilter=self");
+ $.extend(data, {
+ templatefilter: 'self'
+ });
break;
case "featured":
ignoreProject = true;
- array1.push("&templatefilter=featured");
+ $.extend(data, {
+ templatefilter: 'featured'
+ });
break;
case "community":
ignoreProject = true;
- array1.push("&templatefilter=community");
- break;
- }
- }
- 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);
+ $.extend(data, {
+ templatefilter: 'community'
+ });
break;
}
- }
+ }
}
+
$.ajax({
- url: createURL("listTemplates&page=" + args.page + "&pagesize=" + pageSize + array1.join(""),
- { ignoreProject: ignoreProject }),
- dataType: "json",
- async: true,
+ url: createURL('listTemplates', { ignoreProject: ignoreProject }),
+ data: data,
success: function(json) {
var items = json.listtemplatesresponse.template;
args.response.success({