From 9c46cf164df3999a861346e8578c752f7f28e822 Mon Sep 17 00:00:00 2001
From: "Endi S. Dewata" <edewata@redhat.com>
Date: Tue, 26 Nov 2013 21:40:28 -0500
Subject: [PATCH] Added TPS UI skeleton.

An inititial implementation of TPS UI has been added. The UI will
display TPS resources as tables.

Ticket #654
---
 .../certsrv/tps/cert/TPSCertCollection.java        |  2 +-
 base/server/share/webapps/pki/css/pki-ui.css       | 29 +++++++++
 base/server/share/webapps/pki/js/pki-ui.js         | 56 ++++++++++++++++++
 base/tps-tomcat/shared/webapps/tps/activities.html | 65 ++++++++++++++++++++
 .../shared/webapps/tps/authenticators.html         | 55 +++++++++++++++++
 .../shared/webapps/tps/certificates.html           | 69 ++++++++++++++++++++++
 .../tps-tomcat/shared/webapps/tps/connections.html | 55 +++++++++++++++++
 .../shared/webapps/tps/{index.html => groups.html} | 42 +++++++++++--
 base/tps-tomcat/shared/webapps/tps/index.html      | 26 ++++++--
 base/tps-tomcat/shared/webapps/tps/js/activity.js  | 51 ++++++++++++++++
 .../shared/webapps/tps/js/authenticator.js         | 46 +++++++++++++++
 .../shared/webapps/tps/js/certificate.js           | 53 +++++++++++++++++
 .../tps-tomcat/shared/webapps/tps/js/connection.js | 46 +++++++++++++++
 base/tps-tomcat/shared/webapps/tps/js/group.js     | 46 +++++++++++++++
 base/tps-tomcat/shared/webapps/tps/js/profile.js   | 46 +++++++++++++++
 base/tps-tomcat/shared/webapps/tps/js/selftest.js  | 49 +++++++++++++++
 base/tps-tomcat/shared/webapps/tps/js/token.js     | 52 ++++++++++++++++
 base/tps-tomcat/shared/webapps/tps/js/user.js      | 46 +++++++++++++++
 .../webapps/tps/{index.html => profiles.html}      | 42 +++++++++++--
 base/tps-tomcat/shared/webapps/tps/selftests.html  | 61 +++++++++++++++++++
 base/tps-tomcat/shared/webapps/tps/tokens.html     | 67 +++++++++++++++++++++
 .../shared/webapps/tps/{index.html => users.html}  | 42 +++++++++++--
 22 files changed, 1025 insertions(+), 21 deletions(-)
 create mode 100644 base/server/share/webapps/pki/css/pki-ui.css
 create mode 100644 base/server/share/webapps/pki/js/pki-ui.js
 create mode 100644 base/tps-tomcat/shared/webapps/tps/activities.html
 create mode 100644 base/tps-tomcat/shared/webapps/tps/authenticators.html
 create mode 100644 base/tps-tomcat/shared/webapps/tps/certificates.html
 create mode 100644 base/tps-tomcat/shared/webapps/tps/connections.html
 copy base/tps-tomcat/shared/webapps/tps/{index.html => groups.html} (50%)
 create mode 100644 base/tps-tomcat/shared/webapps/tps/js/activity.js
 create mode 100644 base/tps-tomcat/shared/webapps/tps/js/authenticator.js
 create mode 100644 base/tps-tomcat/shared/webapps/tps/js/certificate.js
 create mode 100644 base/tps-tomcat/shared/webapps/tps/js/connection.js
 create mode 100644 base/tps-tomcat/shared/webapps/tps/js/group.js
 create mode 100644 base/tps-tomcat/shared/webapps/tps/js/profile.js
 create mode 100644 base/tps-tomcat/shared/webapps/tps/js/selftest.js
 create mode 100644 base/tps-tomcat/shared/webapps/tps/js/token.js
 create mode 100644 base/tps-tomcat/shared/webapps/tps/js/user.js
 copy base/tps-tomcat/shared/webapps/tps/{index.html => profiles.html} (50%)
 create mode 100644 base/tps-tomcat/shared/webapps/tps/selftests.html
 create mode 100644 base/tps-tomcat/shared/webapps/tps/tokens.html
 copy base/tps-tomcat/shared/webapps/tps/{index.html => users.html} (50%)

diff --git a/base/common/src/com/netscape/certsrv/tps/cert/TPSCertCollection.java b/base/common/src/com/netscape/certsrv/tps/cert/TPSCertCollection.java
index 0f927fce548bdbe0a5e05a233e5e21ef21c35243..73b7c890f300e6bb1e290823efd78c9241d45e32 100644
--- a/base/common/src/com/netscape/certsrv/tps/cert/TPSCertCollection.java
+++ b/base/common/src/com/netscape/certsrv/tps/cert/TPSCertCollection.java
@@ -28,7 +28,7 @@ import com.netscape.certsrv.base.DataCollection;
 /**
  * @author Endi S. Dewata
  */
