Re: [Freeipa-devel] [PATCH] 118-119 DNS forward policy: checkboxes changed to radio buttons

2012-04-10 Thread Petr Vobornik

On 04/10/2012 03:39 PM, Endi Sukma Dewata wrote:

On 4/5/2012 10:58 AM, Petr Vobornik wrote:

Revised patch 118 attached.
I used:
* Forward first
* Forward only

and set 'default_value' to 'first'. So there would be always some value
checked, which indicates what is actually used. There is a little issue
with undo button if policy is not set '' because default_value !== ''.

I did this kinda in the hurry, so I hope I didn't missed anything
crucial. Will be back on Tuesday.


ACK on both patches.


Pushed to master, ipa-2-2.

--
Petr Vobornik

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


Re: [Freeipa-devel] [PATCH] 118-119 DNS forward policy: checkboxes changed to radio buttons

2012-04-10 Thread Endi Sukma Dewata

On 4/5/2012 10:58 AM, Petr Vobornik wrote:

Revised patch 118 attached.
I used:
* Forward first
* Forward only

and set 'default_value' to 'first'. So there would be always some value
checked, which indicates what is actually used. There is a little issue
with undo button if policy is not set '' because default_value !== ''.

I did this kinda in the hurry, so I hope I didn't missed anything
crucial. Will be back on Tuesday.


ACK on both patches.

--
Endi S. Dewata

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


Re: [Freeipa-devel] [PATCH] 118-119 DNS forward policy: checkboxes changed to radio buttons

2012-04-05 Thread Petr Vobornik

Revised patch 118 attached.
I used:
* Forward first
* Forward only

and set 'default_value' to 'first'. So there would be always some value 
checked, which indicates what is actually used. There is a little issue 
with undo button if policy is not set '' because default_value !== ''.


I did this kinda in the hurry, so I hope I didn't missed anything 
crucial. Will be back on Tuesday.


On 04/05/2012 04:56 PM, Endi Sukma Dewata wrote:

On 4/4/2012 5:36 AM, Petr Vobornik wrote:

DNS forward policy fields were using mutually exclusive checkboxes. Such
behavior is unusual for users.

Checkboxes were changed to radios with new option 'none/default' to set
empty value ''.

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

Second patch removes mutex option from checkboxes. Not sure if needed.


Patch #118 might need some revision.

According to DNS docs the default forward policy is "first":

forward is only relevant in conjunction with a valid forwarders
statement. If set to 'only' the server will only forward queries,
if set to 'first' (default) it will send the queries to the forwarder
and if not answered will attempt to answer the query.

http://www.zytrax.com/books/dns/ch7/queries.html

So there are actually only 2 possible policies: first and only. Ideally
we should present 2 radio buttons:
* Forward first
* Forward only

However, in IPA the attribute is optional, so we have 3 ways to define
the policy:
* Default
* Forward first
* Forward only

This is OK and will match the CLI (I can ACK this), but people might be
asking 'What is the default policy?' and I'm not sure we document it
clearly.

If we're sure IPA's default forwarding policy is equivalent to DNS
default forwarding policy (i.e. first), the other alternative is to just
present 2 options like this:
* Forward first (default)
* Forward only

When loading the data, if there's no policy defined the UI will select
'first' by default. When saving the data, the UI can either store the
'first' value or normalize it into empty value.

Another thing, let's not use 'none' because it could be interpreted as
'do not forward'.

Also, it would be better to use a long description like "Forward first"
instead of just "first". In the DNS configuration it's meant to be read
like the longer description:

forward first;
forward only;

In the current UI we have "Forward policy" label which doesn't go well
with "first" or "only".

Patch #119 is ACKed, but feel free to keep the functionality if you
think it could be useful someday.




--
Petr Vobornik
From b652c7c55a8509c361c3b8b7ddaee10da2efab87 Mon Sep 17 00:00:00 2001
From: Petr Vobornik 
Date: Wed, 4 Apr 2012 10:49:16 +0200
Subject: [PATCH] DNS forward policy: checkboxes changed to radio buttons

DNS forward policy fields were using mutually exclusive checkboxes. Such behavior is unusual for users.

Checkboxes were changed to radios.

https://fedorahosted.org/freeipa/ticket/2599
---
 install/ui/dns.js  |   30 --
 install/ui/ipa.js  |   21 +
 install/ui/test/data/ipa_init.json |2 ++
 ipalib/plugins/internal.py |2 ++
 4 files changed, 41 insertions(+), 14 deletions(-)

