On 9/23/2011 4:31 AM, Petr Vobornik wrote:
On 09/22/2011 09:15 PM, Endi Sukma Dewata wrote:

I've split the patch into two: 4a is the revised original patch,
ACK

4b is the additional cleanup for the undo.
you missed: dns.js:562 and host.js:406 . Beside this it's OK.

Fixed. We actually don't need the custom widget for force anymore, but this can be cleaned up again later.

Pushed to master and ipa-2-1.

--
Endi S. Dewata
From 3812066719901993737b5b7ae000414f1dc8300e Mon Sep 17 00:00:00 2001
From: Endi S. Dewata <edew...@redhat.com>
Date: Thu, 22 Sep 2011 11:44:41 -0500
Subject: [PATCH] Removed undo flags from dialog field specs.

Since the undo flag is now automatically set to false in dialogs,
it's no longer necessary to specify it in the field specs.

Ticket #1394
---
 install/ui/aci.js       |   40 ++++++++++++++--------------------------
 install/ui/automount.js |   19 +++++--------------
 install/ui/dns.js       |   29 ++++++++++++-----------------
 install/ui/entitle.js   |   16 +++++-----------
 install/ui/group.js     |    1 -
 install/ui/host.js      |   16 +++++-----------
 install/ui/policy.js    |    3 +--
 install/ui/service.js   |    9 +++------
 install/ui/sudo.js      |    3 +--
 install/ui/user.js      |   11 +++++------
 10 files changed, 51 insertions(+), 96 deletions(-)

diff --git a/install/ui/aci.js b/install/ui/aci.js
index 13fbc7d139e5ef69f6974b9b4d32b160a2eeebc5..929e13d4b3af3303c32d2122d8f2147afb99b185 100644
--- a/install/ui/aci.js
+++ b/install/ui/aci.js
@@ -69,22 +69,18 @@ IPA.entity_factories.permission = function() {
                 {
                     name: 'general',
                     fields: [
-                        {
-                            name: 'cn',
-                            undo: false
-                        },
+                        'cn',
                         {
                             factory: IPA.rights_widget,
                             name: 'permissions',
-                            join: true, undo: false
+                            join: true
                         }
                     ]
                 },
                 {
                     factory: IPA.target_section,
                     name: 'target',
-                    label: IPA.messages.objects.permission.target,
-                    undo: false
+                    label: IPA.messages.objects.permission.target
                 }
             ]
         }).
@@ -173,8 +169,7 @@ IPA.entity_factories.selfservice = function() {
                 'aciname',
                 {factory:IPA.attributes_widget,
                  object_type:'user',
-                 name:'attrs',
-                 undo: false
+                 name:'attrs'
                 }]
         }).
         build();
@@ -218,21 +213,20 @@ IPA.entity_factories.delegation = function() {
                     factory: IPA.entity_select_widget,
                     name: 'group',
                     other_entity: 'group',
-                    other_field: 'cn',
-                    undo: false
+                    other_field: 'cn'
                 },
                 {
                     factory: IPA.entity_select_widget,
                     name: 'memberof',
                     other_entity: 'group',
                     other_field: 'cn',
-                    join: true,
-                    undo: false
+                    join: true
                 },
                 {
-                    factory:IPA.attributes_widget,
-                    name: 'attrs', object_type: 'user',
-                    join: true, undo: false
+                    factory: IPA.attributes_widget,
+                    name: 'attrs',
+                    object_type: 'user',
+                    join: true
                 }]
         }).
         build();