-@XmlRootElement(name="Activities")
+@XmlRootElement(name="Certificates")
 public class TPSCertCollection extends DataCollection<TPSCertData> {
 
     @XmlElementRef
diff --git a/base/server/share/webapps/pki/css/pki-ui.css b/base/server/share/webapps/pki/css/pki-ui.css
new file mode 100644
index 0000000000000000000000000000000000000000..63df0ffd25695916d639d096bd542e046b41821e
--- /dev/null
+++ b/base/server/share/webapps/pki/css/pki-ui.css
@@ -0,0 +1,29 @@
+/* --- BEGIN COPYRIGHT BLOCK ---
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2013 Red Hat, Inc.
+ * All rights reserved.
+ * --- END COPYRIGHT BLOCK ---
+ *
+ * @author Endi S. Dewata
+ */
+
+table {
+    border: 1px solid black;
+    border-spacing: 0;
+}
+
+table td {
+    border: 1px solid black;
+}
diff --git a/base/server/share/webapps/pki/js/pki-ui.js b/base/server/share/webapps/pki/js/pki-ui.js
new file mode 100644
index 0000000000000000000000000000000000000000..35363b0f7a192626a3c4300f10836c79bcddc2d2
--- /dev/null
+++ b/base/server/share/webapps/pki/js/pki-ui.js
@@ -0,0 +1,56 @@
+/* --- BEGIN COPYRIGHT BLOCK ---
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2013 Red Hat, Inc.
+ * All rights reserved.
+ * --- END COPYRIGHT BLOCK ---
+ *
+ * @author Endi S. Dewata
+ */
+
+var TableItemView = Backbone.View.extend({
+    render: function() {
+        var self = this;
+        $("td", self.el).each(function(index) {
+            var item = $(this);
+            var name = item.attr("name");
+            var value = self.model.get(name);
+            item.text(value);
+        });
+    }
+});
+
+var TableView = Backbone.View.extend({
+    initialize: function() {
+        var self = this;
+        self.tbody = $("tbody", self.el);
+        self.template = $("tr", self.tbody).detach();
+        self.render();
+    },
+    render: function() {
+        var self = this;
+        self.collection.fetch({
+            success: function() {
+                _(self.collection.models).each(function(item) {
+                    var itemView = new TableItemView({
+                        el: self.template.clone(),
+                        model: item
+                    });
+                    itemView.render();
+                    self.tbody.append(itemView.el);
+                }, self);
+            }
+        });
+    }
+});
diff --git a/base/tps-tomcat/shared/webapps/tps/activities.html b/base/tps-tomcat/shared/webapps/tps/activities.html
new file mode 100644
index 0000000000000000000000000000000000000000..e87d6daefdd117237022b9460af9349832fc6fa4
--- /dev/null
+++ b/base/tps-tomcat/shared/webapps/tps/activities.html
@@ -0,0 +1,65 @@
+<!-- --- BEGIN COPYRIGHT BLOCK ---
+     This program is free software; you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation; version 2 of the License.
+
+     This program is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+
+     You should have received a copy of the GNU General Public License along
+     with this program; if not, write to the Free Software Foundation, Inc.,
+     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+     Copyright (C) 2013 Red Hat, Inc.
+     All rights reserved.
+     --- END COPYRIGHT BLOCK --- -->
+<html>
+<head>
+    <link href="/pki/css/pki-ui.css" rel="stylesheet" type="text/css">
+    <script src="/pki/js/jquery.js"></script>
+    <script src="/pki/js/underscore.js"></script>
+    <script src="/pki/js/backbone.js"></script>
+    <script src="/pki/js/pki-ui.js"></script>
+    <script src="/tps/js/activity.js"></script>
+    <script>
+$(function() {
+    new TableView({
+        el: $("table[name='activities']"),
+        collection: new ActivityCollection()
+    });
+});
+    </script>
+</head>
+<body>
+
+<h1>Activities</h1>
+
+<table name="activities">
+<thead>
+    <tr>
+        <td>Activity ID</td>
+        <td>Token ID</td>
+        <td>User ID</td>
+        <td>IP</td>
+        <td>Operation</td>
+        <td>Result</td>
+        <td>Date</td>
+    </tr>
+</thead>
+<tbody>
+    <tr>
+        <td name="id">&nbsp;</td>
+        <td name="tokenID">&nbsp;</td>
+        <td name="userID">&nbsp;</td>
+        <td name="ip">&nbsp;</td>
+        <td name="operation">&nbsp;</td>
+        <td name="result">&nbsp;</td>
+        <td name="date">&nbsp;</td>
+    </tr>
+</tbody>
+</table>
+
+</body>
+</html>
diff --git a/base/tps-tomcat/shared/webapps/tps/authenticators.html b/base/tps-tomcat/shared/webapps/tps/authenticators.html
new file mode 100644
index 0000000000000000000000000000000000000000..0f08c822f80052fc71dd75524c244cfdd630f470
--- /dev/null
+++ b/base/tps-tomcat/shared/webapps/tps/authenticators.html
@@ -0,0 +1,55 @@
+<!-- --- BEGIN COPYRIGHT BLOCK ---
+     This program is free software; you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation; version 2 of the License.
+
+     This program is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+
+     You should have received a copy of the GNU General Public License along
+     with this program; if not, write to the Free Software Foundation, Inc.,
+     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+     Copyright (C) 2013 Red Hat, Inc.
+     All rights reserved.
+     --- END COPYRIGHT BLOCK --- -->
+<html>
+<head>
+    <link href="/pki/css/pki-ui.css" rel="stylesheet" type="text/css">
+    <script src="/pki/js/jquery.js"></script>
+    <script src="/pki/js/underscore.js"></script>
+    <script src="/pki/js/backbone.js"></script>
+    <script src="/pki/js/pki-ui.js"></script>
+    <script src="/tps/js/authenticator.js"></script>
+    <script>
+$(function() {
+    new TableView({
+        el: $("table[name='authenticators']"),
+        collection: new AuthenticatorCollection()
+    });
+});
+    </script>
+</head>
+<body>
+
+<h1>Authenticators</h1>
+
+<table name="authenticators">
+<thead>
+    <tr>
+        <td>Authenticator ID</td>
+        <td>Status</td>
+    </tr>
+</thead>
+<tbody>
+    <tr>
+        <td name="id">&nbsp;</td>
+        <td name="status">&nbsp;</td>
+    </tr>
+</tbody>
+</table>
+
+</body>
+</html>
diff --git a/base/tps-tomcat/shared/webapps/tps/certificates.html b/base/tps-tomcat/shared/webapps/tps/certificates.html
new file mode 100644
index 0000000000000000000000000000000000000000..52d4eed6151e795290a7fab62bce3c2a566d3fbe
--- /dev/null
+++ b/base/tps-tomcat/shared/webapps/tps/certificates.html
@@ -0,0 +1,69 @@
+<!-- --- BEGIN COPYRIGHT BLOCK ---
+     This program is free software; you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation; version 2 of the License.
+
+     This program is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+
+     You should have received a copy of the GNU General Public License along
+     with this program; if not, write to the Free Software Foundation, Inc.,
+     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+     Copyright (C) 2013 Red Hat, Inc.
+     All rights reserved.
+     --- END COPYRIGHT BLOCK --- -->
+<html>
+<head>
+    <link href="/pki/css/pki-ui.css" rel="stylesheet" type="text/css">
+    <script src="/pki/js/jquery.js"></script>
+    <script src="/pki/js/underscore.js"></script>
+    <script src="/pki/js/backbone.js"></script>
+    <script src="/pki/js/pki-ui.js"></script>
+    <script src="/tps/js/certificate.js"></script>
+    <script>
+$(function() {
+    new TableView({
+        el: $("table[name='certificates']"),
+        collection: new CertificateCollection()
+    });
+});
+    </script>
+</head>
+<body>
+
+<h1>Certificates</h1>
+
+<table name="certificates">
+<thead>
+    <tr>
+        <td>Certificate ID</td>
+        <td>Serial Number</td>
+        <td>Subject</td>
+        <td>Token ID</td>
+        <td>User ID</td>
+        <td>Key Type</td>
+        <td>Status</td>
+        <td>Create Time</td>
+        <td>Modify Time</td>
+    </tr>
+</thead>
+<tbody>
+    <tr>
+        <td name="id">&nbsp;</td>
+        <td name="serialNumber">&nbsp;</td>
+        <td name="subject">&nbsp;</td>
+        <td name="tokenID">&nbsp;</td>
+        <td name="userID">&nbsp;</td>
+        <td name="keyType">&nbsp;</td>
+        <td name="status">&nbsp;</td>
+        <td name="createTime">&nbsp;</td>
+        <td name="modifyTime">&nbsp;</td>
+    </tr>
+</tbody>
+</table>
+
+</body>
+</html>
diff --git a/base/tps-tomcat/shared/webapps/tps/connections.html b/base/tps-tomcat/shared/webapps/tps/connections.html
new file mode 100644
index 0000000000000000000000000000000000000000..99136e667606d676efd6abfcc78e4c5600cb60a6
--- /dev/null
+++ b/base/tps-tomcat/shared/webapps/tps/connections.html
@@ -0,0 +1,55 @@
+<!-- --- BEGIN COPYRIGHT BLOCK ---
+     This program is free software; you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation; version 2 of the License.
+
+     This program is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+
+     You should have received a copy of the GNU General Public License along
+     with this program; if not, write to the Free Software Foundation, Inc.,
+     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+     Copyright (C) 2013 Red Hat, Inc.
+     All rights reserved.
+     --- END COPYRIGHT BLOCK --- -->
+<html>
+<head>
+    <link href="/pki/css/pki-ui.css" rel="stylesheet" type="text/css">
+    <script src="/pki/js/jquery.js"></script>
+    <script src="/pki/js/underscore.js"></script>
+    <script src="/pki/js/backbone.js"></script>
+    <script src="/pki/js/pki-ui.js"></script>
+    <script src="/tps/js/connection.js"></script>
+    <script>
+$(function() {
+    new TableView({
+        el: $("table[name='connections']"),
+        collection: new ConnectionCollection()
+    });
+});
+    </script>
+</head>
+<body>
+
+<h1>Connections</h1>
+
+<table name="connections">
+<thead>
+    <tr>
+        <td>Connection ID</td>
+        <td>Status</td>
+    </tr>
+</thead>
+<tbody>
+    <tr>
+        <td name="id">&nbsp;</td>
+        <td name="status">&nbsp;</td>
+    </tr>
+</tbody>
+</table>
+
+</body>
+</html>
diff --git a/base/tps-tomcat/shared/webapps/tps/index.html b/base/tps-tomcat/shared/webapps/tps/groups.html
similarity index 50%
copy from base/tps-tomcat/shared/webapps/tps/index.html
copy to base/tps-tomcat/shared/webapps/tps/groups.html
index 30662d47aa6a0c3f7aafc03acf16b02cf2ac93bf..6fd76ee38e47375773d6720005f6e248a63bcd7f 100644
--- a/base/tps-tomcat/shared/webapps/tps/index.html
+++ b/base/tps-tomcat/shared/webapps/tps/groups.html
@@ -12,12 +12,44 @@
      with this program; if not, write to the Free Software Foundation, Inc.,
      51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-     Copyright (C) 2007 Red Hat, Inc.
+     Copyright (C) 2013 Red Hat, Inc.
      All rights reserved.
      --- END COPYRIGHT BLOCK --- -->
 <html>
-<script lang="javascript">
-    // redirect to 'ROOT'
-    window.location = "/";
-</script>
+<head>
+    <link href="/pki/css/pki-ui.css" rel="stylesheet" type="text/css">
+    <script src="/pki/js/jquery.js"></script>
+    <script src="/pki/js/underscore.js"></script>
+    <script src="/pki/js/backbone.js"></script>
+    <script src="/pki/js/pki-ui.js"></script>
+    <script src="/tps/js/group.js"></script>
+    <script>
+$(function() {
+    new TableView({
+        el: $("table[name='groups']"),
+        collection: new GroupCollection()
+    });
+});
+    </script>
+</head>
+<body>
+
+<h1>Groups</h1>
+
+<table name="groups">
+<thead>
+    <tr>
+        <td>Group ID</td>
+        <td>Description</td>
+    </tr>
+</thead>
+<tbody>
+    <tr>
+        <td name="id">&nbsp;</td>
+        <td name="description">&nbsp;</td>
+    </tr>
+</tbody>
+</table>
+
+</body>
 </html>
diff --git a/base/tps-tomcat/shared/webapps/tps/index.html b/base/tps-tomcat/shared/webapps/tps/index.html
index 30662d47aa6a0c3f7aafc03acf16b02cf2ac93bf..891b9a4b2579dea91eaaf18f9a0d35ea886c5077 100644
--- a/base/tps-tomcat/shared/webapps/tps/index.html
+++ b/base/tps-tomcat/shared/webapps/tps/index.html
@@ -12,12 +12,28 @@
      with this program; if not, write to the Free Software Foundation, Inc.,
      51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-     Copyright (C) 2007 Red Hat, Inc.
+     Copyright (C) 2013 Red Hat, Inc.
      All rights reserved.
      --- END COPYRIGHT BLOCK --- -->
 <html>
-<script lang="javascript">
-    // redirect to 'ROOT'
-    window.location = "/";
-</script>
+<head>
+    <link href="/pki/css/pki-ui.css" rel="stylesheet" type="text/css">
+</head>
+<body>
+
+<h1>Token Processing Service</h1>
+
+<ul>
+<li><a href="tokens.html">Tokens</a></li>
+<li><a href="certificates.html">Certificates</a></li>
+<li><a href="activities.html">Activities</a></li>
+<li><a href="profiles.html">Profiles</a></li>
+<li><a href="selftests.html">Self Tests</a></li>
+<li><a href="users.html">Users</a></li>
+<li><a href="groups.html">Groups</a></li>
+<li><a href="authenticators.html">Authenticators</a></li>
+<li><a href="connections.html">Connections</a></li>
+</ul>
+
+</body>
 </html>
diff --git a/base/tps-tomcat/shared/webapps/tps/js/activity.js b/base/tps-tomcat/shared/webapps/tps/js/activity.js
new file mode 100644
index 0000000000000000000000000000000000000000..425bf68366be937247e6e61d0de83b583f191599
--- /dev/null
+++ b/base/tps-tomcat/shared/webapps/tps/js/activity.js
@@ -0,0 +1,51 @@
+/* --- BEGIN COPYRIGHT BLOCK ---
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2013 Red Hat, Inc.
+ * All rights reserved.
+ * --- END COPYRIGHT BLOCK ---
+ *
+ * @author Endi S. Dewata
+ */
+
+var ActivityModel = Backbone.Model.extend({
+    urlRoot: "/tps/rest/activities"
+});
+
+var ActivityCollection = Backbone.Collection.extend({
+    url: function() {
+        return "/tps/rest/activities";
+    },
+    parse: function(response) {
+        var models = [];
+
+        var list = response.Activities.Activity;
+        list = list == undefined ? [] : [].concat(list);
+
+        _(list).each(function(item) {
+            var model = new ActivityModel({
+                id: item["@id"],
+                tokenID: item.TokenID,
+                userID: item.UserID,
+                ip: item.IP,
+                operation: item.Operation,
+                result: item.Result,
+                date: item.Date
+            });
+            models.push(model);
+        });
+
+        return models;
+    }
+});
diff --git a/base/tps-tomcat/shared/webapps/tps/js/authenticator.js b/base/tps-tomcat/shared/webapps/tps/js/authenticator.js
new file mode 100644
index 0000000000000000000000000000000000000000..13cc33eb8c5d5533d20506aed3ae1c006fd9f382
--- /dev/null
+++ b/base/tps-tomcat/shared/webapps/tps/js/authenticator.js
@@ -0,0 +1,46 @@
+/* --- BEGIN COPYRIGHT BLOCK ---
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2013 Red Hat, Inc.
+ * All rights reserved.
+ * --- END COPYRIGHT BLOCK ---
+ *
+ * @author Endi S. Dewata
+ */
+
+var AuthenticatorModel = Backbone.Model.extend({
+    urlRoot: "/tps/rest/authenticators"
+});
+
+var AuthenticatorCollection = Backbone.Collection.extend({
+    url: function() {
+        return "/tps/rest/authenticators";
+    },
+    parse: function(response) {
+        var models = [];
+
+        var list = response.Authenticators.Authenticator;
+        list = list == undefined ? [] : [].concat(list);
+
+        _(list).each(function(item) {
+            var model = new AuthenticatorModel({
+                id: item["@id"],
+                status: item.Status
+            });
+            models.push(model);
+        });
+
+        return models;
+    }
+});
diff --git a/base/tps-tomcat/shared/webapps/tps/js/certificate.js b/base/tps-tomcat/shared/webapps/tps/js/certificate.js
new file mode 100644
index 0000000000000000000000000000000000000000..c86fe7f462026d5980da1db2914dcaceccc172f9
--- /dev/null
+++ b/base/tps-tomcat/shared/webapps/tps/js/certificate.js
@@ -0,0 +1,53 @@
+/* --- BEGIN COPYRIGHT BLOCK ---
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2013 Red Hat, Inc.
+ * All rights reserved.
+ * --- END COPYRIGHT BLOCK ---
+ *
+ * @author Endi S. Dewata
+ */
+
+var CertificateModel = Backbone.Model.extend({
+    urlRoot: "/tps/rest/connections"
+});
+
+var CertificateCollection = Backbone.Collection.extend({
+    url: function() {
+        return "/tps/rest/connections";
+    },
+    parse: function(response) {
+        var models = [];
+
+        var list = response.Certificates.Certificate;
+        list = list == undefined ? [] : [].concat(list);
+
+        _(list).each(function(item) {
+            var model = new CertificateModel({
+                id: item["@id"],
+                serialNumber: item.SerialNumber,
+                subject: item.Subject,
+                tokenID: item.TokenID,
+                userID: item.UserID,
+                keyType: item.KeyType,
+                status: item.Status,
+                createTime: item.CreateTime,
+                modifyTime: item.ModifyTime
+            });
+            models.push(model);
+        });
+
+        return models;
+    }
+});
diff --git a/base/tps-tomcat/shared/webapps/tps/js/connection.js b/base/tps-tomcat/shared/webapps/tps/js/connection.js
new file mode 100644
index 0000000000000000000000000000000000000000..8fe52d6a308bc64aa344f925454f9450468ca1ef
--- /dev/null
+++ b/base/tps-tomcat/shared/webapps/tps/js/connection.js
@@ -0,0 +1,46 @@
+/* --- BEGIN COPYRIGHT BLOCK ---
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2013 Red Hat, Inc.
+ * All rights reserved.
+ * --- END COPYRIGHT BLOCK ---
+ *
+ * @author Endi S. Dewata
+ */
+
+var ConnectionModel = Backbone.Model.extend({
+    urlRoot: "/tps/rest/connections"
+});
+
+var ConnectionCollection = Backbone.Collection.extend({
+    url: function() {
+        return "/tps/rest/connections";
+    },
+    parse: function(response) {
+        var models = [];
+
+        var list = response.Connections.Connection;
+        list = list == undefined ? [] : [].concat(list);
+
+        _(list).each(function(item) {
+            var model = new ConnectionModel({
+                id: item["@id"],
+                status: item.Status
+            });
+            models.push(model);
+        });
+
+        return models;
+    }
+});
diff --git a/base/tps-tomcat/shared/webapps/tps/js/group.js b/base/tps-tomcat/shared/webapps/tps/js/group.js
new file mode 100644
index 0000000000000000000000000000000000000000..8a6be0be6327882b02570bca63bb52a0e8f5758b
--- /dev/null
+++ b/base/tps-tomcat/shared/webapps/tps/js/group.js
@@ -0,0 +1,46 @@
+/* --- BEGIN COPYRIGHT BLOCK ---
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2013 Red Hat, Inc.
+ * All rights reserved.
+ * --- END COPYRIGHT BLOCK ---
+ *
+ * @author Endi S. Dewata
+ */
+
+var GroupModel = Backbone.Model.extend({
+    urlRoot: "/tps/rest/admin/users"
+});
+
+var GroupCollection = Backbone.Collection.extend({
+    url: function() {
+        return "/tps/rest/admin/groups";
+    },
+    parse: function(response) {
+        var models = [];
+
+        var list = response.Groups.Group;
+        list = list == undefined ? [] : [].concat(list);
+
+        _(list).each(function(item) {
+            var model = new GroupModel({
+                id: item["@id"],
+                description: item.Description
+            });
+            models.push(model);
+        });
+
+        return models;
+    }
+});
diff --git a/base/tps-tomcat/shared/webapps/tps/js/profile.js b/base/tps-tomcat/shared/webapps/tps/js/profile.js
new file mode 100644
index 0000000000000000000000000000000000000000..54afc432401711de185c8543d8477b8ae765aafb
--- /dev/null
+++ b/base/tps-tomcat/shared/webapps/tps/js/profile.js
@@ -0,0 +1,46 @@
+/* --- BEGIN COPYRIGHT BLOCK ---
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2013 Red Hat, Inc.
+ * All rights reserved.
+ * --- END COPYRIGHT BLOCK ---
+ *
+ * @author Endi S. Dewata
+ */
+
+var ProfileModel = Backbone.Model.extend({
+    urlRoot: "/tps/rest/profiles"
+});
+
+var ProfileCollection = Backbone.Collection.extend({
+    url: function() {
+        return "/tps/rest/profiles";
+    },
+    parse: function(response) {
+        var models = [];
+
+        var list = response.Profiles.Profile;
+        list = list == undefined ? [] : [].concat(list);
+
+        _(list).each(function(item) {
+            var model = new ProfileModel({
+                id: item["@id"],
+                status: item.Status
+            });
+            models.push(model);
+        });
+
+        return models;
+    }
+});
diff --git a/base/tps-tomcat/shared/webapps/tps/js/selftest.js b/base/tps-tomcat/shared/webapps/tps/js/selftest.js
new file mode 100644
index 0000000000000000000000000000000000000000..8753d98c68c00a9ed6a7dde58d78072cdbebdf2d
--- /dev/null
+++ b/base/tps-tomcat/shared/webapps/tps/js/selftest.js
@@ -0,0 +1,49 @@
+/* --- BEGIN COPYRIGHT BLOCK ---
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2013 Red Hat, Inc.
+ * All rights reserved.
+ * --- END COPYRIGHT BLOCK ---
+ *
+ * @author Endi S. Dewata
+ */
+
+var SelfTestModel = Backbone.Model.extend({
+    urlRoot: "/tps/rest/selftests"
+});
+
+var SelfTestCollection = Backbone.Collection.extend({
+    url: function() {
+        return "/tps/rest/selftests";
+    },
+    parse: function(response) {
+        var models = [];
+
+        var list = response.SelfTests.SelfTest;
+        list = list == undefined ? [] : [].concat(list);
+
+        _(list).each(function(item) {
+            var model = new SelfTestModel({
+                id: item["@id"],
+                enabledAtStartup: item.EnabledAtStartup,
+                criticalAtStartup: item.CriticalAtStartup,
+                enabledOnDemand: item.EnabledOnDemand,
+                criticalOnDemand: item.CriticalOnDemand,
+            });
+            models.push(model);
+        });
+
+        return models;
+    }
+});
diff --git a/base/tps-tomcat/shared/webapps/tps/js/token.js b/base/tps-tomcat/shared/webapps/tps/js/token.js
new file mode 100644
index 0000000000000000000000000000000000000000..4ff39554c14d8383a69909838be56635607f73dc
--- /dev/null
+++ b/base/tps-tomcat/shared/webapps/tps/js/token.js
@@ -0,0 +1,52 @@
+/* --- BEGIN COPYRIGHT BLOCK ---
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2013 Red Hat, Inc.
+ * All rights reserved.
+ * --- END COPYRIGHT BLOCK ---
+ *
+ * @author Endi S. Dewata
+ */
+
+var TokenModel = Backbone.Model.extend({
+    urlRoot: "/tps/rest/tokens"
+});
+
+var TokenCollection = Backbone.Collection.extend({
+    url: function() {
+        return "/tps/rest/tokens";
+    },
+    parse: function(response) {
+        var models = [];
+
+        var list = response.Tokens.Token;
+        list = list == undefined ? [] : [].concat(list);
+
+        _(list).each(function(item) {
+            var model = new TokenModel({
+                id: item["@id"],
+                userID: item.UserID,
+                status: item.Status,
+                reason: item.Reason,
+                appletID: item.AppletID,
+                keyInfo: item.KeyInfo,
+                created: item.CreateTimestamp,
+                modified: item.ModifyTimestamp
+            });
+            models.push(model);
+        });
+
+        return models;
+    }
+});
diff --git a/base/tps-tomcat/shared/webapps/tps/js/user.js b/base/tps-tomcat/shared/webapps/tps/js/user.js
new file mode 100644
index 0000000000000000000000000000000000000000..6c112a6484937a4095e3ddaeecb8b4bd48213c39
--- /dev/null
+++ b/base/tps-tomcat/shared/webapps/tps/js/user.js
@@ -0,0 +1,46 @@
+/* --- BEGIN COPYRIGHT BLOCK ---
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2013 Red Hat, Inc.
+ * All rights reserved.
+ * --- END COPYRIGHT BLOCK ---
+ *
+ * @author Endi S. Dewata
+ */
+
+var UserModel = Backbone.Model.extend({
+    urlRoot: "/tps/rest/admin/users"
+});
+
+var UserCollection = Backbone.Collection.extend({
+    url: function() {
+        return "/tps/rest/admin/users";
+    },
+    parse: function(response) {
+        var models = [];
+
+        var list = response.Users.User;
+        list = list == undefined ? [] : [].concat(list);
+
+        _(list).each(function(item) {
+            var model = new UserModel({
+                id: item["@id"],
+                fullName: item.FullName
+            });
+            models.push(model);
+        });
+
+        return models;
+    }
+});
diff --git a/base/tps-tomcat/shared/webapps/tps/index.html b/base/tps-tomcat/shared/webapps/tps/profiles.html
similarity index 50%
copy from base/tps-tomcat/shared/webapps/tps/index.html
copy to base/tps-tomcat/shared/webapps/tps/profiles.html
index 30662d47aa6a0c3f7aafc03acf16b02cf2ac93bf..716ba24b3da70bbee0c4aae25148b870b26eeb2d 100644
--- a/base/tps-tomcat/shared/webapps/tps/index.html
+++ b/base/tps-tomcat/shared/webapps/tps/profiles.html
@@ -12,12 +12,44 @@
      with this program; if not, write to the Free Software Foundation, Inc.,
      51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-     Copyright (C) 2007 Red Hat, Inc.
+     Copyright (C) 2013 Red Hat, Inc.
      All rights reserved.
      --- END COPYRIGHT BLOCK --- -->
 <html>
-<script lang="javascript">
-    // redirect to 'ROOT'
-    window.location = "/";
-</script>
+<head>
+    <link href="/pki/css/pki-ui.css" rel="stylesheet" type="text/css">
+    <script src="/pki/js/jquery.js"></script>
+    <script src="/pki/js/underscore.js"></script>
+    <script src="/pki/js/backbone.js"></script>
+    <script src="/pki/js/pki-ui.js"></script>
+    <script src="/tps/js/profile.js"></script>
+    <script>
+$(function() {
+    new TableView({
+        el: $("table[name='profiles']"),
+        collection: new ProfileCollection()
+    });
+});
+    </script>
+</head>
+<body>
+
+<h1>Profiles</h1>
+
+<table name="profiles">
+<thead>
+    <tr>
+        <td>Profile ID</td>
+        <td>Status</td>
+    </tr>
+</thead>
+<tbody>
+    <tr>
+        <td name="id">&nbsp;</td>
+        <td name="status">&nbsp;</td>
+    </tr>
+</tbody>
+</table>
+
+</body>
 </html>
diff --git a/base/tps-tomcat/shared/webapps/tps/selftests.html b/base/tps-tomcat/shared/webapps/tps/selftests.html
new file mode 100644
index 0000000000000000000000000000000000000000..026796e13afb50d96defa304f2b82a90e6c390b0
--- /dev/null
+++ b/base/tps-tomcat/shared/webapps/tps/selftests.html
@@ -0,0 +1,61 @@
+<!-- --- BEGIN COPYRIGHT BLOCK ---
+     This program is free software; you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation; version 2 of the License.
+
+     This program is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+
+     You should have received a copy of the GNU General Public License along
+     with this program; if not, write to the Free Software Foundation, Inc.,
+     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+     Copyright (C) 2013 Red Hat, Inc.
+     All rights reserved.
+     --- END COPYRIGHT BLOCK --- -->
+<html>
+<head>
+    <link href="/pki/css/pki-ui.css" rel="stylesheet" type="text/css">
+    <script src="/pki/js/jquery.js"></script>
+    <script src="/pki/js/underscore.js"></script>
+    <script src="/pki/js/backbone.js"></script>
+    <script src="/pki/js/pki-ui.js"></script>
+    <script src="/tps/js/selftest.js"></script>
+    <script>
+$(function() {
+    new TableView({
+        el: $("table[name='selftests']"),
+        collection: new SelfTestCollection()
+    });
+});
+    </script>
+</head>
+<body>
+
+<h1>Self Tests</h1>
+
+<table name="selftests">
+<thead>
+    <tr>
+        <td>Self Test ID</td>
+        <td>Enabled at Statup</td>
+        <td>Critical at Startup</td>
+        <td>Enabled on Demand</td>
+        <td>Critical on Demand</td>
+    </tr>
+</thead>
+<tbody>
+    <tr>
+        <td name="id">&nbsp;</td>
+        <td name="enabledAtStartup">&nbsp;</td>
+        <td name="criticalAtStartup">&nbsp;</td>
+        <td name="enabledOnDemand">&nbsp;</td>
+        <td name="criticalOnDemand">&nbsp;</td>
+    </tr>
+</tbody>
+</table>
+
+</body>
+</html>
diff --git a/base/tps-tomcat/shared/webapps/tps/tokens.html b/base/tps-tomcat/shared/webapps/tps/tokens.html
new file mode 100644
index 0000000000000000000000000000000000000000..06d2d978e430adb63e578f3fc6fefd3613dd25ee
--- /dev/null
+++ b/base/tps-tomcat/shared/webapps/tps/tokens.html
@@ -0,0 +1,67 @@
+<!-- --- BEGIN COPYRIGHT BLOCK ---
+     This program is free software; you can redistribute it and/or modify
+     it under the terms of the GNU General Public License as published by
+     the Free Software Foundation; version 2 of the License.
+
+     This program is distributed in the hope that it will be useful,
+     but WITHOUT ANY WARRANTY; without even the implied warranty of
+     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+     GNU General Public License for more details.
+
+     You should have received a copy of the GNU General Public License along
+     with this program; if not, write to the Free Software Foundation, Inc.,
+     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+     Copyright (C) 2013 Red Hat, Inc.
+     All rights reserved.
+     --- END COPYRIGHT BLOCK --- -->
+<html>
+<head>
+    <link href="/pki/css/pki-ui.css" rel="stylesheet" type="text/css">
+    <script src="/pki/js/jquery.js"></script>
+    <script src="/pki/js/underscore.js"></script>
+    <script src="/pki/js/backbone.js"></script>
+    <script src="/pki/js/pki-ui.js"></script>
+    <script src="/tps/js/token.js"></script>
+    <script>
+$(function() {
+    new TableView({
+        el: $("table[name='tokens']"),
+        collection: new TokenCollection()
+    });
+});
+    </script>
+</head>
+<body>
+
+<h1>Tokens</h1>
+
+<table name="tokens">
+<thead>
+    <tr>
+        <td>Token ID</td>
+        <td>User ID</td>
+        <td>Status</td>
+        <td>Reason</td>
+        <td>Applet ID</td>
+        <td>Key Info</td>
+        <td>Created</td>
+        <td>Modified</td>
+    </tr>
+</thead>
+<tbody>
+    <tr>
+        <td name="id">&nbsp;</td>
+        <td name="userID">&nbsp;</td>
+        <td name="status">&nbsp;</td>
+        <td name="reason">&nbsp;</td>
+        <td name="appletID">&nbsp;</td>
+        <td name="keyInfo">&nbsp;</td>
+        <td name="created">&nbsp;</td>
+        <td name="modified">&nbsp;</td>
+    </tr>
+</tbody>
+</table>
+
+</body>
+</html>
diff --git a/base/tps-tomcat/shared/webapps/tps/index.html b/base/tps-tomcat/shared/webapps/tps/users.html
similarity index 50%
copy from base/tps-tomcat/shared/webapps/tps/index.html
copy to base/tps-tomcat/shared/webapps/tps/users.html
index 30662d47aa6a0c3f7aafc03acf16b02cf2ac93bf..cd66d2c9328abc832adc2951bd90a3c1dc3c6331 100644
--- a/base/tps-tomcat/shared/webapps/tps/index.html
+++ b/base/tps-tomcat/shared/webapps/tps/users.html
@@ -12,12 +12,44 @@
      with this program; if not, write to the Free Software Foundation, Inc.,
      51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
-     Copyright (C) 2007 Red Hat, Inc.
+     Copyright (C) 2013 Red Hat, Inc.
      All rights reserved.
      --- END COPYRIGHT BLOCK --- -->
 <html>
-<script lang="javascript">
-    // redirect to 'ROOT'
-    window.location = "/";
-</script>
+<head>
+    <link href="/pki/css/pki-ui.css" rel="stylesheet" type="text/css">
+    <script src="/pki/js/jquery.js"></script>
+    <script src="/pki/js/underscore.js"></script>
+    <script src="/pki/js/backbone.js"></script>
+    <script src="/pki/js/pki-ui.js"></script>
+    <script src="/tps/js/user.js"></script>
+    <script>
+$(function() {
+    new TableView({
+        el: $("table[name='users']"),
+        collection: new UserCollection()
+    });
+});
+    </script>
+</head>
+<body>
+
+<h1>Users</h1>
+
+<table name="users">
+<thead>
+    <tr>
+        <td>User ID</td>
+        <td>Full Name</td>
+    </tr>
+</thead>
+<tbody>
+    <tr>
+        <td name="id">&nbsp;</td>
+        <td name="fullName">&nbsp;</td>
+    </tr>
+</tbody>
+</table>
+
+</body>
 </html>
-- 
1.8.4.2

