diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js index 82f809910da..3383b511231 100644 --- a/ui/scripts/instances.js +++ b/ui/scripts/instances.js @@ -10,6 +10,7 @@ listView: { section: 'instances', filters: { + all: { label: 'All' }, mine: { label: 'Mine' }, running: { label: 'Running' }, stopped: { label: 'Stopped' }, @@ -720,10 +721,12 @@ }, dataProvider: function(args) { - var array1 = []; + var array1 = []; if(args.filterBy != null) { if(args.filterBy.kind != null) { switch(args.filterBy.kind) { + case "all": + break; case "mine": array1.push("&domainid=" + g_domainid + "&account=" + g_account); break; diff --git a/ui/scripts/templates.js b/ui/scripts/templates.js index 49e162371a7..6b744593d71 100644 --- a/ui/scripts/templates.js +++ b/ui/scripts/templates.js @@ -12,7 +12,12 @@ title: 'Templates', listView: { id: 'templates', - label: 'Templates', + label: 'Templates', + filters: { + mine: { label: 'Mine' }, + featured: { label: 'Featured' }, + community: { label: 'Community' } + }, fields: { name: { label: 'Name' }, id: { label: 'ID' }, @@ -382,9 +387,32 @@ }, - dataProvider: function(args) { + dataProvider: function(args) { + var array1 = []; + if(args.filterBy != null) { + if(args.filterBy.kind != null) { + switch(args.filterBy.kind) { + case "mine": + array1.push("&templatefilter=self"); + break; + case "featured": + array1.push("&templatefilter=featured"); + break; + case "community": + 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": + array1.push("&keyword=" + args.filterBy.search.value); + break; + } + } + } $.ajax({ - url: createURL("listTemplates&templatefilter=self&page="+args.page+"&pagesize="+pageSize), + url: createURL("listTemplates&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), dataType: "json", async: true, success: function(json) { diff --git a/ui/scripts/ui/widgets/listView.js b/ui/scripts/ui/widgets/listView.js index 239f7dbbab8..31d8f24daac 100644 --- a/ui/scripts/ui/widgets/listView.js +++ b/ui/scripts/ui/widgets/listView.js @@ -441,9 +441,8 @@ var $filters = $('
').addClass('filters reduced-hide'); $filters.append(''); - var $filterSelect = $('').appendTo($filters); - $filterSelect.append(''); // Always appears by default - + var $filterSelect = $('').appendTo($filters); + if (filters) $.each(filters, function(key) { var $option = $('