@@ -400,7 +394,6 @@ IPA.target_section = function(spec) {
     spec = spec || {};
 
     var that = IPA.details_section(spec);
-    that.undo = typeof spec.undo == 'undefined' ? true : spec.undo;
 
     var target_types = [
         {
@@ -504,31 +497,26 @@ IPA.target_section = function(spec) {
     var init = function() {
         that.filter_text = IPA.text_widget({
             name: 'filter',
-            undo: that.undo,
             entity: spec.entity
         });
         that.subtree_textarea = IPA.textarea_widget({
             entity: spec.entity,
             name: 'subtree',
-            cols: 30, rows: 1,
-            undo: that.undo
+            cols: 30, rows: 1
         });
         that.group_select = IPA.entity_select_widget({
             entity: spec.entity,
             name: 'targetgroup',
             other_entity: 'group',
-            other_field: 'cn',
-            undo: that.undo
+            other_field: 'cn'
         });
         that.type_select = IPA.select_widget({
             entity: spec.entity,
-            name: 'type',
-            undo: that.undo
+            name: 'type'
         });
         that.attribute_table = IPA.attributes_widget({
             entity: spec.entity,
-            name: 'attrs',
-            undo: that.undo
+            name: 'attrs'
         });
 
         that.add_field(that.filter_text);
diff --git a/install/ui/automount.js b/install/ui/automount.js
index 8be2b65747fbb8d936b34ece919c9b76dc056e45..72ced6322bb333c8ba75cce543d511c73c20ddf4 100644
--- a/install/ui/automount.js
+++ b/install/ui/automount.js
@@ -104,17 +104,10 @@ IPA.entity_factories.automountmap = function() {
                                     value: 'add_indirect',
                                     label: IPA.messages.objects.automountmap.indirect
                                 }
-                            ],
-                            undo: false
+                            ]
                         },
-                        {
-                            name: 'automountmapname',
-                            undo: false
-                        },
-                        {
-                            name: 'description',
-                            undo: false
-                        }
+                        'automountmapname',
+                        'description'
                     ]
                 },
                 {
@@ -123,14 +116,12 @@ IPA.entity_factories.automountmap = function() {
                         {
                             name: 'key',
                             label: IPA.get_method_option(
-                                'automountmap_add_indirect', 'key').label,
-                            undo: false
+                                'automountmap_add_indirect', 'key').label
                         },
                         {
                             name: 'parentmap',
                             label: IPA.get_method_option(
-                                'automountmap_add_indirect', 'parentmap').label,
-                            undo: false
+                                'automountmap_add_indirect', 'parentmap').label
                         }
                     ]
                 }
