Re: [Freeipa-devel] [PATCH] 006 Uncheck checkboxes in association after deletion

2011-08-19 Thread Petr Vobornik

On 08/18/2011 10:30 PM, Endi Sukma Dewata wrote:

On 8/18/2011 8:18 AM, Petr Vobornik wrote:

https://fedorahosted.org/freeipa/ticket/1639

- added unchecking all checkboxes of table_widget and its derivates to
on_load method.

line '$('input[name=select]', that.tbody).attr('checked', false);' can
be unnecessary because load method is recreating all rows in table. But
I sense, it could be useful later.

As I was implementing it, I noticed that after removing or adding sudo
option it refreshes facet - all other associations. Don't know if it's
a feature or a bug. (sudo.js: 679, 683, 723, 727).


Some issues:

1. In IPA.table_widget when the select all checkbox is changed the
tooltip will change too (see line 1265). When the checkbox is changed
using unselect_all() it doesn't trigger the 'changed' event so the
tooltip is not updated.

done


I think the code in 1265 can be moved into a separate function and the
unselect_all() can call this function too. You can replace the loop with
your code:
$('input[name=select]', that.tbody).attr('checked', false);

done


2. In IPA.association_facet the select all checkbox is not unchecked
because the content is loaded using refresh_table() in line 1017.

done


3. In IPA.search_facet the select all checkbox is unchecked at line 248.
It would be better to call the table.unselect_all() from the
search_facet.load() at line 226.

done


Optional: the code inside search_facet.load() probably could be moved
into table.load() then the search_facet.load() can call table.load().

done


4. About the sudo options refreshing the whole facet, it would be nicer
if we can limit the update to the options table only. This can be fixed
separately.


agree

--
Petr Vobornik
From 708d424b8c303ed7506043b60d744c98ec4818ec Mon Sep 17 00:00:00 2001
From: Petr Vobornik pvobo...@redhat.com
Date: Thu, 18 Aug 2011 13:46:44 +0200
Subject: [PATCH] Uncheck checkboxes in association after deletion

https://fedorahosted.org/freeipa/ticket/1639
---
 install/ui/association.js |2 ++
 install/ui/search.js  |   21 -
 install/ui/sudo.js|1 +
 install/ui/widget.js  |   29 -
 4 files changed, 35 insertions(+), 18 deletions(-)

