Re: [Freeipa-devel] [PATCH] 012 Fixed inconsistency in enabling delete buttons
On 09/07/2011 09:06 PM, Endi Sukma Dewata wrote: On 9/7/2011 7:16 AM, Petr Vobornik wrote: https://fedorahosted.org/freeipa/ticket/1640 .. One issue, in HBAC/sudo rules details page if the category is changed from 'all' to 'specific', the Delete button will be enabled although there is no entries selected. See the set_enabled() in IPA.association_table_widget. I think if the parameter is true it should enable only the Add button. If the parameter is false it disable both Add and Delete button and call unselect_all(). Fixed -- Petr Vobornik From ef769ee328dfd0d2293ec3095ddf021eea1fd3ed Mon Sep 17 00:00:00 2001 From: Petr Vobornik pvobo...@redhat.com Date: Wed, 7 Sep 2011 13:57:47 +0200 Subject: [PATCH] Fixed inconsistency in enabling delete buttons https://fedorahosted.org/freeipa/ticket/1640 On the HBAC Rules page, where the rules are listed, if no rule is selected, the Delete button is not enabled, and cannot be clicked on. But edit a Rule, and Delete button is enabled in the available sections - regardless of, if an object is selected to be deleted or not, or even if there is no object to be selected to delete. One can click on this button...but then - there is no message indicating that something should be selected for deletion for this button to do anything. Notes: * fixed association_table_widget and association_facet --- install/ui/association.js | 40 +++- 1 files changed, 35 insertions(+), 5 deletions(-) diff --git a/install/ui/association.js b/install/ui/association.js index 1c9776b0e6c596be4dd07665b141891d2e7d4ba0..b999f0eade03bc2ab2f2a55d7baadb008ce0d9b7 100644 --- a/install/ui/association.js +++ b/install/ui/association.js @@ -352,24 +352,25 @@ IPA.association_table_widget = function (spec) { that.table_create(container); -var remove_button = IPA.action_button({ +that.remove_button = IPA.action_button({ name: 'remove', label: IPA.messages.buttons.remove, icon: 'remove-icon', +'class': 'action-button-disabled', click: function() { -if (!remove_button.hasClass('action-button-disabled')) { +if (!that.remove_button.hasClass('action-button-disabled')) { that.remove_handler(); } return false; } }).appendTo(that.buttons); -var add_button = IPA.action_button({ +that.add_button = IPA.action_button({ name: 'add', label: IPA.messages.buttons.add, icon: 'add-icon', click: function() { -if (!add_button.hasClass('action-button-disabled')) { +if (!that.add_button.hasClass('action-button-disabled')) { that.add_handler(); } return false; @@ -420,9 +421,25 @@ IPA.association_table_widget = function (spec) { that.set_enabled = function(enabled) { that.table_set_enabled(enabled); if (enabled) { -$('.action-button', that.table).removeClass('action-button-disabled'); +if(that.add_button) { +that.add_button.removeClass('action-button-disabled'); +} } else { $('.action-button', that.table).addClass('action-button-disabled'); +that.unselect_all(); +} +}; + +that.select_changed = function() { + +var values = that.get_selected_values(); + +if (that.remove_button) { +if (values.length === 0) { +that.remove_button.addClass('action-button-disabled'); +} else { +that.remove_button.removeClass('action-button-disabled'); +} } }; @@ -829,6 +846,18 @@ IPA.association_facet = function (spec) { that.refresh_table(); }; +that.table.select_changed = function() { + +var values = that.table.get_selected_values(); + +if (that.remove_button) { +if (values.length === 0) { +that.remove_button.addClass('action-button-disabled'); +} else { +that.remove_button.removeClass('action-button-disabled'); +} +} +}; } that.create_header = function(container) { @@ -842,6 +871,7 @@ IPA.association_facet = function (spec) { name: 'remove', label: IPA.messages.buttons.remove, icon: 'remove-icon', +'class': 'action-button-disabled', click: function() { if (!that.remove_button.hasClass('action-button-disabled')) { that.show_remove_dialog(); -- 1.7.6 ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
[Freeipa-devel] [PATCH] 012 Fixed inconsistency in enabling delete buttons
https://fedorahosted.org/freeipa/ticket/1640 On the HBAC Rules page, where the rules are listed, if no rule is selected, the Delete button is not enabled, and cannot be clicked on. But edit a Rule, and Delete button is enabled in the available sections - regardless of, if an object is selected to be deleted or not, or even if there is no object to be selected to delete. One can click on this button...but then - there is no message indicating that something should be selected for deletion for this button to do anything. Milestone: 3.0 Core Effort Backlog -- Petr Vobornik From b3a9038b037385a2f037615d83f4e0982d74fbf4 Mon Sep 17 00:00:00 2001 From: Petr Vobornik pvobo...@redhat.com Date: Wed, 7 Sep 2011 13:57:47 +0200 Subject: [PATCH] Fixed inconsistency in enabling delete buttons https://fedorahosted.org/freeipa/ticket/1640 On the HBAC Rules page, where the rules are listed, if no rule is selected, the Delete button is not enabled, and cannot be clicked on. But edit a Rule, and Delete button is enabled in the available sections - regardless of, if an object is selected to be deleted or not, or even if there is no object to be selected to delete. One can click on this button...but then - there is no message indicating that something should be selected for deletion for this button to do anything. Notes: * fixed association_table_widget and association_facet --- install/ui/association.js | 35 +++ 1 files changed, 31 insertions(+), 4 deletions(-) diff --git a/install/ui/association.js b/install/ui/association.js index 1c9776b0e6c596be4dd07665b141891d2e7d4ba0..f5559a4fe09f8032f52638f4dde33a7d7980df34 100644 --- a/install/ui/association.js +++ b/install/ui/association.js @@ -352,24 +352,25 @@ IPA.association_table_widget = function (spec) { that.table_create(container); -var remove_button = IPA.action_button({ +that.remove_button = IPA.action_button({ name: 'remove', label: IPA.messages.buttons.remove, icon: 'remove-icon', +'class': 'action-button-disabled', click: function() { -if (!remove_button.hasClass('action-button-disabled')) { +if (!that.remove_button.hasClass('action-button-disabled')) { that.remove_handler(); } return false; } }).appendTo(that.buttons); -var add_button = IPA.action_button({ +that.add_button = IPA.action_button({ name: 'add', label: IPA.messages.buttons.add, icon: 'add-icon', click: function() { -if (!add_button.hasClass('action-button-disabled')) { +if (!that.add_button.hasClass('action-button-disabled')) { that.add_handler(); } return false; @@ -426,6 +427,19 @@ IPA.association_table_widget = function (spec) { } }; +that.select_changed = function() { + +var values = that.get_selected_values(); + +if (that.remove_button) { +if (values.length === 0) { +that.remove_button.addClass('action-button-disabled'); +} else { +that.remove_button.removeClass('action-button-disabled'); +} +} +}; + that.get_records = function(on_success, on_error) { var length = that.values.length; @@ -829,6 +843,18 @@ IPA.association_facet = function (spec) { that.refresh_table(); }; +that.table.select_changed = function() { + +var values = that.table.get_selected_values(); + +if (that.remove_button) { +if (values.length === 0) { +that.remove_button.addClass('action-button-disabled'); +} else { +that.remove_button.removeClass('action-button-disabled'); +} +} +}; } that.create_header = function(container) { @@ -842,6 +868,7 @@ IPA.association_facet = function (spec) { name: 'remove', label: IPA.messages.buttons.remove, icon: 'remove-icon', +'class': 'action-button-disabled', click: function() { if (!that.remove_button.hasClass('action-button-disabled')) { that.show_remove_dialog(); -- 1.7.6 ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel
Re: [Freeipa-devel] [PATCH] 012 Fixed inconsistency in enabling delete buttons
On 9/7/2011 7:16 AM, Petr Vobornik wrote: https://fedorahosted.org/freeipa/ticket/1640 On the HBAC Rules page, where the rules are listed, if no rule is selected, the Delete button is not enabled, and cannot be clicked on. But edit a Rule, and Delete button is enabled in the available sections - regardless of, if an object is selected to be deleted or not, or even if there is no object to be selected to delete. One can click on this button...but then - there is no message indicating that something should be selected for deletion for this button to do anything. Milestone: 3.0 Core Effort Backlog One issue, in HBAC/sudo rules details page if the category is changed from 'all' to 'specific', the Delete button will be enabled although there is no entries selected. See the set_enabled() in IPA.association_table_widget. I think if the parameter is true it should enable only the Add button. If the parameter is false it disable both Add and Delete button and call unselect_all(). -- Endi S. Dewata ___ Freeipa-devel mailing list Freeipa-devel@redhat.com https://www.redhat.com/mailman/listinfo/freeipa-devel