diff --git a/install/ui/dns.js b/install/ui/dns.js
index da00a0495172f5195f30217552939b64ca7ab490..cf8f6861949edf4598dd382a625ceaf14508a53e 100644
--- a/install/ui/dns.js
+++ b/install/ui/dns.js
@@ -93,15 +93,13 @@ IPA.entity_factories.dnszone = function() {
             fields: [
                 {
                     name: 'idnsname',
-                    optional: true,
-                    undo: false
+                    optional: true
                 },
                 'name_from_ip',
                 'idnssoamname',
                 {
                     name: 'idnssoarname',
-                    optional: true,
-                    undo: false
+                    optional: true
                 },
                 {
                     factory: IPA.force_dnszone_add_checkbox_widget,
@@ -583,28 +581,26 @@ IPA.entity_factories.dnsrecord = function() {
             ]
         }).
         adder_dialog({
-            pre_execute_hook:function(command){
+            pre_execute_hook: function(command) {
                 var record_type = command.options.record_type;
                 var record_data = command.options.record_data;
 
-                delete  command.options.record_type;
-                delete  command.options.record_data;
+                delete command.options.record_type;
+                delete command.options.record_data;
                 command.options[record_type] = record_data;
             },
             fields: [
                 'idnsname',
                 {
-                    name:'record_type',
-                    label:IPA.messages.objects.dnsrecord.type,
-                    factory:IPA.dnsrecord_type_widget,
-                    undo: false
+                    name: 'record_type',
+                    label: IPA.messages.objects.dnsrecord.type,
+                    factory: IPA.dnsrecord_type_widget
                 },
                 {
-                    name:'record_data',
-                    label:IPA.messages.objects.dnsrecord.data,
-                    factory:IPA.text_widget,
-                    param_info:{required:true},
-                    undo: false
+                    name: 'record_data',
+                    label: IPA.messages.objects.dnsrecord.data,
+                    factory: IPA.text_widget,
+                    param_info: {required:true}
                 }
             ]
         }).
@@ -670,7 +666,6 @@ IPA.force_dnszone_add_checkbox_widget = function(spec) {
     var param_info = IPA.get_method_option('dnszone_add', spec.name);
     spec.label = param_info.label;
     spec.tooltip = param_info.doc;
-    spec.undo = false;
     return IPA.checkbox_widget(spec);
 };
 
diff --git a/install/ui/entitle.js b/install/ui/entitle.js
index 693206cb0335cdae848d31c663623c38e00bbe01..844c7ad4c6b9515aec3d06a5b360aed5ab5a2d67 100644
--- a/install/ui/entitle.js
+++ b/install/ui/entitle.js
@@ -120,20 +120,17 @@ IPA.entity_factories.entitle = function() {
             fields: [
                 {
                     name: 'username',
-                    label: IPA.get_method_arg('entitle_register', 'username').label,
-                    undo: false
+                    label: IPA.get_method_arg('entitle_register', 'username').label
                 },
                 {
                     name: 'password',
                     label: IPA.get_method_option('entitle_register', 'password').label,
-                    type: 'password',
-                    undo: false
+                    type: 'password'
                 }
 /* currently not supported
                 , {
                     name: 'ipaentitlementid',
-                    label: IPA.get_method_option('entitle_register', 'ipaentitlementid').label,
-                    undo: false
+                    label: IPA.get_method_option('entitle_register', 'ipaentitlementid').label
                 }
 */
             ]
@@ -146,8 +143,7 @@ IPA.entity_factories.entitle = function() {
             fields: [
                 {
                     name: 'certificate',
-                    label: IPA.messages.objects.entitle.certificate,
-                    undo: false
+                    label: IPA.messages.objects.entitle.certificate
                 }
             ]
         }).
@@ -159,7 +155,6 @@ IPA.entity_factories.entitle = function() {
                 {
                     name: 'quantity',
                     label: IPA.get_method_arg('entitle_consume', 'quantity').label,
-                    undo: false,
                     metadata: IPA.get_method_arg('entitle_consume', 'quantity')
                 }
             ]
@@ -172,8 +167,7 @@ IPA.entity_factories.entitle = function() {
             fields: [
                 {
                     name: 'certificate',
-                    label: IPA.messages.objects.entitle.certificate,
-                    undo: false
+                    label: IPA.messages.objects.entitle.certificate
                 }
             ]
         });
diff --git a/install/ui/group.js b/install/ui/group.js
index f49c00f0b3d94c2bedc30fceff2d0ee8f6662949..ad705eb21e4ed06298319110ca4822e86ec701dc 100644
--- a/install/ui/group.js
+++ b/install/ui/group.js
@@ -95,7 +95,6 @@ IPA.entity_factories.group =  function () {
                     factory: IPA.group_nonposix_checkbox_widget,
                     name: 'nonposix',
                     label: IPA.messages.objects.group.posix,
-                    undo: false,
                     checked: true
                 },
                 'gidnumber']
diff --git a/install/ui/host.js b/install/ui/host.js
index 1a3ccadc656b07ed67570ae2be73ffe1b5bbb252..6720b4fcabde2636cd88a0760e2bee006f9d00b9 100644
--- a/install/ui/host.js
+++ b/install/ui/host.js
@@ -134,8 +134,7 @@ IPA.entity_factories.host = function () {
                             factory: IPA.text_widget,
                             name: 'hostname',
                             label: IPA.messages.objects.service.host,
-                            param_info: { required: true },
-                            undo: false
+                            param_info: { required: true }
                         },
                         {
                             factory: IPA.dnszone_select_widget,
@@ -143,8 +142,7 @@ IPA.entity_factories.host = function () {
                             label: IPA.metadata.objects.dnszone.label_singular,
                             editable: true,
                             empty_option: false,
-                            param_info: { required: true },
-                            undo: false
+                            param_info: { required: true }
                         }
                     ]
                 },
