A new facet has been added to show entitlement status and download
the registration certificate.

--
Endi S. Dewata
From 34b60284da66082b7d7a954ed02b545665fd1d16 Mon Sep 17 00:00:00 2001
From: Endi S. Dewata <edew...@redhat.com>
Date: Wed, 27 Apr 2011 12:17:13 -0500
Subject: [PATCH] Entitlement status.

A new facet has been added to show entitlement status and download
the registration certificate.
---
 install/ui/associate.js                            |    6 +-
 install/ui/automount.js                            |    1 +
 install/ui/details.js                              |   49 +++--
 install/ui/dns.js                                  |    4 +-
 install/ui/entitle.js                              |  252 +++++++++++++++++---
 install/ui/entity.js                               |    8 +-
 install/ui/hbac.js                                 |    3 +-
 install/ui/ipa.css                                 |   32 +--
 install/ui/policy.js                               |    1 +
 install/ui/search.js                               |   33 ++-
 install/ui/serverconfig.js                         |    1 +
 install/ui/sudo.js                                 |    8 -
 install/ui/test/data/entitle_find_offline.json     |   32 +++
 ...{entitle_find.json => entitle_find_online.json} |    0
 install/ui/widget.js                               |    1 +
 15 files changed, 321 insertions(+), 110 deletions(-)
 create mode 100644 install/ui/test/data/entitle_find_offline.json
 rename install/ui/test/data/{entitle_find.json => entitle_find_online.json} (100%)

diff --git a/install/ui/associate.js b/install/ui/associate.js
index 657839f29a497df24fd0f262dec9258a9661f440..3a90f260e8fad67f82e8663169776136579c4496 100644
--- a/install/ui/associate.js
+++ b/install/ui/associate.js
@@ -666,8 +666,7 @@ IPA.association_table_widget = function (spec) {
 
         function on_error(xhr, text_status, error_thrown) {
             var summary = $('span[name=summary]', that.tfoot).empty();
-            summary.append('<p>Error: '+error_thrown.name+'</p>');
-            summary.append('<p>'+error_thrown.message+'</p>');
+            summary.append(error_thrown.name+': '+error_thrown.message);
         }
 
         var pkey = $.bbq.getState(that.entity_name+'-pkey');
@@ -1027,8 +1026,7 @@ IPA.association_facet = function (spec) {
                 function(xhr, text_status, error_thrown) {
                     that.table.empty();
                     var summary = that.table.summary.empty();
-                    summary.append('<p>Error: '+error_thrown.name+'</p>');
-                    summary.append('<p>'+error_thrown.message+'</p>');
+                    summary.append(error_thrown.name+': '+error_thrown.message);
                 }
             );
         }
