From db822955c2b61b31ba96213ec88c14c2b8d827bc Mon Sep 17 00:00:00 2001 From: "Endi S. Dewata" Date: Tue, 7 Dec 2010 01:51:51 -0600 Subject: SUDO adjustments The SUDO rule details facet has been updated to support the latest UI spec. The facet consists of 5 sections: general, users, hosts, commands, and run-as. The general section contains the SUDO rule description and status. If the status is changed, the sudorule-enable/disable will be invoked. The other sections contain radio buttons for the association category and tables for the members. When a member is added or removed, the category will be adjusted appropriately. If the category is changed to 'all', 'allow', or 'deny', all members will be removed. The last section is currently not working because backend support is not yet available. The adder dialog boxes for users, groups, and hosts has been modified to accept external identities. The layout for the base adder dialog was updated. The base dialog class was updated to support templates. The SUDO dialog boxes were implemented using templates. New CSS classes were added to ipa.css. The HBAC rule details facet has been updated as well. --- install/static/widget.js | 194 +++++++++++++++++++++++++++++------------------ 1 file changed, 121 insertions(+), 73 deletions(-) (limited to 'install/static/widget.js') diff --git a/install/static/widget.js b/install/static/widget.js index f4869c99..1bdb0d4f 100755 --- a/install/static/widget.js +++ b/install/static/widget.js @@ -66,7 +66,7 @@ function ipa_widget(spec) { that.container = container; } - function load(result) { + function load(record) { } function save() { @@ -77,12 +77,16 @@ function ipa_widget(spec) { } that.is_dirty = function() { - if (!that.values) return true; + var values = that.save(); + if (!values && !that.values) return false; + if (!values || !that.values) return true; + if (values.length != that.values.length) return true; for (var i=0; i').appendTo(table); - if (that.scrollable) { - thead.css('display', 'block'); + table.addClass('scrollable'); } + var thead = $('').appendTo(table); + var tr = $('').appendTo(thead); var th = $('', { @@ -566,11 +582,6 @@ function ipa_table_widget(spec) { var tbody = $('').appendTo(table); - if (that.scrollable) { - tbody.css('display', 'block'); - tbody.css('overflow', 'auto'); - } - if (that.height) { tbody.css('height', that.height); } @@ -651,23 +662,28 @@ function ipa_table_widget(spec) { that.empty(); - var values = result[that.name]; - if (!values) return; + that.values = result[that.name]; + if (!that.values) return; - for (var i=0; i').appendTo(container); - that.create(); - that.setup(); + if (that.template) { + var template = IPA.get_template(that.template); + that.container.load( + template, + function(data, text_status, xhr) { + that.setup(); + that.container.dialog({ + 'title': that.title, + 'modal': true, + 'width': that.width, + 'height': that.height, + 'buttons': that.buttons + }); + } + ); - that.container.dialog({ - 'title': that.title, - 'modal': true, - 'width': that.width, - 'buttons': that.buttons - }); + } else { + that.create(); + that.setup(); + + that.container.dialog({ + 'title': that.title, + 'modal': true, + 'width': that.width, + 'height': that.height, + 'buttons': that.buttons + }); + } }; that.option = function(name, value) { @@ -955,7 +991,7 @@ function ipa_adder_dialog(spec) { that.available_table = ipa_table_widget({ name: 'available', scrollable: true, - height: 150 + height: '151px' }); that.available_table.set_columns(that.columns); @@ -965,62 +1001,57 @@ function ipa_adder_dialog(spec) { that.selected_table = ipa_table_widget({ name: 'selected', scrollable: true, - height: 150 + height: '151px' }); that.selected_table.set_columns(that.columns); that.selected_table.init(); + + that.dialog_init(); }; that.create = function() { // do not call that.dialog_create(); - var search_panel = $('
').appendTo(that.container); + var search_panel = $('
', { + 'class': 'adder-dialog-filter' + }).appendTo(that.container); $('', { type: 'text', - name: 'filter' + name: 'filter', + style: 'width: 244px' }).appendTo(search_panel); + search_panel.append(' '); + $('', { type: 'button', name: 'find', value: 'Find' }).appendTo(search_panel); - var results_panel = $('
').appendTo(that.container); - results_panel.css('border', '2px solid rgb(0, 0, 0)'); - results_panel.css('position', 'relative'); - results_panel.css('width', '100%'); - results_panel.css('height', '200px'); - - var available_title = $('
', { - html: 'Available', - style: 'float: left; width: 250px;' - }).appendTo(results_panel); - - var buttons_title = $('
', { - html: ' ', - style: 'float: left; width: 50px;' - }).appendTo(results_panel); - - var selected_title = $('
', { - html: 'Prospective', - style: 'float: left; width: 250px;' - }).appendTo(results_panel); + var results_panel = $('
', { + 'class': 'adder-dialog-results' + }).appendTo(that.container); var available_panel = $('
', { name: 'available', - style: 'clear:both; float: left; width: 250px; height: 150px;' + 'class': 'adder-dialog-available' }).appendTo(results_panel); + $('
', { + html: 'Available', + 'class': 'ui-widget-header' + }).appendTo(available_panel); + that.available_table.create(available_panel); var buttons_panel = $('
', { name: 'buttons', - style: 'float: left; width: 50px; height: 150px; text-align: center;' + 'class': 'adder-dialog-buttons' }).appendTo(results_panel); var p = $('

').appendTo(buttons_panel); @@ -1039,9 +1070,14 @@ function ipa_adder_dialog(spec) { var selected_panel = $('

', { name: 'selected', - style: 'float: left; width: 250px; height: 150px;' + 'class': 'adder-dialog-selected' }).appendTo(results_panel); + $('
', { + html: 'Prospective', + 'class': 'ui-widget-header' + }).appendTo(selected_panel); + that.selected_table.create(selected_panel); }; @@ -1070,8 +1106,7 @@ function ipa_adder_dialog(spec) { 'label': button.val(), 'icon': 'ui-icon-trash', 'click': function() { - var rows = that.selected_table.remove_selected_rows(); - that.available_table.add_rows(rows); + that.remove(); } }); button.replaceWith(that.remove_button); @@ -1081,8 +1116,7 @@ function ipa_adder_dialog(spec) { 'label': button.val(), 'icon': 'ui-icon-plus', 'click': function() { - var rows = that.available_table.remove_selected_rows(); - that.selected_table.add_rows(rows); + that.add(); } }); button.replaceWith(that.add_button); @@ -1092,13 +1126,27 @@ function ipa_adder_dialog(spec) { that.open = function(container) { that.buttons = { - 'Enroll': that.add, - 'Cancel': that.close + 'Enroll': function() { + that.execute(); + }, + 'Cancel': function() { + that.close(); + } }; that.dialog_open(container); }; + that.add = function() { + var rows = that.available_table.remove_selected_rows(); + that.selected_table.add_rows(rows); + }; + + that.remove = function() { + var rows = that.selected_table.remove_selected_rows(); + that.available_table.add_rows(rows); + }; + that.get_filter = function() { return that.filter_field.val(); }; -- cgit