From 070fc176aecc3c7661cdb085b157d2d4c653fc46 Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Fri, 22 Feb 2013 17:22:30 +0100 Subject: Web UI:Certificate pages Following pages were added to Web UI: * certificated details * certificate search Certificate is not regular object so it gets no metadata. Therefore artificial metadata were created for it to allow usage of search and details facet. Search and details facet were modified to allow removing of add/remove/update/ reset buttons - certificates have no mod operation and they are not added by standard means. User can revoke and restore certificated in details facet. https://fedorahosted.org/freeipa/ticket/3419 --- install/ui/src/freeipa/widget.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'install/ui/src/freeipa/widget.js') diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index 6472cab97..5ce767e7e 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -960,6 +960,7 @@ IPA.textarea_widget = function (spec) { that.rows = spec.rows || 5; that.cols = spec.cols || 40; + that.style = spec.style; that.create = function(container) { @@ -972,12 +973,15 @@ IPA.textarea_widget = function (spec) { rows: that.rows, cols: that.cols, disabled: that.disabled, + readOnly: !!that.read_only, title: that.tooltip, keyup: function() { that.on_value_changed(); } }).appendTo(container); + if (that.style) that.input.css(that.style); + that.input.bind('input', function() { that.on_value_changed(); }); @@ -990,11 +994,17 @@ IPA.textarea_widget = function (spec) { }; that.save = function() { + if (that.read_only || !that.writable) { + return null; + } var value = that.input.val(); return [value]; }; that.update = function(values) { + var read_only = that.read_only || !that.writable; + that.input.prop('readOnly', read_only); + var value = values && values.length ? values[0] : ''; that.input.val(value); }; @@ -2947,6 +2957,27 @@ IPA.details_table_section = function(spec) { return that; }; +IPA.hide_empty_row_policy = function (spec) { + + spec = spec || {}; + + var that = IPA.facet_policy(); + that.value_name = spec.value_name || spec.widget; + that.widget_name = spec.widget; + that.section_name = spec.section; + + that.post_load = function(data) { + + var value = data.result.result[that.value_name]; + var visible = !IPA.is_empty(value); + + var section = that.container.widgets.get_widget(that.section_name); + section.set_row_visible(that.widget_name, visible); + }; + + return that; +}; + //non-collabsible section IPA.details_table_section_nc = function(spec) { -- cgit