diff --git a/install/ui/automount.js b/install/ui/automount.js
index d008c964fd1fe2e2f310ed72b9db3ce1862dc5c8..73419f70baaa982fad901423ee53e0e33358b4e0 100644
--- a/install/ui/automount.js
+++ b/install/ui/automount.js
@@ -31,6 +31,7 @@ IPA.entity_factories.automountlocation = function() {
         entity({name:'automountlocation',
                 title:IPA.messages.tabs.automount}).
         search_facet({
+            title: IPA.metadata.objects.automountlocation.label,
             columns:['cn']
         }).
         nested_search_facet({
diff --git a/install/ui/details.js b/install/ui/details.js
index c0b560cd63effc917ef4e2802b0701902cedd81b..7fa72eff5963ea98233fda7707af7e877ca902d9 100644
--- a/install/ui/details.js
+++ b/install/ui/details.js
@@ -266,7 +266,7 @@ IPA.details_facet = function(spec) {
 
     var that = IPA.facet(spec);
 
-    that.label = (IPA.messages && IPA.messages.facets && IPA.messages.facets.details) || spec.label;
+    that.label = spec.label || IPA.messages && IPA.messages.facets && IPA.messages.facets.details;
     that.facet_group = spec.facet_group || 'settings';
 
     that.sections = $.ordered_map();
@@ -334,18 +334,7 @@ IPA.details_facet = function(spec) {
         return pkey;
     };
 
-    that.create_header = function(container) {
-
-        that.facet_create_header(container);
-
-        that.pkey = $.bbq.getState(that.entity_name+'-pkey');
-        var label = IPA.metadata.objects[that.entity_name].label;
-
-        var title = that.title;
-        title = title.replace('${entity}', label);
-        title = title.replace('${primary_key}', that.pkey);
-
-        that.set_title(container, title);
+    that.create_controls = function() {
 
         that.reset_button = IPA.action_button({
             label: IPA.messages.buttons.reset,
@@ -366,11 +355,27 @@ IPA.details_facet = function(spec) {
                 return false;
             }
         }).appendTo(that.controls);
+    };
 
-        that.expand_button = $('<a/>', {
+    that.create_header = function(container) {
+
+        that.facet_create_header(container);
+
+        that.pkey = $.bbq.getState(that.entity_name+'-pkey');
+        var label = IPA.metadata.objects[that.entity_name].label;
+
+        var title = that.title;
+        title = title.replace('${entity}', label);
+        title = title.replace('${primary_key}', that.pkey);
+
+        that.set_title(container, title);
+
+        that.create_controls();
+
+        that.expand_button = IPA.action_button({
             name: 'expand_all',
             href: 'expand_all',
-            text: 'Expand All',
+            label: 'Expand All',
             'class': 'expand-collapse-all',
             style: 'display: none;',
             click: function() {
@@ -386,10 +391,10 @@ IPA.details_facet = function(spec) {
             }
         }).appendTo(that.controls);
 
-        that.collapse_button = $('<a/>', {
+        that.collapse_button = IPA.action_button({
             name: 'collapse_all',
             href: 'collapse_all',
-            text: 'Collapse All',
+            label: 'Collapse All',
             'class': 'expand-collapse-all',
             click: function() {
                 that.expand_button.css('display', 'inline');
@@ -514,7 +519,7 @@ IPA.details_facet = function(spec) {
         return false;
     };
 
-    that.load = function (record) {
+    that.load = function(record) {
         that.record = record;
         var sections = that.sections.values;
         for (var i=0; i<sections.length; i++) {
@@ -651,6 +656,7 @@ IPA.details_facet = function(spec) {
     that.details_facet_init = that.init;
     that.details_facet_create_content = that.create_content;
     that.details_facet_load = that.load;
+    that.details_facet_setup = that.setup;
 
     return that;
 };
@@ -669,7 +675,8 @@ IPA.button = function(spec) {
         id: spec.id,
         html: spec.label,
         title: spec.title || spec.label,
-        'class': 'ui-state-default ui-corner-all'
+        'class': 'ui-state-default ui-corner-all',
+        style: spec.style
     });
 
     if (spec.click) {
@@ -677,10 +684,10 @@ IPA.button = function(spec) {
     }
 
     if (spec['class']) button.addClass(spec['class']);
+    button.addClass('input_link');
 
     if (spec.icon) {
-        button.addClass('input_link');
-        button.append('<span class="ui-icon '+spec.icon+'" ></span> ');
+        button.prepend('<span class="ui-icon '+spec.icon+'" ></span> ');
     } else {
         button.addClass('button-without-icon');
     }
diff --git a/install/ui/dns.js b/install/ui/dns.js
index ff429452480120810f83b9ef098ccceab25ba388..55feaa034df471cde43894693f5cea17b78afd97 100644
--- a/install/ui/dns.js
+++ b/install/ui/dns.js
@@ -33,6 +33,7 @@ IPA.entity_factories.dnszone = function() {
     return IPA.entity_builder().
         entity('dnszone').
         search_facet({
+            title: IPA.metadata.objects.dnszone.label,
             columns:['idnsname']
         }).
         details_facet({
@@ -469,8 +470,7 @@ IPA.records_facet = function(spec) {
 
         function on_error(xhr, text_status, error_thrown) {
             var summary = $('span[name=summary]', that.table.tfoot).empty();
-            summary.append('<p>Error: '+error_thrown.name+'</p>');
-            summary.append('<p>'+error_thrown.message+'</p>');
+            summary.append(error_thrown.name+': '+error_thrown.message);
         }
 
         var options = {};
diff --git a/install/ui/entitle.js b/install/ui/entitle.js
index 7d56415c694d1394fa465a5ea9a61f42eda0ca38..13e83ca61bfbb56b7641b3953c87e744de5ee0cb 100644
--- a/install/ui/entitle.js
+++ b/install/ui/entitle.js
@@ -38,8 +38,59 @@ IPA.entity_factories.entitle = function() {
             factory: IPA.entitle.entity,
             name: 'entitle'
         }).
+        facet_groups([
+            { name: 'account', label: 'Account' },
+            { name: 'certificates', label: 'Certificates' }
+        ]).
+        details_facet({
+            factory: IPA.entitle.details_facet,
+            label: 'Account',
+            facet_group: 'account',
+            sections: [
+                {
+                    name: 'general',
+                    label: IPA.messages.details.general,
+                    fields: [
+                        {
+                            name: 'uuid',
+                            label: 'UUID',
+                            read_only: true
+                        },
+                        {
+                            factory: IPA.entitle.download_widget,
+                            name: 'certificate',
+                            label: 'Certificate'
+                        }
+                    ]
+                },
+                {
+                    name: 'status',
+                    label: 'Status',
+                    fields: [
+                        {
+                            name: 'product',
+                            label: 'Product',
+                            read_only: true
+                        },
+                        {
+                            name: 'quantity',
+                            label: 'Quantity',
+                            read_only: true
+                        },
+                        {
+                            name: 'consumed',
+                            label: 'Consumed',
+                            read_only: true
+                        }
+                    ]
+                }
+            ]
+        }).
         search_facet({
             factory: IPA.entitle.search_facet,
+            name: 'certificates',
+            label: 'Certificates',
+            facet_group: 'certificates',
             columns: [
                 {
                     name: 'product',
@@ -64,15 +115,6 @@ IPA.entity_factories.entitle = function() {
                 }
             ]
         }).
-        details_facet({
-            sections: [
-                {
-                    name: 'identity',
-                    label: IPA.messages.details.identity,
-                    fields: ['ipaentitlementid']
-                }
-            ]
-        }).
         standard_association_facets().
         dialog({
             factory: IPA.entitle.register_online_dialog,
@@ -150,6 +192,20 @@ IPA.entitle.entity = function(spec) {
 
     that.status = IPA.entitle.unregistered;
 
+    that.get_accounts = function(on_success, on_error) {
+
+        var command = IPA.command({
+            name: 'entitle_find_'+that.status,
+            entity: 'entitle',
+            method: 'find',
+            options: { all: true },
+            on_success: on_success,
+            on_error: on_error
+        });
+
+        command.execute();
+    };
+
     that.get_status = function(on_success, on_error) {
 
         var command = IPA.command({
@@ -252,7 +308,12 @@ IPA.entitle.entity = function(spec) {
             entity: 'entitle',
             method: 'import',
             args: [ certificate ],
-            on_success: on_success,
+            on_success: function(data, text_status, xhr) {
+                that.status = IPA.entitle.offline;
+                if (on_success) {
+                    on_success.call(this, data, text_status, xhr);
+                }
+            },
             on_error: on_error
         });
 
@@ -262,18 +323,16 @@ IPA.entitle.entity = function(spec) {
     return that;
 };
 
-IPA.entitle.search_facet = function(spec) {
+IPA.entitle.details_facet = function(spec) {
 
     spec = spec || {};
 
-    var that = IPA.search_facet(spec);
+    var that = IPA.details_facet(spec);
 
-    that.create_header = function(container) {
-
-        that.facet_create_header(container);
+    that.create_controls = function() {
 
         that.register_buttons = $('<span/>', {
-            style: 'display: none;'
+            name: 'register_buttons'
         }).appendTo(that.controls);
 
         that.register_online_button = IPA.action_button({
@@ -285,6 +344,8 @@ IPA.entitle.search_facet = function(spec) {
             }
         }).appendTo(that.register_buttons);
 
+        that.register_online_button.css('display', 'none');
+/*
         that.register_offline_button = IPA.action_button({
             label: 'Import',
             icon: 'ui-icon-plus',
@@ -294,29 +355,99 @@ IPA.entitle.search_facet = function(spec) {
             }
         }).appendTo(that.register_buttons);
 
+        that.register_offline_button.css('display', 'none');
+*/
+    };
+
+    that.show = function() {
+        that.facet_show();
+
+        that.entity.header.set_pkey(null);
+        that.entity.header.back_link.css('visibility', 'hidden');
+        that.entity.header.facet_tabs.css('visibility', 'visible');
+    };
+
+    that.refresh = function() {
+
+        var summary = $('span[name=summary]', that.container).empty();
+        summary.append('Loading...');
+
+        function on_success(data, text_status, xhr) {
+            if (that.entity.status == IPA.entitle.unregistered) {
+                that.register_online_button.css('display', 'inline');
+                // that.register_offline_button.css('display', 'inline');
+
+            } else {
+                that.register_online_button.css('display', 'none');
+                // that.register_offline_button.css('display', 'none');
+            }
+
+            that.load(data.result.result);
+
+            summary.empty();
+        }
+
+        function on_error(xhr, text_status, error_thrown) {
+
+            that.register_online_button.css('display', 'inline');
+            // that.register_offline_button.css('display', 'inline');
+
+            var result = {
+                uuid: '',
+                product: '',
+                quantity: 0,
+                consumed: 0
+            };
+            that.load(result);
+
+            summary.empty();
+            summary.append(error_thrown.name+': '+error_thrown.message);
+        }
+
+        that.entity.get_status(
+            on_success,
+            on_error);
+    };
+
+    return that;
+};
+
+IPA.entitle.search_facet = function(spec) {
+
+    spec = spec || {};
+    spec.selectable = false;
+
+    var that = IPA.search_facet(spec);
+
+    that.create_header = function(container) {
+
+        that.facet_create_header(container);
+
         that.consume_buttons = $('<span/>', {
-            style: 'display: none;'
+            name: 'consume_buttons'
         }).appendTo(that.controls);
 
         that.consume_button = IPA.action_button({
             label: 'Consume',
             icon: 'ui-icon-plus',
-            style: 'display: none;',
             click: function() {
                 var dialog = that.entity.get_dialog('consume');
                 dialog.open(that.container);
             }
         }).appendTo(that.consume_buttons);
 
+        that.consume_button.css('display', 'none');
+
         that.import_button = IPA.action_button({
             label: 'Import',
             icon: 'ui-icon-plus',
-            style: 'display: none;',
             click: function() {
                 var dialog = that.entity.get_dialog('import');
                 dialog.open(that.container);
             }
         }).appendTo(that.consume_buttons);
+
+        that.import_button.css('display', 'none');
     };
 
     that.show = function() {
@@ -324,31 +455,27 @@ IPA.entitle.search_facet = function(spec) {
 
         that.entity.header.set_pkey(null);
         that.entity.header.back_link.css('visibility', 'hidden');
-        that.entity.header.facet_tabs.css('visibility', 'hidden');
+        that.entity.header.facet_tabs.css('visibility', 'visible');
     };
 
     that.refresh = function() {
 
         function on_success(data, text_status, xhr) {
 
-            that.register_buttons.css('display', 'none');
-            that.consume_buttons.css('display', 'inline');
-
             if (that.entity.status == IPA.entitle.online) {
                 that.consume_button.css('display', 'inline');
                 that.import_button.css('display', 'none');
+
+            } else if (that.entity.status == IPA.entitle.offline) {
+                that.consume_button.css('display', 'none');
+                that.import_button.css('display', 'inline');
+
             } else {
                 that.consume_button.css('display', 'none');
-                that.import_button.css('display', 'inlnie');
+                that.import_button.css('display', 'inline');
             }
 
-            that.table.empty();
-
-            var result = data.result.result;
-            for (var i = 0; i<result.length; i++) {
-                var record = that.table.get_record(result[i], 0);
-                that.table.add_record(record);
-            }
+            that.load(data.result.result);
 
             var summary = $('span[name=summary]', that.table.tfoot).empty();
             if (data.result.truncated) {
@@ -362,11 +489,11 @@ IPA.entitle.search_facet = function(spec) {
 
         function on_error(xhr, text_status, error_thrown) {
 
-            that.register_buttons.css('display', 'inline');
-            that.consume_buttons.css('display', 'none');
+            that.consume_button.css('display', 'none');
+            that.import_button.css('display', 'inline');
 
             var summary = $('span[name=summary]', that.table.tfoot).empty();
-            summary.append(error_thrown.message);
+            summary.append(error_thrown.name+': '+error_thrown.message);
         }
 
         that.entity.get_status(
@@ -464,7 +591,8 @@ IPA.entitle.register_online_dialog = function(spec) {
             record.password,
             record.ipaentitlementid,
             function() {
-                var facet = that.entity.get_facet('search');
+                var facet_name = IPA.current_facet(that.entity);
+                var facet = that.entity.get_facet(facet_name);
                 facet.refresh();
                 that.close();
             }
@@ -488,7 +616,8 @@ IPA.entitle.register_offline_dialog = function(spec) {
         that.entity.register_offline(
             that.get_certificate(),
             function() {
-                var facet = that.entity.get_facet('search');
+                var facet_name = IPA.current_facet(that.entity);
+                var facet = that.entity.get_facet(facet_name);
                 facet.refresh();
                 that.close();
             }
@@ -520,7 +649,8 @@ IPA.entitle.consume_dialog = function(spec) {
         that.entity.consume(
             record.quantity,
             function() {
-                var facet = that.entity.get_facet('search');
+                var facet_name = IPA.current_facet(that.entity);
+                var facet = that.entity.get_facet(facet_name);
                 facet.refresh();
                 that.close();
             }
@@ -544,7 +674,8 @@ IPA.entitle.import_dialog = function(spec) {
         that.entity.import_certificate(
             that.get_certificate(),
             function() {
-                var facet = that.entity.get_facet('search');
+                var facet_name = IPA.current_facet(that.entity);
+                var facet = that.entity.get_facet(facet_name);
                 facet.refresh();
                 that.close();
             }
@@ -557,3 +688,48 @@ IPA.entitle.import_dialog = function(spec) {
 
     return that;
 };
+
+IPA.entitle.download_widget = function(spec) {
+
+    spec = spec || {};
+
+    var that = IPA.widget(spec);
+
+    that.create = function(container) {
+        that.link = $('<a/>', {
+            'href': '#download',
+            'html': 'Download',
+            'click': function() {
+                that.entity.get_accounts(
+                    function(data, text_status, xhr) {
+                        var userpkcs12 = data.result.result[0].userpkcs12;
+                        if (!userpkcs12) {
+                            alert('No certificate.');
+                            return;
+                        }
+
+                        var dialog = IPA.cert.download_dialog({
+                            title: 'Download Certificate',
+                            certificate: userpkcs12[0].__base64__,
+                            add_pem_delimiters: false
+                        });
+
+                        dialog.init();
+                        dialog.open();
+                    }
+                );
+                return false;
+            }
+        }).appendTo(container);
+    };
+
+    that.update = function() {
+        if (that.entity.status == IPA.entitle.online) {
+            that.link.css('display', 'inline');
+        } else {
+            that.link.css('display', 'none');
+        }
+    };
+
+    return that;
+};
diff --git a/install/ui/entity.js b/install/ui/entity.js
index deb1bd4bc05aca0d309765bf13df6723a97fc1ef..de57df544995df8a1f8721dfc6c9ff4698ec4f19 100644
--- a/install/ui/entity.js
+++ b/install/ui/entity.js
@@ -402,7 +402,7 @@ IPA.entity = function (spec) {
     return that;
 };
 
-IPA.current_facet =  function (entity){
+IPA.current_facet = function(entity) {
     var facet_name = $.bbq.getState(entity.name+'-facet');
     var facets = entity.facets.values;
     if (!facet_name  && facets.length) {
@@ -731,6 +731,7 @@ IPA.entity_builder = function(){
     that.search_facet = function(spec) {
 
         spec.entity_name = entity.name;
+        spec.title = spec.title || spec.label;
         spec.label = spec.label || IPA.messages.facets.search;
 
         var factory = spec.factory || IPA.search_facet;
@@ -758,7 +759,8 @@ IPA.entity_builder = function(){
         var sections = spec.sections;
         spec.sections = null;
         spec.entity_name = entity.name;
-        spec.label = IPA.messages.details.settings;
+        spec.title = spec.title || spec.label || IPA.messages.details.settings;
+        spec.label = spec.label || IPA.messages.facets.details;
 
         var factory = spec.factory || IPA.details_facet;
         facet = factory(spec);
@@ -900,7 +902,7 @@ IPA.entity_builder = function(){
 
     that.dialog = function(spec) {
         var dialog;
-        if (spec instanceof Object){
+        if (spec instanceof Object) {
             var factory = spec.factory || IPA.dialog;
             dialog = factory(spec);
         } else {
diff --git a/install/ui/hbac.js b/install/ui/hbac.js
index 64881a457363c12564f4b4dc1ce7f3220ef666c5..f18024e125a0f43e77396a903b86042821497645 100644
--- a/install/ui/hbac.js
+++ b/install/ui/hbac.js
@@ -995,8 +995,7 @@ IPA.hbacrule_accesstime_widget = function (spec) {
 
         function on_error(xhr, text_status, error_thrown) {
             var summary = $('span[name=summary]', that.table.tfoot).empty();
-            summary.append('<p>Error: '+error_thrown.name+'</p>');
-            summary.append('<p>'+error_thrown.message+'</p>');
+            summary.append(error_thrown.name+': '+error_thrown.message);
         }
 
         var pkey = $.bbq.getState(that.entity_name+'-pkey');
diff --git a/install/ui/ipa.css b/install/ui/ipa.css
index 7c434844621ca20ea6ac447e5f4cbf049cd3d64c..875cea9ac45aeb474073fe909c1211be56056a8e 100644
--- a/install/ui/ipa.css
+++ b/install/ui/ipa.css
@@ -102,7 +102,7 @@ body {
 }
 
 .input_link {
-    padding: .4em 1em .4em 2em;
+    padding: .4em 1em .4em 0em;
     text-decoration: none;
     position: relative;
     cursor: pointer;
@@ -117,20 +117,7 @@ body {
     -moz-border-radius: 0.3em;
         -webkit-border-radius: 0.3em;
     border: 1px solid #B8B8B8;
-    margin: -0.9em 0.4em 0em -0.3em;
-    position: absolute;
-    left: .2em;
-    top: 50%;
-}
-
-.input_link_disabled span.ui-icon {
-    -moz-border-radius: 0.3em;
-        -webkit-border-radius: 0.3em;
-    border: 1px solid #B8B8B8;
-    margin: -0.9em 0.4em 0em -0.3em;
-    position: absolute;
-    left: .2em;
-    top: 50%;
+    vertical-align: middle;
 }
 
 
@@ -508,6 +495,11 @@ div.tabs {
     background: -webkit-gradient(linear, left top, left bottom, from(#eeeeee), to(#dfdfdf));
 }
 
+.facet-controls {
+    position: relative;
+    min-height: 1.8em;
+}
+
 .facet-content {
     position: absolute;
     top: 75px;
@@ -844,11 +836,12 @@ span.attrhint {
 }
 
 .ui-icon {
-  //background-image: url("ui-icons_222222_256x240.png");
+    /* background-image: url("ui-icons_222222_256x240.png"); */
     background-color: #e2e2e2;
+    display: inline-block;
 }
 .ui-dialog .ui-dialog-content {
-    #this should go away once we can fix table scrolling
+    /* this should go away once we can fix table scrolling */
     overflow:auto;
 }
 
@@ -1128,6 +1121,7 @@ table.scrollable tbody {
 }
 
 .expand-collapse-all {
-    float: right;
+    position: absolute;
+    right: 0;
     padding-right: 1.5em;
-}
+}
\ No newline at end of file
diff --git a/install/ui/policy.js b/install/ui/policy.js
index bb544177b93178c337d053e4ae238d804ba6691f..f6bec48cf6b90bde2c94fdaddef103ce164f4084 100644
--- a/install/ui/policy.js
+++ b/install/ui/policy.js
@@ -51,6 +51,7 @@ IPA.entity_factories.krbtpolicy =  function() {
     return IPA.entity_builder().
         entity('krbtpolicy').
         details_facet({
+            title: IPA.metadata.objects.krbtpolicy.label,
             sections:[{
                 name: 'identity',
                 fields:[ 'krbmaxrenewableage','krbmaxticketlife' ]
diff --git a/install/ui/search.js b/install/ui/search.js
index cb80467cb3f5e18aebfeeced580503d160db00c0..5fdaefd5c4ba0b1caae0099291e8292897003d2d 100644
--- a/install/ui/search.js
+++ b/install/ui/search.js
@@ -35,6 +35,7 @@ IPA.search_facet = function(spec) {
     var that = IPA.table_facet(spec);
 
     that.search_all = spec.search_all || false;
+    that.selectable = spec.selectable;
 
     function get_values() {
         return that.table.get_selected_values();
@@ -77,7 +78,8 @@ IPA.search_facet = function(spec) {
             label: IPA.metadata.objects[entity.name].label,
             entity_name: entity.name,
             search_all: that.search_all,
-            scrollable: true
+            scrollable: true,
+            selectable: that.selectable
         });
 
         var columns = that.columns.values;
@@ -175,11 +177,12 @@ IPA.search_facet = function(spec) {
 
         var values = that.table.get_selected_values();
 
-        if (values.length === 0) {
-            that.remove_button.addClass('input_link_disabled');
-
-        } else {
-            that.remove_button.removeClass('input_link_disabled');
+        if (that.remove_button) {
+            if (values.length === 0) {
+                that.remove_button.addClass('input_link_disabled');
+            } else {
+                that.remove_button.removeClass('input_link_disabled');
+            }
         }
     };
 
@@ -269,6 +272,16 @@ IPA.search_facet = function(spec) {
         IPA.nav.push_state(state);
     };
 
+    that.load = function(result) {
+
+        that.table.empty();
+
+        for (var i = 0; i<result.length; i++) {
+            var record = that.table.get_record(result[i], 0);
+            that.table.add_record(record);
+        }
+    };
+
     that.refresh = function() {
         that.search_refresh(that.entity);
     };
@@ -279,13 +292,7 @@ IPA.search_facet = function(spec) {
 
         function on_success(data, text_status, xhr) {
 
-            that.table.empty();
-
-            var result = data.result.result;
-            for (var i = 0; i<result.length; i++) {
-                var record = that.table.get_record(result[i], 0);
-                that.table.add_record(record);
-            }
+            that.load(data.result.result);
 
             if (data.result.truncated) {
                 var message = IPA.messages.search.truncated;
diff --git a/install/ui/serverconfig.js b/install/ui/serverconfig.js
index 3c2b33e231e82281e8d019595893c035bf0c5fb3..a954a86f323971f983a89216887c0e95ea674814 100644
--- a/install/ui/serverconfig.js
+++ b/install/ui/serverconfig.js
@@ -31,6 +31,7 @@ IPA.entity_factories.config = function(){
     return IPA.entity_builder().
         entity('config').
         details_facet({
+            title: IPA.metadata.objects.config.label,
             sections:
             [{
             name: 'ipaserver',
diff --git a/install/ui/sudo.js b/install/ui/sudo.js
index f7ccd3cfd3e153fe669bdfbba6439e145491d722..9624ae8243abff265fc73abbae6da05280572be7 100644
--- a/install/ui/sudo.js
+++ b/install/ui/sudo.js
@@ -156,8 +156,6 @@ IPA.sudocmd_member_sudocmdgroup_table_widget = function (spec) {
 
     var that = IPA.association_table_widget(spec);
 
-    that.association_table_widget_init();
-
     that.get_records = function(on_success, on_error) {
 
         var length = that.values.length;
@@ -353,12 +351,6 @@ IPA.sudorule_details_facet = function (spec) {
     });
     that.add_section(section);
 
-    that.details_facet_init();
-
-    that.init = function() {
-
-    };
-
     that.update = function() {
 
         var pkey = $.bbq.getState(that.entity_name+'-pkey');
diff --git a/install/ui/test/data/entitle_find_offline.json b/install/ui/test/data/entitle_find_offline.json
new file mode 100644
index 0000000000000000000000000000000000000000..3980af6fb9c4ba82a6417fd42e18bbab47e056c5
--- /dev/null
+++ b/install/ui/test/data/entitle_find_offline.json
@@ -0,0 +1,32 @@
+{
+    "error": null,
+    "id": 0,
+    "result": {
+        "count": 1,
+        "result": [
+            {
+                "dn": "ipaentitlementid=b788ccee-4b09-48f0-8a9a-2c769f7b41e0,cn=entitlements,cn=etc,dc=idm,dc=lab,dc=bos,dc=redhat,dc=com",
+                "ipaentitlementid": [
+                    "IMPORTED"
+                ],
+                "ipauniqueid": [
+                    "c63b1972-5ffe-11e0-8340-00163e2fe6de"
+                ],
+                "objectclass": [
+                    "ipaobject",
+                    "ipaentitlement"
+                ],
+                "usercertificate": [
+                    {
+                        "__base64__": "MIIHVTCCBr6gAwIBAgIIY9jsLQtqWO8wDQYJKoZIhvcNAQEFBQAwRzEmMCQGA1UEAwwddm0tMDIyLmlkbS5sYWIuYm9zLnJlZGhhdC5jb20xCzAJBgNVBAYTAlVTMRAwDgYDVQQHDAdSYWxlaWdoMB4XDTExMDQwNTAwMDAwMFoXDTEyMDQwNDAwMDAwMFowKzEpMCcGA1UEAwwgOGE5MGNlOTYyZjI4ZGFiYjAxMmYyOGU4MmNjYjAyMjAwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCD0eal/e5ua7opJhvPdd3nr36p2l2t2WMDPRtyOo+h7yZOspoW+qAavd8HwBEbLNjVq56oMyB5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AQMAjMwMBIGCisGAQQBkggJBAoEBAwCNDIwGwYKKwYBBAGSCAkEDQQNDAsxMjMzMTEzMTIzMTARBgorBgEEAZIICQQOBAMMATAwEQYKKwYBBAGSCAkECwQDDAEzMDQGCisGAQQBkggJBQEEJgwkYjc4OGNjZWUtNGIwOS00OGYwLThhOWEtMmM3NjlmN2I0MWUwMA0GCSqGSIb3DQEBBQUAA4GBAGc7e1w8IkyBrhwgmPNSeYnvfgMzqWRaZnDPJ29u/xECc95/EU51/ieFsX91SXSxC7IOSHgy62AMVLDKomkx+i82a5iNjGxEEDEqodQgKioSsZ9zDJsBM8kQ3TeZgPrCxB0y/uKFwZ8QgZ74/EpEPj4v6gyOcF4rszDCTfb8V5/f"
+                    }
+                ]
+            }
+        ],
+        "summary": null,
+        "truncated": false
+    }
+}
\ No newline at end of file
diff --git a/install/ui/test/data/entitle_find.json b/install/ui/test/data/entitle_find_online.json
similarity index 100%
rename from install/ui/test/data/entitle_find.json
rename to install/ui/test/data/entitle_find_online.json
diff --git a/install/ui/widget.js b/install/ui/widget.js
index 6e70cc0a120e487d2dba0cb5b884a2334f781d1c..1af9fd8399a54784f5989c3a980f4f4d5cd373b7 100644
--- a/install/ui/widget.js
+++ b/install/ui/widget.js
@@ -126,6 +126,7 @@ IPA.widget = function(spec) {
 
     that.init = function() {
         if (that.entity_name) {
+            that.entity = IPA.get_entity(that.entity_name);
             that.param_info = IPA.get_entity_param(that.entity_name, that.name);
 
             if (that.param_info) {
-- 
1.7.4

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

Reply via email to