diff --git a/install/ui/dns.js b/install/ui/dns.js
index 6a684b9ea207feee2425c8f14dd398918fcaca6b..0d7f03f20c0cf6a217a3fa3717bdd2f9bbefc1c9 100644
--- a/install/ui/dns.js
+++ b/install/ui/dns.js
@@ -52,10 +52,19 @@ IPA.dns.config_entity = function(spec) {
 validators: [IPA.dnsforwarder_validator()]
 },
 {
-type: 'checkboxes',
+type: 'radio',
 name: 'idnsforwardpolicy',
-mutex: true,
-options: IPA.create_options(['only', 'first'])
+default_value: 'first',
+options: [
+{
+value: 'first',
+label: IPA.messages.objects.dnsconfig.forward_first
+},
+{
+value: 'only',
+label: IPA.messages.objects.dnsconfig.forward_only
+}
+]
 },
 'idnszonerefresh'
 ]
@@ -170,10 +179,19 @@ IPA.dns.zone_entity = function(spec) {
 validators: [IPA.dnsforwarder_validator()]
 },
 {
-type: 'checkboxes',
+type: 'radio',
 name: 'idnsforwardpolicy',
-mutex: true,
-options: IPA.create_options(['only', 'first'])
+default_value: 'first',
+opt

Re: [Freeipa-devel] [PATCH] 118-119 DNS forward policy: checkboxes changed to radio buttons

2012-04-05 Thread Endi Sukma Dewata

On 4/4/2012 5:36 AM, Petr Vobornik wrote:

DNS forward policy fields were using mutually exclusive checkboxes. Such
behavior is unusual for users.

Checkboxes were changed to radios with new option 'none/default' to set
empty value ''.

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

Second patch removes mutex option from checkboxes. Not sure if needed.


Patch #118 might need some revision.

According to DNS docs the default forward policy is "first":

  forward is only relevant in conjunction with a valid forwarders
  statement. If set to 'only' the server will only forward queries,
  if set to 'first' (default) it will send the queries to the forwarder
  and if not answered will attempt to answer the query.

  http://www.zytrax.com/books/dns/ch7/queries.html

So there are actually only 2 possible policies: first and only. Ideally 
we should present 2 radio buttons:

* Forward first
* Forward only

However, in IPA the attribute is optional, so we have 3 ways to define 
the policy:

* Default
* Forward first
* Forward only

This is OK and will match the CLI (I can ACK this), but people might be 
asking 'What is the default policy?' and I'm not sure we document it 
clearly.


If we're sure IPA's default forwarding policy is equivalent to DNS 
default forwarding policy (i.e. first), the other alternative is to just 
present 2 options like this:

* Forward first (default)
* Forward only

When loading the data, if there's no policy defined the UI will select 
'first' by default. When saving the data, the UI can either store the 
'first' value or normalize it into empty value.


Another thing, let's not use 'none' because it could be interpreted as 
'do not forward'.


Also, it would be better to use a long description like "Forward first" 
instead of just "first". In the DNS configuration it's meant to be read 
like the longer description:


  forward first;
  forward only;

In the current UI we have "Forward policy" label which doesn't go well 
with "first" or "only".


Patch #119 is ACKed, but feel free to keep the functionality if you 
think it could be useful someday.


--
Endi S. Dewata

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


Re: [Freeipa-devel] [PATCH] 118-119 DNS forward policy: checkboxes changed to radio buttons

2012-04-04 Thread yi zhang

On 04/04/2012 03:36 AM, Petr Vobornik wrote:
DNS forward policy fields were using mutually exclusive checkboxes. 
Such behavior is unusual for users.


Checkboxes were changed to radios with new option 'none/default' to 
set empty value ''.


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

thanks for fixing this :)

Yi


Second patch removes mutex option from checkboxes. Not sure if needed.


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



--

~
| Yi Zhang  |
| QA @ Mountain View, California|
| Cell: 408-509-6375|
~

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

[Freeipa-devel] [PATCH] 118-119 DNS forward policy: checkboxes changed to radio buttons

2012-04-04 Thread Petr Vobornik
DNS forward policy fields were using mutually exclusive checkboxes. Such 
behavior is unusual for users.


