summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEndi S. Dewata <edewata@redhat.com>2014-03-17 11:43:19 -0400
committerEndi S. Dewata <edewata@redhat.com>2014-03-28 17:27:00 -0400
commit5334d5002c1fca09377090019d2d2bdc3c6bd560 (patch)
treef4ca9c19c37d119be38d91a262d3bb17eee35cc4
parent35b8e2c69b86df07c2897e34861f4c6c636010a7 (diff)
downloadpki-5334d5002c1fca09377090019d2d2bdc3c6bd560.tar.gz
pki-5334d5002c1fca09377090019d2d2bdc3c6bd560.tar.xz
pki-5334d5002c1fca09377090019d2d2bdc3c6bd560.zip
Added search filter for TPS UI.
The tables in TPS UI has been modified to handle search filters. When the user presses enter in the search field, the UI will perform a search operation using the filter specified in the field. The table will be updated with the new results. If the filter is empty it will show all entries. Ticket #847
-rw-r--r--base/server/share/webapps/pki/js/pki-ui.js39
-rw-r--r--base/tps-tomcat/shared/webapps/tps/ui/activities.html2
-rw-r--r--base/tps-tomcat/shared/webapps/tps/ui/authenticators.html2
-rw-r--r--base/tps-tomcat/shared/webapps/tps/ui/certs.html2
-rw-r--r--base/tps-tomcat/shared/webapps/tps/ui/connections.html2
-rw-r--r--base/tps-tomcat/shared/webapps/tps/ui/groups.html2
-rw-r--r--base/tps-tomcat/shared/webapps/tps/ui/profiles.html2
-rw-r--r--base/tps-tomcat/shared/webapps/tps/ui/selftests.html2
-rw-r--r--base/tps-tomcat/shared/webapps/tps/ui/tokens.html2
-rw-r--r--base/tps-tomcat/shared/webapps/tps/ui/users.html2
10 files changed, 39 insertions, 18 deletions
diff --git a/base/server/share/webapps/pki/js/pki-ui.js b/base/server/share/webapps/pki/js/pki-ui.js
index 44e0444da..00c9f05c7 100644
--- a/base/server/share/webapps/pki/js/pki-ui.js
+++ b/base/server/share/webapps/pki/js/pki-ui.js
@@ -46,16 +46,9 @@ var Collection = Backbone.Collection.extend({
initialize: function(options) {
var self = this;
- // convert options into URL query
- var query = "";
- _(options).each(function(value, name) {
- query = query == "" ? "?" : query + "&";
- query = query + name + "=" + encodeURIComponent(value);
- });
-
self.options = options;
- self.currentURL = self.urlRoot + query;
self.links = {};
+ self.filter(null);
},
url: function() {
return this.currentURL;
@@ -104,6 +97,22 @@ var Collection = Backbone.Collection.extend({
go: function(name) {
if (this.links[name] == undefined) return;
this.currentURL = this.links[name];
+ },
+ filter: function(filter) {
+ var self = this;
+
+ var query = "";
+ _(self.options).each(function(value, name) {
+ query = query == "" ? "?" : query + "&";
+ query = query + name + "=" + encodeURIComponent(value);
+ });
+
+ if (filter) {
+ query = query == "" ? "?" : query + "&";
+ query = query + "filter=" + encodeURIComponent(filter);
+ }
+
+ self.currentURL = self.urlRoot + query;
}
});
@@ -443,6 +452,15 @@ var Table = Backbone.View.extend({
self.thead = $("thead", self.$el);
+ // setup search field handler
+ $("input[name='search']", self.thead).keypress(function(e) {
+ if (e.which == 13) {
+ var input = $(e.target);
+ self.collection.filter(input.val());
+ self.render();
+ }
+ });
+
// setup add button handler
$("button[name='add']", self.thead).click(function(e) {
var dialog = self.addDialog;
@@ -508,7 +526,7 @@ var Table = Backbone.View.extend({
var self = this;
self.collection.fetch({
reset: true,
- success: function() {
+ success: function(collection, response, options) {
self.tbody.empty();
// display result page
@@ -533,6 +551,9 @@ var Table = Backbone.View.extend({
self.tbody.append(item.$el);
}
}
+ },
+ error: function(collection, response, options) {
+ alert(response.statusText);
}
});
}
diff --git a/base/tps-tomcat/shared/webapps/tps/ui/activities.html b/base/tps-tomcat/shared/webapps/tps/ui/activities.html
index c5d363e3e..04995e572 100644
--- a/base/tps-tomcat/shared/webapps/tps/ui/activities.html
+++ b/base/tps-tomcat/shared/webapps/tps/ui/activities.html
@@ -21,7 +21,7 @@
<thead>
<tr>
<th class="rcue-table-actions" colspan="8">
- <span><input type="text" placeholder="Search..."></span>
+ <span><input name="search" type="text" placeholder="Search..."></span>
<span></span>
</th>
</tr>
diff --git a/base/tps-tomcat/shared/webapps/tps/ui/authenticators.html b/base/tps-tomcat/shared/webapps/tps/ui/authenticators.html
index 021b94889..c7e0e3e96 100644
--- a/base/tps-tomcat/shared/webapps/tps/ui/authenticators.html
+++ b/base/tps-tomcat/shared/webapps/tps/ui/authenticators.html
@@ -21,7 +21,7 @@
<thead>
<tr>
<th class="rcue-table-actions" colspan="3">
- <span><input type="text" placeholder="Search..."></span>
+ <span><input name="search" type="text" placeholder="Search..."></span>
<span>
<button name="add">Add</button>
<button name="remove">Remove</button>
diff --git a/base/tps-tomcat/shared/webapps/tps/ui/certs.html b/base/tps-tomcat/shared/webapps/tps/ui/certs.html
index d09af2530..c454170d1 100644
--- a/base/tps-tomcat/shared/webapps/tps/ui/certs.html
+++ b/base/tps-tomcat/shared/webapps/tps/ui/certs.html
@@ -21,7 +21,7 @@
<thead>
<tr>
<th class="rcue-table-actions" colspan="10">
- <span><input type="text" placeholder="Search..."></span>
+ <span><input name="search" type="text" placeholder="Search..."></span>
<span></span>
</th>
</tr>
diff --git a/base/tps-tomcat/shared/webapps/tps/ui/connections.html b/base/tps-tomcat/shared/webapps/tps/ui/connections.html
index d3df0a16f..0d4384703 100644
--- a/base/tps-tomcat/shared/webapps/tps/ui/connections.html
+++ b/base/tps-tomcat/shared/webapps/tps/ui/connections.html
@@ -21,7 +21,7 @@
<thead>
<tr>
<th class="rcue-table-actions" colspan="3">
- <span><input type="text" placeholder="Search..."></span>
+ <span><input name="search" type="text" placeholder="Search..."></span>
<span>
<button name="add">Add</button>
<button name="remove">Remove</button>
diff --git a/base/tps-tomcat/shared/webapps/tps/ui/groups.html b/base/tps-tomcat/shared/webapps/tps/ui/groups.html
index 2bd9b5ba8..a835180b7 100644
--- a/base/tps-tomcat/shared/webapps/tps/ui/groups.html
+++ b/base/tps-tomcat/shared/webapps/tps/ui/groups.html
@@ -21,7 +21,7 @@
<thead>
<tr>
<th class="rcue-table-actions" colspan="3">
- <span><input type="text" placeholder="Search..."></span>
+ <span><input name="search" type="text" placeholder="Search..."></span>
<span>
<button name="add">Add</button>
<button name="remove">Remove</button>
diff --git a/base/tps-tomcat/shared/webapps/tps/ui/profiles.html b/base/tps-tomcat/shared/webapps/tps/ui/profiles.html
index faf528bab..57c86df10 100644
--- a/base/tps-tomcat/shared/webapps/tps/ui/profiles.html
+++ b/base/tps-tomcat/shared/webapps/tps/ui/profiles.html
@@ -21,7 +21,7 @@
<thead>
<tr>
<th class="rcue-table-actions" colspan="3">
- <span><input type="text" placeholder="Search..."></span>
+ <span><input name="search" type="text" placeholder="Search..."></span>
<span>
<button name="add">Add</button>
<button name="remove">Remove</button>
diff --git a/base/tps-tomcat/shared/webapps/tps/ui/selftests.html b/base/tps-tomcat/shared/webapps/tps/ui/selftests.html
index fac64d205..d184703c8 100644
--- a/base/tps-tomcat/shared/webapps/tps/ui/selftests.html
+++ b/base/tps-tomcat/shared/webapps/tps/ui/selftests.html
@@ -21,7 +21,7 @@
<thead>
<tr>
<th class="rcue-table-actions" colspan="6">
- <span><input type="text" placeholder="Search..."></span>
+ <span><input name="search" type="text" placeholder="Search..."></span>
<span></span>
</th>
</tr>
diff --git a/base/tps-tomcat/shared/webapps/tps/ui/tokens.html b/base/tps-tomcat/shared/webapps/tps/ui/tokens.html
index 1575b046c..3edcd2cd4 100644
--- a/base/tps-tomcat/shared/webapps/tps/ui/tokens.html
+++ b/base/tps-tomcat/shared/webapps/tps/ui/tokens.html
@@ -21,7 +21,7 @@
<thead>
<tr>
<th class="rcue-table-actions" colspan="9">
- <span><input type="text" placeholder="Search..."></span>
+ <span><input name="search" type="text" placeholder="Search..."></span>
<span>
<button name="add">Add</button>
<button name="remove">Remove</button>
diff --git a/base/tps-tomcat/shared/webapps/tps/ui/users.html b/base/tps-tomcat/shared/webapps/tps/ui/users.html
index 20e622cbc..4757ff5d9 100644
--- a/base/tps-tomcat/shared/webapps/tps/ui/users.html
+++ b/base/tps-tomcat/shared/webapps/tps/ui/users.html
@@ -21,7 +21,7 @@
<thead>
<tr>
<th class="rcue-table-actions" colspan="3">
- <span><input type="text" placeholder="Search..."></span>
+ <span><input name="search" type="text" placeholder="Search..."></span>
<span>
<button name="add">Add</button>
<button name="remove">Remove</button>