On 05/28/2011 08:54 PM, Adam Young wrote:



_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel
JSL lint cleanup
From 7fba335cf391dab621102da43c3a1eae7cfdb74e Mon Sep 17 00:00:00 2001
From: Adam Young <ayo...@redhat.com>
Date: Fri, 27 May 2011 21:37:05 -0400
Subject: [PATCH] automount delete key

---
 install/ui/automount.js |   31 ++++++++++++++++++++++---------
 install/ui/dialog.js    |   24 +++++++++++++++++++-----
 install/ui/search.js    |   23 ++++++++++++++++++++---
 install/ui/webui.js     |    3 +--
 4 files changed, 62 insertions(+), 19 deletions(-)

diff --git a/install/ui/automount.js b/install/ui/automount.js
index e5fab0d8f1311b2153b358675f57deff91858a55..5b62bd912e85eb75a3570f1e2a06975d67180965 100644
--- a/install/ui/automount.js
+++ b/install/ui/automount.js
@@ -63,7 +63,8 @@ IPA.entity_factories.automountmap = function() {
             nested_entity : 'automountkey',
             label : IPA.metadata.objects.automountkey.label,
             name: 'keys',
-            columns:['automountkey','automountinformation','description']
+            get_values: IPA.get_option_values,
+            columns:['automountkey','automountinformation']
         }).
         details_facet({
             sections:[
@@ -81,7 +82,7 @@ IPA.entity_factories.automountmap = function() {
                      undo: false,
                      label:'Map Type',
                      options:[{value:'add',label:'Direct'},
-                              {value:'add_indirect',label:'Indirect'}],
+                              {value:'add_indirect',label:'Indirect'}]
                     },
                     'automountmapname','description',
                     {name:'key',label:'Mount Point',conditional:true},
@@ -114,21 +115,35 @@ IPA.entity_factories.automountkey = function() {
 IPA.automountmap_adder_dialog = function(spec){
     var that = IPA.add_dialog(spec);
 
-
-
     that.super_setup = that.setup;
     that.setup = function(container) {
         that.super_setup(container);
         that.disable_conditional_fields();
-    }
+    };
 
     that.super_add = that.add;
     that.add = function(record, on_success, on_error) {
         that.super_add(record, on_success, on_error);
-    }
+    };
     return that;
 };
 
+
+IPA.get_option_values = function(){
+
+    var values = [];
+    $('input[name="select"]:checked', this.table.tbody).each(function() {
+        var value = {};
+        $('span',$(this).parent().parent()).each(function(){
+            var name = this.attributes['name'].value;
+
+            value[name] = $(this).text();
+        });
+        values.push (value);
+    });
+    return values;
+};
+
 IPA.method_radio_widget = function(spec){
     var direct = true;
 
@@ -151,9 +166,7 @@ IPA.method_radio_widget = function(spec){
                 that.dialog.disable_conditional_fields();
             }
         });
-
-
-    }
+    };
 
     return that;
 };
diff --git a/install/ui/dialog.js b/install/ui/dialog.js
index 092263df08bab6a08e3cd943359b58e7fdde76ed..a6a2692714bc358715abe809aa13ae703b7f90c3 100644
--- a/install/ui/dialog.js
+++ b/install/ui/dialog.js
@@ -51,7 +51,7 @@ IPA.dialog = function(spec) {
                that.conditional_fields[i] +
               ']',that.container).css('visibility','visible');
         }
-    }
+    };
 
     that.disable_conditional_fields = function(){
         for (var i =0; i < that.conditional_fields.length; i+=1) {
@@ -59,9 +59,7 @@ IPA.dialog = function(spec) {
               that.conditional_fields[i] +
               ']',that.container).css('visibility','hidden');
         }
-    }
-
-
+    };
 
     that.__defineGetter__("entity_name", function(){
         return that._entity_name;
@@ -620,8 +618,24 @@ IPA.deleter_dialog =  function (spec) {
         ul.appendTo(div);
 
         for (var i=0; i<that.values.length; i++) {
+            var value = that.values[i];
+            if (value instanceof Object){
+                var first = true;
+                var str_value = "";
+                for (var key in value){
+                    if (value.hasOwnProperty(key)){
+                        str_value += (key + ':' +value[key]);
+                        if (first){
+                            str_value += ',';
+                        }
+                        first = false;
+                    }
+                }
+                value = str_value;
+            }
+
             $('<li/>',{
-                'text': that.values[i]
+                'text': value
             }).appendTo(ul);
         }
     };
diff --git a/install/ui/search.js b/install/ui/search.js
index 5786886ac8459e5b0e34bb881cc20707dcab19eb..ba27cc9ddf818c11003fe8f9a1c89c4c84d7a448 100644
--- a/install/ui/search.js
+++ b/install/ui/search.js
@@ -37,6 +37,12 @@ IPA.search_facet = function(spec) {
     that.search_all = spec.search_all || false;
 
 
+    function get_values (){
+        return that.table.get_selected_values();
+    }
+
+    that.get_values = spec.get_values || get_values;
+
     that.init = function() {
         that.facet_init();
         that.managed_entity = IPA.get_entity(that.managed_entity_name);
@@ -193,9 +199,10 @@ IPA.search_facet = function(spec) {
         that.remove_instances(that.managed_entity);
     };
 
+
     that.remove_instances = function(entity) {
 
-        var values = that.table.get_selected_values();
+        var values = that.get_values();
 
         var title;
         if (!values.length) {
@@ -240,8 +247,16 @@ IPA.search_facet = function(spec) {
                 for (var k=0; k<pkeys.length; k++) {
                     command.add_arg(pkeys[k]);
                 }
-
-                command.add_arg(values[i]);
+                var value = values[i];
+                if (value instanceof Object){
+                    for (var key in value){
+                        if (value.hasOwnProperty(key)){
+                            command.set_option(key, value[key]);
+                        }
+                    }
+                }else{
+                    command.add_arg(value);
+                }
                 batch.add_command(command);
             }
 
@@ -266,6 +281,8 @@ 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.table.empty();
diff --git a/install/ui/webui.js b/install/ui/webui.js
index ce2cf2dfe49bc760c53a62fffe2a232215d1e10c..4f27272f8eb969c312bc22ec195971776b509d21 100644
--- a/install/ui/webui.js
+++ b/install/ui/webui.js
@@ -53,8 +53,7 @@ IPA.admin_navigation = function(spec) {
             ]},
             {name: 'automount', label: IPA.messages.tabs.automount, children: [
                 {entity: 'automountlocation'},
-                {entity: 'automountmap'},
-                {entity: 'automountkey'}
+                {entity: 'automountmap'}
             ]},
             {entity: 'pwpolicy'},
             {entity: 'krbtpolicy'}
-- 
1.7.5.1

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

Reply via email to