diff --git a/install/ui/association.js b/install/ui/association.js
index 2c6a1d2003be0668b61b230b8317263b06a822a5..3488b5a938207732d35d4c4855a3f1c4a9899650 100644
--- a/install/ui/association.js
+++ b/install/ui/association.js
@@ -461,6 +461,7 @@ IPA.association_table_widget = function (spec) {
 that.load = function(result) {
 that.values = result[that.name] || [];
 that.reset();
+that.unselect_all();
 };
 
 that.update = function() {
@@ -,6 +1112,7 @@ IPA.association_facet = function (spec) {
 that.table.current_page = 1;
 
 that.table.refresh();
+that.table.unselect_all();
 };
 
 that.refresh = function() {
diff --git a/install/ui/search.js b/install/ui/search.js
index bee55c067fe130139b23fe3f32cd15d3daef5457..454ecf45310fadcbc0f758670609be5647cec95f 100644
--- a/install/ui/search.js
+++ b/install/ui/search.js
@@ -86,6 +86,17 @@ IPA.search_facet = function(spec) {
 that.table.refresh = function() {
 that.refresh();
 };
+
+that.table.load = function(result) {
+that.table.empty();
+
+for (var i = 0; iresult.length; i++) {
+var record = that.table.get_record(result[i], 0);
+that.table.add_record(record);
+}
+
+that.table.unselect_all();
+};
 }
 
 that.create_content = function(container) {
@@ -224,13 +235,7 @@ IPA.search_facet = function(spec) {
 };
 
 function load(result) {
-
-that.table.empty();
-
-for (var i = 0; iresult.length; i++) {
-var record = that.table.get_record(result[i], 0);
-that.table.add_record(record);
-}
+that.table.load(result);
 }
 
 that.load = spec.load || load;
@@ -245,8 +250,6 @@ IPA.search_facet = function(spec) {
 
 that.search_refresh = function(entity){
 
-$('input[type=checkbox]',that.table.thead).removeAttr(checked);
-
 function on_success(data, text_status, xhr) {
 
 that.load(data.result.result);
diff --git a/install/ui/sudo.js b/install/ui/sudo.js
index 280bec4740ef8b860ab3ba332c8bb7402dc44a97..095480a9a54f94cabf45cb1774ce14e5190468d5 100644
--- a/install/ui/sudo.js
+++ b/install/ui/sudo.js
@@ -1139,6 +1139,7 @@ IPA.sudorule_association_table_widget = function(spec) {
 $.merge(that.values, external_values);
 }
 that.reset();
+that.unselect_all();
 };
 
 return that;
diff --git a/install/ui/widget.js b/install/ui/widget.js
index e30cacd7c2eb86ca4ddf96a65a267a58d156b68f..f88bba5c2ae2991c0a2d06d571e6b1c9ebc03ab2 100644
--- a/install/ui/widget.js
+++ b/install/ui/widget.js
@@ -1263,16 +1263,11 @@ IPA.table_widget = function (spec) {
   

Re: [Freeipa-devel] [PATCH] 006 Uncheck checkboxes in association after deletion

2011-08-19 Thread Endi Sukma Dewata

On 8/19/2011 11:50 AM, Petr Vobornik wrote:

done


Pushed to master and ipa-2-1.

--
Endi S. Dewata

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel


[Freeipa-devel] [PATCH] 006 Uncheck checkboxes in association after deletion

2011-08-18 Thread Petr Vobornik

https://fedorahosted.org/freeipa/ticket/1639

- added unchecking all checkboxes of table_widget and its derivates to 
on_load method.


line '$('input[name=select]', that.tbody).attr('checked', false);' can 
be unnecessary because load method is recreating all rows in table. But 
I sense, it could be useful later.


As I was implementing it, I noticed that after removing or adding sudo 
option it refreshes facet - all other associations. Don't know if it's 
a feature or a bug. (sudo.js: 679, 683, 723, 727).

--
Petr Vobornik
From b2113a79520dce7e95f5e70678187fcba814f839 Mon Sep 17 00:00:00 2001
From: Petr Vobornik pvobo...@redhat.com
Date: Thu, 18 Aug 2011 13:46:44 +0200
Subject: [PATCH] Uncheck checkboxes in association after deletion

https://fedorahosted.org/freeipa/ticket/1639
---
 install/ui/association.js |1 +
 install/ui/sudo.js|1 +
 install/ui/widget.js  |7 +++
 3 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/install/ui/association.js b/install/ui/association.js
index 2c6a1d2003be0668b61b230b8317263b06a822a5..36adf499980399e68d37e32bbaac56177de39f2d 100644
--- a/install/ui/association.js
+++ b/install/ui/association.js
@@ -461,6 +461,7 @@ IPA.association_table_widget = function (spec) {
 that.load = function(result) {
 that.values = result[that.name] || [];
 that.reset();
+that.unselect_all();
 };
 
 that.update = function() {
diff --git a/install/ui/sudo.js b/install/ui/sudo.js
index 280bec4740ef8b860ab3ba332c8bb7402dc44a97..095480a9a54f94cabf45cb1774ce14e5190468d5 100644
--- a/install/ui/sudo.js
+++ b/install/ui/sudo.js
@@ -1139,6 +1139,7 @@ IPA.sudorule_association_table_widget = function(spec) {
 $.merge(that.values, external_values);
 }
 that.reset();
+that.unselect_all();
 };
 
 return that;
diff --git a/install/ui/widget.js b/install/ui/widget.js
index e30cacd7c2eb86ca4ddf96a65a267a58d156b68f..c01d21649204f8a55f3c97e5ff7b12ffa936605a 100644
--- a/install/ui/widget.js
+++ b/install/ui/widget.js
@@ -1449,6 +1449,12 @@ IPA.table_widget = function (spec) {
 that.select_changed = function() {
 };
 
+that.unselect_all = function() {
+$('input[name=select]', that.thead).attr('checked', false);
+$('input[name=select]', that.tbody).attr('checked', false);
+that.select_changed();
+};
+
 that.empty = function() {
 that.tbody.empty();
 };
@@ -1464,6 +1470,7 @@ IPA.table_widget = function (spec) {
 var record = that.get_record(result, i);
 that.add_record(record);
 }
+that.unselect_all();
 };
 
 that.save = function() {
-- 
1.7.6

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Re: [Freeipa-devel] [PATCH] 006 Uncheck checkboxes in association after deletion

2011-08-18 Thread Endi Sukma Dewata

On 8/18/2011 8:18 AM, Petr Vobornik wrote:

https://fedorahosted.org/freeipa/ticket/1639

- added unchecking all checkboxes of table_widget and its derivates to
on_load method.

line '$('input[name=select]', that.tbody).attr('checked', false);' can
be unnecessary because load method is recreating all rows in table. But
I sense, it could be useful later.

As I was implementing it, I noticed that after removing or adding sudo
option it refreshes facet - all other associations. Don't know if it's
a feature or a bug. (sudo.js: 679, 683, 723, 727).


Some issues:

1. In IPA.table_widget when the select all checkbox is changed the 
tooltip will change too (see line 1265). When the checkbox is changed 
using unselect_all() it doesn't trigger the 'changed' event so the 
tooltip is not updated.


I think the code in 1265 can be moved into a separate function and the 
unselect_all() can call this function too. You can replace the loop with 
your code:

  $('input[name=select]', that.tbody).attr('checked', false);

2. In IPA.association_facet the select all checkbox is not unchecked 
because the content is loaded using refresh_table() in line 1017.


3. In IPA.search_facet the select all checkbox is unchecked at line 248. 
It would be better to call the table.unselect_all() from the 
search_facet.load() at line 226.


Optional: the code inside search_facet.load() probably could be moved 
into table.load() then the search_facet.load() can call table.load().


4. About the sudo options refreshing the whole facet, it would be nicer 
if we can limit the update to the options table only. This can be fixed 
separately.


--
Endi S. Dewata

___
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel