On 07/27/2011 03:56 PM, Endi Sukma Dewata wrote:
On 7/27/2011 11:33 AM, Adam Young wrote:
This applies on top of my old patch 270 version 13. Changes are in a
separate patch due to the size of the original. When submitted, I can
squash the two patches into one.

I have not rebased on top of the latest changes, as that would involve
changing patch 270. I will do so prior to pushing.

As mentioned over IRC, I had to rebase your patches (see attachments) on top of my patch 224 and 225 in order to do proper testing. Please use this when making further changes.

57. The parameter validation in IPA.column (widget.js:1131) doesn't
really look that different from other initialization code in line
1172, so we can move it into the initialization area too.

This is precondition checking. Note that it merely throws an exception
if the entity_name is not set. I want this stuff at the top of the
function so that it is obvious to people looking to use them what is
required. I added a comment to make this clear, but I'd like to keep
precondition checking at the top of the function.

This is fine for now, although in general precondition checking could become complex, and in other OO languages the checking is done inside the constructor (i.e. in the initialization area, not in the attribute declaration area).

59. The initialization area in IPA.association_adder_dialog
(association.js:212) should be marked with a comment.
Done

The default_columns() invocation should be moved into the initialization area because this is not a precondition checking like in #57. The default_columns() function itself should be moved outside of the initialization area because the area should not contain function definition, only invocations.

The columns need to be defined before the table setup in the base class, which is why it is done at the top of the function, prior to calling the baseclass. Going to leave this as is.


62. Since the code in #60 and #61 is moved to initialization area, the
spec.link can be reverted back to that.link.

Removed link. I don't see where it is used. Tested without it and
everything seems to work fine.

The link flag is used to create a link from the association facet to the target entity (see association.js:723 and widget.js:1152). The original code sets the flag to true by default.

To test, create a netgroup and enroll a user. The user should be linked.
Still works. True is deduced by default. I think at this point you would have to send link = false to disable, and that probably makes no sense. Going to leave this as is.


73. Patch 270 added options with empty labels to the cmdcategory in IPA.sudo.rule_details_command_section (sudo.js:786). This is not necessary because the widget is rendered in line 842-879, not using the radio_widget's create().

Removed the empty labels

It might be possible to move the tables outside of cmdcategory's span and use radio_widget's create(), but that can be done in another patch.

74. This is probably a separate issue. The hbacrule-find doesn't return the rule type by default so the column is empty in HBAC rule search page. It needs an --all option.
Fixed

75. In sudo rule details page, click the Add button to add users under the Who section. When there are many users, the external field covers the list of users.
Fixed

Prior to this patch the external field covers the list too, but not as much, so maybe it just needs some adjustments.

76. This is an existing problem. The click handler for the Find button in IPA.adder_dialog (dialog.js:466) should return false like the remove & add buttons below it. This can be fixed separately.
Fixed


77. Regression: Changing the Allow command category in sudo rule doesn't work. It doesn't show undo button and reverts back when saved.
Fixed

78. There are jslint and whitespace warnings in patch 278.

Fixed
From 712f4a9d86a7e06a48d00c976ccd0575eac6bff2 Mon Sep 17 00:00:00 2001
From: Adam Young <ayo...@redhat.com>
Date: Wed, 27 Jul 2011 09:28:11 -0400
Subject: [PATCH] init and setup method removal

Additional changes from the code review, put into their own patch for clarity

Added colons on to the end of the doc strings for sudo details runas section

removed The IPA.spacer_widget from dns.js and widget.js

The parameter validation in IPA.column ...This is precondition checking.  Note that it merely throws an exception if the entity_name is not set.  I want this stuff at the top of the function so that it is obvious to people looking to use them what is required.  I added a comment to make this clear, but I'd like to keep precondition checking at the top of the function.

decreased the scope of the pkey_name and moved the initiailzation fof columns into the setup_column function for association_tables

removed link from assocaitions_facet

moved initialization code to the end

moved association_table_widgit initialization code to the end of function.

mode call to setup columns to initialization of assoc facet

moved initialization code to end of hbac_details_section

create function for add tables, but don't move it to initialization

move initialziation sudo_rules_details_facet objects to the end of their functions

fix initialization of columns for association tables

 more fixes for init and setup method removal

fix JSL warning

use --all for hbacrule find, so the type shows up now

return false at the end of click handler

removed blank labels in sudo command section

fix radio buttons for sudo category

fixed table side for adder dialogs with externalmore code fixes:

fix JSL warning

us --all for hbacrule find, so the type shows up now

return false at the end of click handler

removed blank labels in sudo command section

fix radio buttons for sudo category

fixed table side for adder dialogs with external
---
 install/ui/add.js         |    4 -
 install/ui/association.js |  103 ++++++++++----------
 install/ui/dialog.js      |   18 +++-
 install/ui/dns.js         |    4 -
 install/ui/hbac.js        |   14 ++-
 install/ui/search.js      |    8 +-
 install/ui/sudo.js        |  238 +++++++++++++++++++++------------------------
 install/ui/widget.js      |   16 +---
 8 files changed, 191 insertions(+), 214 deletions(-)

diff --git a/install/ui/add.js b/install/ui/add.js
index 59c2e0337c6db2be49e28a4fe8be88693a8e4256..988ea8ff13819ccdd61a2033344e146dbaf09255 100644
--- a/install/ui/add.js
+++ b/install/ui/add.js
@@ -43,10 +43,6 @@ IPA.add_dialog = function (spec) {
 
     that.show_edit_page = spec.show_edit_page || show_edit_page;
 
-    that.create = function() {
-        that.dialog_create();
-    };
-
     that.add = function(record, on_success, on_error) {
 
         var field, value, pkey_prefix;
diff --git a/install/ui/association.js b/install/ui/association.js
index 60385c6231f915ab0ecfccf9b22b18b7b39e8795..6a9b8dfb67aaad85f029d8784a9776b6532f7e02 100644
--- a/install/ui/association.js
+++ b/install/ui/association.js
@@ -145,6 +145,7 @@ IPA.bulk_associator = function(spec) {
 IPA.association_adder_dialog = function (spec) {
 
     spec = spec || {};
+    default_columns(spec);
 
     var that = IPA.adder_dialog(spec);
 
@@ -153,15 +154,6 @@ IPA.association_adder_dialog = function (spec) {
     that.other_entity = spec.other_entity;
     that.attribute_member = spec.attribute_member;
 
-    that.create = function() {
-
-        that.adder_dialog_create();
-
-        /* FIXME: event not firing? */
-        $('input[name=hidememb]', that.container).click(that.search);
-
-    };
-
     that.search = function() {
         function on_success(data, text_status, xhr) {
             var results = data.result;
@@ -171,8 +163,9 @@ IPA.association_adder_dialog = function (spec) {
 
             for (var i=0; i<results.count; i++){
                 var result = results.result[i];
-                if (result[pkey_attr] != spec.pkey)
+                if (result[pkey_attr] != spec.pkey){
                     that.add_available_value(result);
+                }
             }
         }
 
@@ -209,14 +202,17 @@ IPA.association_adder_dialog = function (spec) {
         }).execute();
     };
 
-    if (!that.columns.length) {
-        var pkey_name = IPA.metadata.objects[that.other_entity].primary_key;
-        that.create_column({
-            name: pkey_name,
-            label: IPA.metadata.objects[that.other_entity].label,
-            primary_key: true,
-            width: '200px'
-        });
+    /*initialization*/
+    function default_columns(spec){
+        if (!spec.columns) {
+            var pkey_name = IPA.metadata.objects[spec.other_entity].primary_key;
+            spec.columns = [{
+                name: pkey_name,
+                label: IPA.metadata.objects[spec.other_entity].label,
+                primary_key: true,
+                width: '200px'
+            }];
+        }
     }
 
     return that;
@@ -307,21 +303,6 @@ IPA.association_table_widget = function (spec) {
         return column;
     };
 
-    /*this is duplicated in the facet... should be unified*/
-    var i;
-    if (spec.columns){
-        for (i = 0; i < spec.columns.length; i+= 1){
-            spec.columns[i].entity_name = spec.columns[i].entity_name ||
-                that.other_entity;
-            that.create_column(spec.columns[i]);
-        }
-    }
-    if (spec.adder_columns){
-        for (i = 0; i < spec.adder_columns.length; i+= 1){
-            that.create_adder_column(spec.adder_columns[i]);
-        }
-    }
-
     that.create = function(container) {
 
         var column;
@@ -649,6 +630,22 @@ IPA.association_table_widget = function (spec) {
         }).execute();
     };
 
+    /*initialization code*/
+    /*this is duplicated in the facet... should be unified*/
+    var i;
+    if (spec.columns){
+        for (i = 0; i < spec.columns.length; i+= 1){
+            spec.columns[i].entity_name = spec.columns[i].entity_name ||
+                that.other_entity;
+            that.create_column(spec.columns[i]);
+        }
+    }
+    if (spec.adder_columns){
+        for (i = 0; i < spec.adder_columns.length; i+= 1){
+            that.create_adder_column(spec.adder_columns[i]);
+        }
+    }
+
     // methods that should be invoked by subclasses
     that.association_table_widget_show_add_dialog = that.show_add_dialog;
     that.association_table_widget_show_remove_dialog = that.show_remove_dialog;
@@ -660,25 +657,12 @@ IPA.association_table_widget = function (spec) {
 IPA.association_facet = function (spec) {
 
     spec = spec || {};
-    if (spec.other_entity){
-        var pkey_name = IPA.metadata.objects[spec.other_entity].primary_key;
-    }
 
-    spec.link = spec.link === undefined ? true : spec.link;
 
 
-    if (!spec.columns){
-        spec.columns= [{
-            name: pkey_name,
-            primary_key: true,
-            link: spec.link
-        }];
-    }
-
     spec.managed_entity_name = spec.other_entity;
     var that = IPA.table_facet(spec);
 
-    that.link = spec.link;
     that.entity = spec.entity;
     that.attribute_member = spec.attribute_member;
     that.indirect_attribute_member = spec.indirect_attribute_member;
@@ -723,16 +707,24 @@ IPA.association_facet = function (spec) {
         return column;
     };
 
-    var adder_columns = spec.adder_columns || [];
-    for (var i=0; i<adder_columns.length; i++) {
-        that.create_adder_column(adder_columns[i]);
-    }
-
-
     function setup_columns(){
         var column;
         var i;
 
+        var pkey_name;
+        if (that.other_entity){
+            pkey_name = IPA.metadata.objects[that.other_entity].primary_key;
+        }
+
+        if (!that.columns.length){
+            that.create_column({
+                name: pkey_name,
+                primary_key: true,
+                link: spec.link
+            });
+        }
+
+
         var label = IPA.metadata.objects[that.other_entity] ?
             IPA.metadata.objects[that.other_entity].label : that.other_entity;
 
@@ -893,7 +885,6 @@ IPA.association_facet = function (spec) {
     };
 
     that.create_content = function(container) {
-        setup_columns();
         that.table.create(container);
     };
 
@@ -1136,5 +1127,11 @@ IPA.association_facet = function (spec) {
         command.execute();
     };
 
+    /*initialization*/
+    var adder_columns = spec.adder_columns || [];
+    for (var i=0; i<adder_columns.length; i++) {
+        that.create_adder_column(adder_columns[i]);
+    }
+    setup_columns();
     return that;
 };
diff --git a/install/ui/dialog.js b/install/ui/dialog.js
index 1a1831347f41a08a1584a8ee534884f44a66977e..f4a8293bc30fbc0a7111757e8198b39aef8d5276 100644
--- a/install/ui/dialog.js
+++ b/install/ui/dialog.js
@@ -296,7 +296,7 @@ IPA.dialog = function(spec) {
  */
 IPA.adder_dialog = function (spec) {
     var NORMAL_HEIGHT = '151px';
-    var WITH_EXTERNAL_HEIGHT = '119px';
+    var EXTERNAL_HEIGHT = '119px';
 
     spec = spec || {};
 
@@ -315,6 +315,7 @@ IPA.adder_dialog = function (spec) {
 
     that.columns = $.ordered_map();
 
+
     that.get_column = function(name) {
         return that.columns.get(name);
     };
@@ -344,7 +345,7 @@ IPA.adder_dialog = function (spec) {
     function initialize_table(){
         var table_height = NORMAL_HEIGHT;
         if (that.external){
-            table_height = WITH_EXTERNAL_HEIGHT;
+            table_height = EXTERNAL_HEIGHT;
         }
 
         that.available_table = IPA.table_widget({
@@ -361,7 +362,7 @@ IPA.adder_dialog = function (spec) {
             entity: that.entity,
             name: 'selected',
             scrollable: true,
-            height: table_height
+            height: NORMAL_HEIGHT
         });
 
         that.selected_table.set_columns(columns);
@@ -462,7 +463,10 @@ IPA.adder_dialog = function (spec) {
         that.find_button = IPA.button({
             name: 'find',
             'label': button.val(),
-            'click': function() { that.search(); }
+            'click': function() {
+                that.search();
+                return false;
+            }
         });
         button.replaceWith(that.find_button);
 
@@ -554,6 +558,12 @@ IPA.adder_dialog = function (spec) {
     };
 
     /*dialog initialization */
+   if (spec.columns){
+        for (var i =0; i < spec.columns.length; i +=1){
+            that.create_column(spec.columns[i]);
+        }
+    }
+
     initialize_table();
 
     that.adder_dialog_create = that.create;
diff --git a/install/ui/dns.js b/install/ui/dns.js
index 089dcad74a9e21f9c3c415129661cd0bea4ed94d..da96ee10750399fa75e88ae5ec287956ddd34215 100644
--- a/install/ui/dns.js
+++ b/install/ui/dns.js
@@ -93,10 +93,6 @@ IPA.entity_factories.dnszone = function() {
                     name: 'name_from_ip',
                     undo: false
                 },
-                {
-                    factory: IPA.spacer_widget
-                },
-
                 'idnssoamname',
                 'idnssoarname',
                 {
diff --git a/install/ui/hbac.js b/install/ui/hbac.js
index afd24df47c72882d5b0e07c41ae4cfe2f475c096..2cdb710ab24c8fb6a65c9298ca80a27bbc6d45f4 100644
--- a/install/ui/hbac.js
+++ b/install/ui/hbac.js
@@ -27,6 +27,7 @@ IPA.entity_factories.hbacrule = function() {
     return IPA.entity_builder().
         entity('hbacrule').
         search_facet({
+            search_all:true,
             columns:['cn',
                      {
                          factory: IPA.column,
@@ -163,7 +164,6 @@ IPA.hbacrule_details_facet = function(spec) {
         });
         return section;
     }
-    that.add_section(general_section());
 
 
     function user_category_section(){
@@ -204,7 +204,6 @@ IPA.hbacrule_details_facet = function(spec) {
         }));
         return section;
     }
-    that.add_section(user_category_section());
 
     function hostcategory_section(){
         var param_info = IPA.get_entity_param('hbacrule', 'hostcategory');
@@ -243,7 +242,6 @@ IPA.hbacrule_details_facet = function(spec) {
         }));
         return section;
     }
-    that.add_section(hostcategory_section());
 
     function servicecategory_section(){
         var param_info = IPA.get_entity_param('hbacrule', 'servicecategory');
@@ -283,7 +281,6 @@ IPA.hbacrule_details_facet = function(spec) {
         }));
         return section;
     }
-    that.add_section(servicecategory_section());
 
     function sourcehostcategory_section(){
 
@@ -323,7 +320,6 @@ IPA.hbacrule_details_facet = function(spec) {
         }));
         return section;
     }
-    that.add_section(sourcehostcategory_section());
 
     that.update = function(on_success, on_error) {
 
@@ -509,6 +505,14 @@ IPA.hbacrule_details_facet = function(spec) {
         batch.execute();
     };
 
+    /*initialization*/
+    that.add_section(general_section());
+    that.add_section(user_category_section());
+    that.add_section(hostcategory_section());
+    that.add_section(servicecategory_section());
+    that.add_section(sourcehostcategory_section());
+
+
     return that;
 };
 
diff --git a/install/ui/search.js b/install/ui/search.js
index 9ec1c549b43745b8378fbbc26bf974e4c884834b..fe0b07f72ccae17077cf48732cb4e8d26fdb91b4 100644
--- a/install/ui/search.js
+++ b/install/ui/search.js
@@ -47,8 +47,7 @@ IPA.search_facet = function(spec) {
 
     that.get_values = spec.get_values || get_values;
 
-    that.create_content = function(container) {
-
+    function initialize_table_columns(){
         that.managed_entity = IPA.get_entity(that.managed_entity_name);
         var entity = that.managed_entity;
 
@@ -87,7 +86,12 @@ IPA.search_facet = function(spec) {
         that.table.refresh = function() {
             that.refresh();
         };
+    }
 
+    that.create_content = function(container) {
+        /*should be in the initialize section, but can not, due to
+          get_entity circular references.*/
+        initialize_table_columns();
         that.table.create(container);
     };
 
diff --git a/install/ui/sudo.js b/install/ui/sudo.js
index ab05e9c9c1706bea795c602a28f0c72ffbfa5edc..14bc8d5af58292b4cd437610229c44532ddfb2a8 100644
--- a/install/ui/sudo.js
+++ b/install/ui/sudo.js
@@ -281,7 +281,6 @@ IPA.sudorule_details_facet = function(spec) {
             ]});
         return section;
     }
-    that.add_section(general_section());
 
     function options_section(){
         var section = IPA.sudo.options_section({
@@ -292,7 +291,6 @@ IPA.sudorule_details_facet = function(spec) {
         });
         return section;
     }
-    that.add_section(options_section());
 
 
     function user_section(){
@@ -339,7 +337,6 @@ IPA.sudorule_details_facet = function(spec) {
         }));
         return section;
     }
-    that.add_section(user_section());
 
     function host_section(){
         var param_info = IPA.get_entity_param('sudorule', 'hostcategory');
@@ -359,7 +356,6 @@ IPA.sudorule_details_facet = function(spec) {
                 { 'field_name': 'memberhost_hostgroup' }
             ]
         });
-        that.add_section(section);
 
         var category = section.add_field(IPA.radio_widget({
             entity: that.entity,
@@ -378,19 +374,9 @@ IPA.sudorule_details_facet = function(spec) {
             'name': 'memberhost_hostgroup', 'category': category,
             'other_entity': 'hostgroup', 'add_method': 'add_host', 'remove_method': 'remove_host'
         }));
+        return section;
     }
-    host_section();
 
-    that.add_section( IPA.sudo.rule_details_command_section({
-            name: 'command',
-            entity: that.entity,
-            label: IPA.messages.objects.sudorule.command
-    }));
-    that.add_section( IPA.sudo.rule_details_runas_section({
-        name: 'runas',
-        entity: that.entity,
-        label: IPA.messages.objects.sudorule.runas
-    }));
 
     that.update = function(on_success, on_error) {
 
@@ -588,6 +574,23 @@ IPA.sudorule_details_facet = function(spec) {
         batch.execute();
     };
 
+    /*initialization*/
+    that.add_section(general_section());
+    that.add_section(options_section());
+    that.add_section(user_section());
+    that.add_section(host_section());
+    that.add_section( IPA.sudo.rule_details_command_section({
+            name: 'command',
+            entity: that.entity,
+            label: IPA.messages.objects.sudorule.command
+    }));
+    that.add_section( IPA.sudo.rule_details_runas_section({
+        name: 'runas',
+        entity: that.entity,
+        label: IPA.messages.objects.sudorule.runas
+    }));
+
+
     return that;
 };
 
@@ -600,42 +603,44 @@ IPA.sudo.options_section = function(spec) {
     that.facet = spec.facet;
 
 
-    that.table = that.add_field(IPA.table_widget({
-        name: 'ipasudoopt',
-        show_buttons: true
-    }));
+    function setup_table(){
+        that.table = that.add_field(IPA.table_widget({
+            name: 'ipasudoopt',
+            show_buttons: true
+        }));
 
-    that.table.create_column({
-        name: 'ipasudoopt',
-        label: IPA.get_method_option('sudorule_add_option', 'ipasudoopt').label,
-        entity_name:that.entity.name,
-        primary_key: true
-    });
+        that.table.create_column({
+            name: 'ipasudoopt',
+            label: IPA.get_method_option('sudorule_add_option', 'ipasudoopt').label,
+            entity_name:that.entity.name,
+            primary_key: true
+        });
 
-    that.table.create = function(container) {
+        that.table.create = function(container) {
 
-        that.table.table_create(container);
+            that.table.table_create(container);
 
-        var button = IPA.action_button({
-            name: 'remove',
-            label: IPA.messages.buttons.remove,
-            icon: 'remove-icon',
-            click: function() {
-                that.remove_handler();
-                return false;
-            }
-        }).appendTo(that.table.buttons);
+            var button = IPA.action_button({
+                name: 'remove',
+                label: IPA.messages.buttons.remove,
+                icon: 'remove-icon',
+                click: function() {
+                    that.remove_handler();
+                    return false;
+                }
+            }).appendTo(that.table.buttons);
 
-        button = IPA.action_button({
-            name: 'add',
-            label: IPA.messages.buttons.add,
-            icon: 'add-icon',
-            click: function() {
-                that.add_handler();
-                return false;
-            }
-        }).appendTo(that.table.buttons);
-    };
+            button = IPA.action_button({
+                name: 'add',
+                label: IPA.messages.buttons.add,
+                icon: 'add-icon',
+                click: function() {
+                    that.add_handler();
+                    return false;
+                }
+            }).appendTo(that.table.buttons);
+        };
+    }
 
     that.add_handler = function() {
         if (that.facet.is_dirty()) {
@@ -770,6 +775,9 @@ IPA.sudo.options_section = function(spec) {
         dialog.open(that.container);
     };
 
+    /*initialization*/
+    setup_table();
+
     return that;
 };
 
@@ -781,47 +789,54 @@ IPA.sudo.rule_details_command_section = function(spec) {
 
     var that = IPA.details_section(spec);
 
-    var category = that.add_field(
-        IPA.radio_widget({
-            name: 'cmdcategory',
-            options:[
-                {value:'all',label:' '},
-                {value:'',label:''}
-            ]
-        }));
-
-    that.add_field(IPA.rule_association_table_widget({
-        'id': that.entity.name+'-memberallowcmd_sudocmd',
-        'name': 'memberallowcmd_sudocmd',
-        'category': category,
-        'other_entity': 'sudocmd',
-        'add_method': 'add_allow_command',
-        'remove_method': 'remove_allow_command'
-    }));
-    that.add_field(IPA.rule_association_table_widget({
-        'id': that.entity.name+'-memberallowcmd_sudocmdgroup',
-        'name': 'memberallowcmd_sudocmdgroup',
-        'category': category,
-        'other_entity': 'sudocmdgroup',
-        'add_method': 'add_allow_command',
-        'remove_method': 'remove_allow_command'
-    }));
+    function setup_fields(){
+        that.category = that.add_field(
+            IPA.radio_widget({
+                name: 'cmdcategory',
+                options:[
+                    {
+                        value:'all',
+                        label:IPA.messages.objects.sudorule.any_command
+                    },
+                    {
+                        value:'',
+                        label:IPA.messages.objects.sudorule.specified_commands
+                    }
+                ]
+            }));
 
-    that.add_field(IPA.rule_association_table_widget({
-        'id': that.entity.name+'-memberdenycmd_sudocmd',
-        'name': 'memberdenycmd_sudocmd',
-        'other_entity': 'sudocmd',
-        'add_method': 'add_deny_command',
-        'remove_method': 'remove_deny_command'
-    }));
-    that.add_field(IPA.rule_association_table_widget({
-        'id': that.entity.name+'-memberdenycmd_sudocmdgroup',
-        'name': 'memberdenycmd_sudocmdgroup',
-        'other_entity': 'sudocmdgroup',
-        'add_method': 'add_deny_command',
-        'remove_method': 'remove_deny_command'
-    }));
+        that.add_field(IPA.rule_association_table_widget({
+            'id': that.entity.name+'-memberallowcmd_sudocmd',
+            'name': 'memberallowcmd_sudocmd',
+            'category': that.category,
+            'other_entity': 'sudocmd',
+            'add_method': 'add_allow_command',
+            'remove_method': 'remove_allow_command'
+        }));
+        that.add_field(IPA.rule_association_table_widget({
+            'id': that.entity.name+'-memberallowcmd_sudocmdgroup',
+            'name': 'memberallowcmd_sudocmdgroup',
+            'category': that.category,
+            'other_entity': 'sudocmdgroup',
+            'add_method': 'add_allow_command',
+            'remove_method': 'remove_allow_command'
+        }));
 
+        that.add_field(IPA.rule_association_table_widget({
+            'id': that.entity.name+'-memberdenycmd_sudocmd',
+            'name': 'memberdenycmd_sudocmd',
+            'other_entity': 'sudocmd',
+            'add_method': 'add_deny_command',
+            'remove_method': 'remove_deny_command'
+        }));
+        that.add_field(IPA.rule_association_table_widget({
+            'id': that.entity.name+'-memberdenycmd_sudocmdgroup',
+            'name': 'memberdenycmd_sudocmdgroup',
+            'other_entity': 'sudocmdgroup',
+            'add_method': 'add_deny_command',
+            'remove_method': 'remove_deny_command'
+        }));
+    }
 
     that.create = function(container) {
 
@@ -841,34 +856,9 @@ IPA.sudo.rule_details_command_section = function(spec) {
             title: IPA.messages.objects.sudorule.allow
         }).appendTo(span);
 
-        span.append(param_info.doc);
-        span.append(': ');
+        span.append(param_info.doc+": ");
 
-        $('<input/>', {
-            type: 'radio',
-            name: 'cmdcategory',
-            value: 'all'
-        }).appendTo(span);
-
-        span.append(' ');
-
-        span.append(IPA.messages.objects.sudorule.any_command);
-
-        span.append(' ');
-
-        $('<input/>', {
-            type: 'radio',
-            name: 'cmdcategory',
-            value: ''
-        }).appendTo(span);
-
-        span.append(' ');
-
-        span.append(IPA.messages.objects.sudorule.specified_commands);
-
-        span.append(' ');
-
-        field.create_undo(span);
+        that.category.create(span);
 
         param_info = IPA.get_entity_param(
             that.entity.name, 'memberallowcmd_sudocmd');
@@ -951,6 +941,9 @@ IPA.sudo.rule_details_command_section = function(spec) {
         });
     };
 
+    /*initialization*/
+    setup_fields();
+
     return that;
 };
 
@@ -960,7 +953,7 @@ IPA.sudo.rule_details_runas_section = function(spec) {
     spec = spec || {};
 
     var that = IPA.details_section(spec);
-    
+
     function add_extra_fields(){
         var category = that.add_field(
             IPA.radio_widget({
@@ -1030,7 +1023,7 @@ IPA.sudo.rule_details_runas_section = function(spec) {
             title: param_info.doc,
             'class': 'details-field'
         }).appendTo(container);
-        span.append(param_info.doc);
+        span.append(param_info.doc+": ");
         field.create(span);
         span.append('<br/>');
 
@@ -1066,7 +1059,7 @@ IPA.sudo.rule_details_runas_section = function(spec) {
             'class': 'details-field'
         }).appendTo(container);
 
-        span.append(param_info.doc);
+        span.append(param_info.doc+": ");
         field.create(span);
         span.append('<br/>');
 
@@ -1134,6 +1127,7 @@ IPA.sudo.rule_details_runas_section = function(spec) {
         });
     };
 
+    /*initialization*/
     add_extra_fields();
 
     return that;
@@ -1199,20 +1193,6 @@ IPA.sudo.rule_association_adder_dialog = function(spec) {
                 width: '200px'
             });
         }
-
-        that.available_table = IPA.table_widget({
-            name: 'available'
-        });
-
-        var columns = that.columns.values;
-        that.available_table.set_columns(columns);
-
-
-        that.selected_table = IPA.table_widget({
-            name: 'selected'
-        });
-
-        that.selected_table.set_columns(columns);
     }
 
     that.create = function() {
diff --git a/install/ui/widget.js b/install/ui/widget.js
index 04d5cf228a8ea5b7837e8eab08911df425fce891..b60b2a610bbd7bdca4d068db0c4483dc3bb03948 100644
--- a/install/ui/widget.js
+++ b/install/ui/widget.js
@@ -1113,7 +1113,9 @@ IPA.textarea_widget = function (spec) {
     return that;
 };
 
-
+/*
+  The entity name must be set in the spec either directly or via entity.name
+*/
 IPA.column = function (spec) {
 
     spec = spec || {};
@@ -1914,15 +1916,3 @@ IPA.button = function(spec) {
     return button;
 };
 
-
-IPA.spacer_widget = function(spec){
-
-    var that = IPA.widget(spec);
-    that.label = null;
-
-    that.create = function (container){
-        container.append('&nbsp;');
-
-    };
-    return that;
-};
\ No newline at end of file
-- 
1.7.6

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

Reply via email to