diff --git a/install/static/associate.js b/install/static/associate.js index fbd1c63c9..a6edf748f 100644 --- a/install/static/associate.js +++ b/install/static/associate.js @@ -152,9 +152,13 @@ function ipa_association_adder_dialog(spec) { var pkey_name = IPA.metadata[that.other_entity].primary_key; that.create_column({ name: pkey_name, - primary_key: true + label: IPA.metadata[that.other_entity].label, + primary_key: true, + width: '200px' }); } + + that.adder_dialog_init(); }; that.search = function() { @@ -170,7 +174,7 @@ function ipa_association_adder_dialog(spec) { } var filter = that.get_filter(); - ipa_cmd('find', [filter], {}, on_success, null, that.other_entity); + ipa_cmd('find', [filter], {'all': true}, on_success, null, that.other_entity); }; that.add = function() { @@ -252,13 +256,11 @@ function ipa_association_table_widget(spec) { that.facet = spec.facet; that.other_entity = spec.other_entity; - that.superior_create = that.superior('create'); + that.add = spec.add; + that.remove = spec.remove; that.create = function(container) { - that.member_attribute = ipa_get_member_attribute( - that.entity_name, that.other_entity); - if (!that.columns.length) { var pkey_name = IPA.metadata[that.other_entity].primary_key; @@ -290,7 +292,7 @@ function ipa_association_table_widget(spec) { }; } - that.superior_create(container); + that.table_create(container); var action_panel = that.facet.get_action_panel(); var li = $('.action-controls', action_panel); @@ -320,94 +322,15 @@ function ipa_association_table_widget(spec) { button.replaceWith(ipa_button({ 'label': button.val(), 'icon': 'ui-icon-trash', - 'click': function() { that.remove(that.container); } + 'click': function() { that.remove(); } })); button = $('input[name=add]', action_panel); button.replaceWith(ipa_button({ 'label': button.val(), 'icon': 'ui-icon-plus', - 'click': function() { that.add(that.container) } + 'click': function() { that.add() } })); - - var entity = IPA.get_entity(that.entity_name); - var association = entity.get_association(that.other_entity); - - if (association && association.associator == 'serial') { - that.associator = serial_associator; - } else { - that.associator = bulk_associator; - } - - that.add_method = association ? association.add_method : null; - that.delete_method = association ? association.delete_method : null; - - that.add_method = that.add_method || "add_member"; - that.delete_method = that.delete_method || "remove_member"; - }; - - that.add = function(container) { - - var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; - var label = IPA.metadata[that.other_entity].label; - var title = 'Enroll '+that.entity_name+' '+pkey+' in '+label; - - var dialog = ipa_association_adder_dialog({ - 'title': title, - 'entity_name': that.entity_name, - 'pkey': pkey, - 'other_entity': that.other_entity, - 'associator': that.associator, - 'method': that.add_method, - 'on_success': function() { - that.refresh(); - dialog.close(); - }, - 'on_error': function() { - that.refresh(); - dialog.close(); - } - }); - - dialog.init(); - - dialog.open(that.container); - }; - - that.remove = function(container) { - - var values = that.get_selected_values(); - - if (!values.length) { - alert('Select '+that.label+' to be removed.'); - return; - } - - var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; - var label = IPA.metadata[that.other_entity].label; - var title = 'Remove '+label+' from '+that.entity_name+' '+pkey; - - var dialog = ipa_association_deleter_dialog({ - 'title': title, - 'entity_name': that.entity_name, - 'pkey': pkey, - 'other_entity': that.other_entity, - 'values': values, - 'associator': that.associator, - 'method': that.delete_method, - 'on_success': function() { - that.refresh(); - dialog.close(); - }, - 'on_error': function() { - that.refresh(); - dialog.close(); - } - }); - - dialog.init(); - - dialog.open(that.container); }; that.get_records = function(pkeys, on_success, on_error) { @@ -443,13 +366,14 @@ function ipa_association_table_widget(spec) { that.tbody.empty(); var pkeys = data.result.result[that.name]; + if (!pkeys) return; if (that.columns.length == 1) { // show pkey only var name = that.columns[0].name; for (var i=0; i', { - 'id': that.entity_name+'-'+that.other_entity, - html: $('

',{ html: header_message }) - }).appendTo(container); - that.table = ipa_association_table_widget({ 'id': that.entity_name+'-'+that.other_entity, 'name': that.name, @@ -540,6 +488,25 @@ function ipa_association_facet(spec) { that.table.set_columns(that.columns); } + that.table.add = function() { that.add(); }; + that.table.remove = function() { that.remove() }; + + that.facet_init(); + }; + + that.create = function(container) { + + that.pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; + + //TODO I18N + var header_message = that.other_entity + '(s) enrolled in ' + + that.entity_name + ' ' + that.pkey; + + $('
', { + 'id': that.entity_name+'-'+that.other_entity, + html: $('

',{ html: header_message }) + }).appendTo(container); + var span = $('', { 'name': 'association' }).appendTo(container); that.table.create(span); @@ -554,6 +521,74 @@ function ipa_association_facet(spec) { that.table.setup(span); }; + that.add = function() { + + var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; + var label = IPA.metadata[that.other_entity] ? IPA.metadata[that.other_entity].label : that.other_entity; + var title = 'Enroll '+that.entity_name+' '+pkey+' in '+label; + + var dialog = ipa_association_adder_dialog({ + 'title': title, + 'entity_name': that.entity_name, + 'pkey': pkey, + 'other_entity': that.other_entity, + 'associator': that.associator, + 'method': that.add_method, + 'on_success': function() { + that.refresh(); + dialog.close(); + }, + 'on_error': function() { + that.refresh(); + dialog.close(); + } + }); + + if (that.adder_columns.length) { + dialog.set_columns(that.adder_columns); + } + + dialog.init(); + + dialog.open(that.container); + }; + + that.remove = function() { + + var label = IPA.metadata[that.other_entity] ? IPA.metadata[that.other_entity].label : that.other_entity; + var values = that.table.get_selected_values(); + + if (!values.length) { + alert('Select '+label+' to be removed.'); + return; + } + + var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || ''; + var title = 'Remove '+label+' from '+that.entity_name+' '+pkey; + + var dialog = ipa_association_deleter_dialog({ + 'title': title, + 'entity_name': that.entity_name, + 'pkey': pkey, + 'other_entity': that.other_entity, + 'values': values, + 'associator': that.associator, + 'method': that.delete_method, + 'on_success': function() { + that.refresh(); + dialog.close(); + }, + 'on_error': function() { + that.refresh(); + dialog.close(); + } + }); + + dialog.init(); + + dialog.open(that.container); + }; + that.refresh = function(){ that.table.refresh(); }; diff --git a/install/static/entity.js b/install/static/entity.js index 9b62ce375..6e2b501b0 100644 --- a/install/static/entity.js +++ b/install/static/entity.js @@ -377,6 +377,11 @@ IPA.nested_tabs = function(entity_name){ var siblings = []; + if (!IPA.tab_set) { + siblings.push(entity_name); + return siblings; + } + for (var top_tab_index = 0; top_tab_index < IPA.tab_set.length; top_tab_index += 1){ @@ -479,20 +484,7 @@ function ipa_facet_create_action_panel(container) { for (var i=1; i', { @@ -507,7 +499,7 @@ function ipa_facet_create_action_panel(container) { return false; } }).appendTo(ul); - } + } } /*When we land on the search page, disable all facets that require a pkey until one is selected*/ diff --git a/install/static/group.js b/install/static/group.js index 0dfae2fdc..bcac40982 100644 --- a/install/static/group.js +++ b/install/static/group.js @@ -193,6 +193,19 @@ function ipa_group_member_user_facet(spec) { that.create_column({name: 'telephonenumber', label: 'Phone'}); that.create_column({name: 'title', label: 'Job Title'}); + that.create_adder_column({ + name: 'cn', + label: 'Name', + width: '100px' + }); + + that.create_adder_column({ + name: 'uid', + label: 'Login', + primary_key: true, + width: '100px' + }); + that.association_facet_init(); }; diff --git a/install/static/hbac.js b/install/static/hbac.js index 0d6ed7373..e2c1266c4 100755 --- a/install/static/hbac.js +++ b/install/static/hbac.js @@ -884,7 +884,7 @@ function ipa_hbac_accesstime_widget(spec) { for (var i=0; values && i').appendTo(table); + if (that.scrollable) { + thead.css('display', 'block'); + } + var tr = $('').appendTo(thead); var th = $('', { - 'style': 'width: 25px;' + 'style': 'width: 22px;' }).appendTo(tr); $('', { @@ -511,8 +519,21 @@ function ipa_table_widget(spec) { for (var i=0; i').appendTo(tr); + if (that.scrollable && (i == that.columns.length-1)) { + if (column.width) { + var width = parseInt(column.width.substring(0, column.width.length-2)); + width += 16; + th.css('width', width+'px'); + } + } else { + if (column.width) { + th.css('width', column.width); + } + } + var label = column.label; $('', { @@ -530,9 +551,20 @@ 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); + } + tr = $('').appendTo(tbody); - var td = $('').appendTo(tr); + var td = $('', { + 'style': 'width: 22px;' + }).appendTo(tr); $('', { 'type': 'checkbox', @@ -541,10 +573,15 @@ function ipa_table_widget(spec) { }).appendTo(td); for (var i=0; i').appendTo(tr); + if (column.width) { + td.css('width', column.width); + } $('', { - 'name': that.columns[i].name + 'name': column.name }).appendTo(td); } @@ -591,16 +628,20 @@ function ipa_table_widget(spec) { that.row.detach(); }; + that.empty = function() { + that.tbody.empty(); + }; + that.load = function(result) { - that.tbody.empty(); + that.empty(); var values = result[that.name]; if (!values) return; for (var i=0; i').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_panel = $('
').appendTo(results_panel); - available_panel.css('float', 'left'); + var available_title = $('
', { + html: 'Available', + style: 'float: left; width: 250px;' + }).appendTo(results_panel); - $('
', { - text: 'Available' - }).appendTo(available_panel); + var buttons_title = $('
', { + html: ' ', + style: 'float: left; width: 50px;' + }).appendTo(results_panel); - that.available_list = $('', { @@ -918,36 +1018,32 @@ function ipa_adder_dialog(spec) { value: '>>' }).appendTo(p); - var selected_panel = $('
').appendTo(results_panel); - selected_panel.css('float', 'left'); + var selected_panel = $('
', { + name: 'selected', + style: 'float: left; width: 250px; height: 150px;' + }).appendTo(results_panel); - $('
', { - text: 'Prospective' - }).appendTo(selected_panel); - - that.selected_list = $('