Checkboxes were changed to radios with new option 'none/default' to set 
empty value ''.


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

Second patch removes mutex option from checkboxes. Not sure if needed.
--
Petr Vobornik
From 99eec2431d4e98e16b339f6103318ab96af34843 Mon Sep 17 00:00:00 2001
From: Petr Vobornik 
Date: Wed, 4 Apr 2012 10:49:16 +0200
Subject: [PATCH] DNS forward policy: checkboxes changed to radio buttons

DNS forward policy fields were using mutually exclusive checkboxes. Such behavior is unusual for users.

Checkboxes were changed to radios with new option 'none/default' to set empty value ''.

https://fedorahosted.org/freeipa/ticket/2599
---
 install/ui/dns.js  |   22 --
 install/ui/ipa.js  |   21 +
 install/ui/test/data/ipa_init.json |1 +
 ipalib/plugins/internal.py |1 +
 4 files changed, 31 insertions(+), 14 deletions(-)

diff --git a/install/ui/dns.js b/install/ui/dns.js
index 6a684b9ea207feee2425c8f14dd398918fcaca6b..5a0f5194d9c91434608bfec904368dd3d59c4f9a 100644
--- a/install/ui/dns.js
+++ b/install/ui/dns.js
@@ -52,10 +52,15 @@ IPA.dns.config_entity = function(spec) {
 validators: [IPA.dnsforwarder_validator()]
 },
 {
-type: 'checkboxes',
+type: 'radio',
 name: 'idnsforwardpolicy',
-mutex: true,
-options: IPA.create_options(['only', 'first'])
+options: IPA.create_options([
+{
+value: '',
+label: IPA.messages.widget.none_default
+},
+'only', 'first'
+])
 },
 'idnszonerefresh'
 ]
@@ -170,10 +175,15 @@ IPA.dns.zone_entity = function(spec) {
 validators: [IPA.dnsforwarder_validator()]
 },
 {
-type: 'checkboxes',
+type: 'radio',
 name: 'idnsforwardpolicy',
-mutex: true,
-options: IPA.create_options(['only', 'first'])
+options: IPA.create_options([
+{
+value: '',
+label: IPA.messages.widget.none_default
+},
+'only', 'first'
+])
 },
 {
 type: 'checkbox',
diff --git a/install/ui/ipa.js b/install/ui/ipa.js
index be87481018654c6803b9c610df3723566a4efac2..eeac030531302fffc0af79e70a835dca8120f674 100644
--- a/install/ui/ipa.js
+++ b/install/ui/ipa.js
@@ -1516,17 +1516,22 @@ IPA.limit_text = function(value, max_length) {
 return limited_text;
 };
 
-IPA.create_options = function(labels, values) {
-
-if(!values) values = labels;
+IPA.create_options = function(values) {
 
 var options = [];
 
-for (var i=0; iFrom 596ce427047f80dfd965204e13edab5ece00271e Mon Sep 17 00:00:00 2001
From: Petr Vobornik 
Date: Wed, 4 Apr 2012 11:04:33 +0200
Subject: [PATCH] Removed mutex option from checkboxes

Mutually exclusive checkboxes were unusual. They are not in use anymore. The functionality is removed.

https://fedorahosted.org/freeipa/ticket/2599
---
 install/ui/widget.js |   10 --
 1 files changed, 0 insertions(+), 10 deletions(-)

diff --git a/install/ui/widget.js b/install/ui/widget.js
index 4ddff81f9c9a922be2ea3a1454d9f4c8f166d6c9..ff77597479a3799a47fee49d66d2aa6ddfe7ff64 100644
--- a/install/ui/widget.js
+++ b/install/ui/widget.js
@@ -660,7 +660,6 @@ IPA.checkboxes_widget = function (spec) {
 
 that.options = spec.options || [];
 that.direction = spec.direction || 'vertical';
-that.mutex = spec.mutex;
 
 that.create = function(container) {
 
@@ -695,15 +694,6 @@ IPA.checkboxes_widget = function (spec) {
 
 var input = $('input[name="'+that.name+'"]', that.container);
 input.change(function() {
-
-var checkbox = $(this);
-var checked = checkbox.is(':checked');
-
-if (that.mutex && checked) {
-that.clear();
-checkbox.attr('checked', true);
-}
-
 that.value_changed.notify([that.save()], that);
 });
 
-- 
1.7.7.6

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