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/webapps/tps/js/config.js | |
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/webapps/tps/js/config.js')
-rw-r--r-- | base/tps-tomcat/shared/webapps/tps/js/config.js | 70 |
1 files changed, 70 insertions, 0 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); + } +}); |