diff options
author | Endi S. Dewata <edewata@redhat.com> | 2014-04-04 11:52:37 -0400 |
---|---|---|
committer | Endi S. Dewata <edewata@redhat.com> | 2014-04-08 16:07:18 -0400 |
commit | d79e4f9500bbdd758d2c33128a2d58a3d3602fa7 (patch) | |
tree | 6d888e0a3a36df9a9417ed9ef6fcbc3638dd16d8 /base/tps-tomcat/shared | |
parent | c289405e411c5731fa21e31b5121ee4c2739258c (diff) | |
download | pki-d79e4f9500bbdd758d2c33128a2d58a3d3602fa7.tar.gz pki-d79e4f9500bbdd758d2c33128a2d58a3d3602fa7.tar.xz pki-d79e4f9500bbdd758d2c33128a2d58a3d3602fa7.zip |
Added general configuration page.
A new page has been added to manage general TPS configuration
properties. The properties are read-only by default. In edit
mode the property name will become a link which will show a
dialog to edit the property value.
The config REST service has been updated to use PATCH for
update operation and handle possible null collection of
properties.
Fixed a bug in TableItem.reset() where the code didn't clear
the table cell properly.
Fixed a bug in ConfigDatabase.getProperties() where the code
didn't handle null property key properly.
Ticket #654
Diffstat (limited to 'base/tps-tomcat/shared')
-rw-r--r-- | base/tps-tomcat/shared/webapps/tps/js/config.js | 70 | ||||
-rw-r--r-- | base/tps-tomcat/shared/webapps/tps/js/tps.js | 5 | ||||
-rw-r--r-- | base/tps-tomcat/shared/webapps/tps/ui/config.html | 104 | ||||
-rw-r--r-- | base/tps-tomcat/shared/webapps/tps/ui/index.html | 7 |
4 files changed, 185 insertions, 1 deletions
diff --git a/base/tps-tomcat/shared/webapps/tps/js/config.js b/base/tps-tomcat/shared/webapps/tps/js/config.js new file mode 100644 index 000000000..3bd2492df --- /dev/null +++ b/base/tps-tomcat/shared/webapps/tps/js/config.js @@ -0,0 +1,70 @@ +/* --- 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 ConfigModel = Model.extend({ + url: function() { + return "/tps/rest/config"; + }, + parseResponse: function(response) { + return { + id: "config", + status: response.Status, + properties: response.Properties.Property + }; + }, + createRequest: function(entry) { + return { + Status: entry.status, + Properties: { + Property: entry.properties + } + }; + } +}); + +var PropertiesTableItem = TableItem.extend({ + initialize: function(options) { + var self = this; + PropertiesTableItem.__super__.initialize.call(self, options); + }, + renderIDColumn: function(td) { + var self = this; + + // in view mode all properties are read-only + if (self.table.mode == "view") { + self.renderColumn(td); + return; + } + + // in edit mode all properties are editable + PropertiesTableItem.__super__.renderIDColumn.call(self, td); + } +}); + +var ConfigPage = EntryWithPropertiesPage.extend({ + initialize: function(options) { + var self = this; + options.model = new ConfigModel(); + options.tableItem = PropertiesTableItem; + options.tableSize = 15; + ConfigPage.__super__.initialize.call(self, options); + } +}); diff --git a/base/tps-tomcat/shared/webapps/tps/js/tps.js b/base/tps-tomcat/shared/webapps/tps/js/tps.js index 9c4792ebe..16199cb4f 100644 --- a/base/tps-tomcat/shared/webapps/tps/js/tps.js +++ b/base/tps-tomcat/shared/webapps/tps/js/tps.js @@ -53,6 +53,8 @@ var EntryWithPropertiesPage = EntryPage.extend({ var self = this; EntryWithPropertiesPage.__super__.initialize.call(self, options); self.parentPage = options.parentPage; + self.tableItem = options.tableItem; + self.tableSize = options.tableSize || 10; }, setup: function() { var self = this; @@ -121,7 +123,8 @@ var EntryWithPropertiesPage = EntryPage.extend({ addDialog: addDialog, editDialog: editDialog, viewDialog: viewDialog, - pageSize: 10 + tableItem: self.tableItem, + pageSize: self.tableSize }); }, renderContent: function() { diff --git a/base/tps-tomcat/shared/webapps/tps/ui/config.html b/base/tps-tomcat/shared/webapps/tps/ui/config.html new file mode 100644 index 000000000..69dd06b12 --- /dev/null +++ b/base/tps-tomcat/shared/webapps/tps/ui/config.html @@ -0,0 +1,104 @@ +<!-- --- 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) 2014 Red Hat, Inc. + All rights reserved. + --- END COPYRIGHT BLOCK --- --> +<div class="pki-header"> + +<span class="pki-title">General</span></span> + +<span class="pki-actions"> + +<span class="pki-menu" style="display: none;"> +<a name="edit" href="#">Edit</a><br> +</span> + +<span class="pki-buttons" style="display: none;"> +<button name="cancel">Cancel</button> +<button name="save" class="primary">Save</button> +</span> + +</span> + +</div> + +<table name="properties"> +<thead> + <tr> + <th class="pki-table-actions" colspan="3"> + <span name="search"> + <input name="search" type="text" placeholder="Search..."> + </span> + <span class="pki-table-buttons" style="display: none;"> + <button name="add">Add</button> + <button name="remove">Remove</button> + </span> + </th> + </tr> + <tr> + <th class="pki-select-column"><input id="properties_selectall" type="checkbox"><label for="properties_selectall"> </label></th> + <th class="pki-property-name-column">Name</th> + <th>Value</th> + </tr> +</thead> +<tbody> + <tr> + <td class="pki-select-column"><input id="properties_select" type="checkbox"><label for="properties_select"> </label></td> + <td name="id" class="pki-property-name-column"><a href="#"> </a></td> + <td name="value"> </td> + </tr> +</tbody> +<tfoot> + <tr> + <th class="pki-table-actions" colspan="3"> + <div class="pki-table-info"> + Total: <span name="totalEntries">0</span> entries + </div> + <div class="pki-page-controls"> + <ul class="pagination"> + <li><a href="#" name="first"><span class="i fa fa-angle-double-left"></span></a></li> + <li><a href="#" name="prev"><span class="i fa fa-angle-left"></span></a></li> + </ul> + <span class="pki-page-jump"> + <input name="page" type="text" value="1"> of <span name="totalPages">1</span> + </span> + <ul class="pagination"> + <li><a href="#" name="next"><span class="i fa fa-angle-right"></span></a></li> + <li><a href="#" name="last"><span class="i fa fa-angle-double-right"></span></a></li> + </ul> + </div> + </th> + </tr> +</tfoot> +</table> + +<div id="property-dialog" class="rcue-dialog-background"> + <div class="rcue-dialog"> + <header> + <h1>Edit Property</h1> + <a class="rcue-button-close" href="#"></a> + </header> + <fieldset> + <label>Name</label><input name="name" type="text"><br> + <label>Value</label><input name="value" type="text"><br> + </fieldset> + <footer> + <button name="add" class="primary">Add</button> + <button name="save" class="primary">Save</button> + <button name="close" class="primary">Close</button> + <button name="cancel">Cancel</button> + </footer> + </div> +</div> diff --git a/base/tps-tomcat/shared/webapps/tps/ui/index.html b/base/tps-tomcat/shared/webapps/tps/ui/index.html index ed9c1b9ce..44978fc6f 100644 --- a/base/tps-tomcat/shared/webapps/tps/ui/index.html +++ b/base/tps-tomcat/shared/webapps/tps/ui/index.html @@ -31,6 +31,7 @@ <script src="/tps/js/audit.js"></script> <script src="/tps/js/authenticator.js"></script> <script src="/tps/js/cert.js"></script> + <script src="/tps/js/config.js"></script> <script src="/tps/js/connection.js"></script> <script src="/tps/js/group.js"></script> <script src="/tps/js/profile.js"></script> @@ -80,6 +81,11 @@ $(function() { url: "certs.html" })); + navigation.page("config", new ConfigPage({ + el: content, + url: "config.html" + })); + navigation.page("connections", new ConnectionsPage({ el: content, url: "connections.html" @@ -169,6 +175,7 @@ $(function() { <b class="caret"></b> </a> <ul class="dropdown-menu"> + <li><a href="#config">General</a></li> <li><a href="#authenticators">Authentication Sources</a></li> <li><a href="#connections">Subsystem Connections</a></li> <li><a href="#profiles">Profiles</a></li> |