@@ -154,8 +152,7 @@ IPA.entity_factories.host = function () {
                         {
                             factory: IPA.text_widget,
                             name: 'ip_address',
-                            param_info: IPA.get_method_option('host_add', 'ip_address'),
-                            undo: false
+                            param_info: IPA.get_method_option('host_add', 'ip_address')
                         },
                         {
                             factory: IPA.force_host_add_checkbox_widget,
@@ -406,7 +403,6 @@ IPA.force_host_add_checkbox_widget = function(spec) {
     var param_info = IPA.get_method_option('host_add', spec.name);
     spec.label = param_info.label;
     spec.tooltip = param_info.doc;
-    spec.undo = false;
     return IPA.checkbox_widget(spec);
 };
 
@@ -630,15 +626,13 @@ IPA.host_password_widget = function(spec) {
         var password1 = dialog.add_field(IPA.text_widget({
             name: 'password1',
             label: IPA.messages.password.new_password,
-            type: 'password',
-            undo: false
+            type: 'password'
         }));
 
         var password2 = dialog.add_field(IPA.text_widget({
             name: 'password2',
             label: IPA.messages.password.verify_password,
-            type: 'password',
-            undo: false
+            type: 'password'
         }));
 
         dialog.add_button(label, function() {
diff --git a/install/ui/policy.js b/install/ui/policy.js
index dd4efa0257c7d33c3ccab13f1e422dcf5d574e20..4c4733dc0529c5440eae2db3c941a8018cada99c 100644
--- a/install/ui/policy.js
+++ b/install/ui/policy.js
@@ -49,8 +49,7 @@ IPA.entity_factories.pwpolicy = function() {
                     factory: IPA.entity_select_widget,
                     name: 'cn',
                     other_entity: 'group',
-                    other_field: 'cn',
-                    undo: false
+                    other_field: 'cn'
                 },
                 'cospriority'],
             width: 400,
diff --git a/install/ui/service.js b/install/ui/service.js
index 7ff1ba711b40db90d3407859a4a1049e345bd343..87b0bbf20bd5aff1240980c5e19d1cd7db52266e 100644
--- a/install/ui/service.js
+++ b/install/ui/service.js
@@ -119,8 +119,7 @@ IPA.service_add_dialog = function(spec) {
             label: IPA.messages.objects.service.service,
             size: 20,
             entity: spec.entity,
-            param_info: { required: true },
-            undo: false
+            param_info: { required: true }
         })).
         field(IPA.entity_select_widget({
             name: 'host',
@@ -128,14 +127,12 @@ IPA.service_add_dialog = function(spec) {
             other_field: 'fqdn',
             entity: spec.entity,
             label: IPA.messages.objects.service.host,
-            param_info: { required: true },
-            undo: false
+            param_info: { required: true }
         })).
         field(IPA.checkbox_widget({
             name: 'force',
             entity: spec.entity,
-            param_info: IPA.get_method_option('service_add', 'force'),
-            undo: false
+            param_info: IPA.get_method_option('service_add', 'force')
         }));
 
 
diff --git a/install/ui/sudo.js b/install/ui/sudo.js
index 23e5f7a249f8041c0be715df5910b51fabf719ff..a97731242fc00c0f688867a07284729ea7af507d 100644
--- a/install/ui/sudo.js
+++ b/install/ui/sudo.js
@@ -570,8 +570,7 @@ IPA.sudo.options_section = function(spec) {
 
         var ipasudoopt = dialog.add_field(IPA.text_widget({
             name: 'ipasudoopt',
-            label: label,
-            undo: false
+            label: label
         }));
 
         dialog.add_button(IPA.messages.buttons.add, function() {
diff --git a/install/ui/user.js b/install/ui/user.js
index 6243cd2d6e2bd5dea00a45cd3ae69dcce3fa9c84..62794ad7524b3edcee5f735c87c248c5034a0623 100644
--- a/install/ui/user.js
+++ b/install/ui/user.js
@@ -142,11 +142,12 @@ IPA.entity_factories.user = function() {
             fields: [
                 {
                     factory : IPA.text_widget,
-                    undo: false,
                     optional: true,
                     name:'uid'
                 },
-                'givenname', 'sn']
+                'givenname',
+                'sn'
+            ]
         });
 
     return builder.build();
@@ -324,15 +325,13 @@ IPA.user_password_widget = function(spec) {
         var password1 = dialog.add_field(IPA.text_widget({
             name: 'password1',
             label: IPA.messages.password.new_password,
-            type: 'password',
-            undo: false
+            type: 'password'
         }));
 
         var password2 = dialog.add_field(IPA.text_widget({
             name: 'password2',
             label: IPA.messages.password.verify_password,
-            type: 'password',
-            undo: false
+            type: 'password'
         }));
 
         dialog.add_button(IPA.messages.password.reset_password, function() {
-- 
1.7.5.1

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

Reply via email to