pvoborni's pull request #63: "fix for 6238 "Unable to view certificates issued 
by Sub CA in Web UI" separated from pr31" was opened

PR body:
"""
Pavel's patch separated from pr #31. Pavel is on vacation so he cannot split it.
"""

See the full pull-request at https://github.com/freeipa/freeipa/pull/63
... or pull the PR as Git branch:
git remote add ghfreeipa https://github.com/freeipa/freeipa
git fetch ghfreeipa pull/63/head:pr63
git checkout pr63
From 75b7e9a0f491b148844a8aa49453cd8f542e7fa0 Mon Sep 17 00:00:00 2001
From: Pavel Vomacka <pvoma...@redhat.com>
Date: Fri, 26 Aug 2016 12:50:00 +0200
Subject: [PATCH 1/2] Add support for additional options taken from table facet

Sometimes the entity_show command must be called with options which are gathered
from result of entity_find command. These options needs to be passed as
arguments in URL which points to details page.

This functionality is implemented to table facet. There is new property
'additional_navigation_arguments' which is prepared for array of attributes
which will be passed to URL.

Part of: https://fedorahosted.org/freeipa/ticket/6238
---
 install/ui/src/freeipa/facet.js | 49 ++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 48 insertions(+), 1 deletion(-)

diff --git a/install/ui/src/freeipa/facet.js b/install/ui/src/freeipa/facet.js
index 4553c5c..06eca18 100644
--- a/install/ui/src/freeipa/facet.js
+++ b/install/ui/src/freeipa/facet.js
@@ -1819,6 +1819,15 @@ exp.table_facet = IPA.table_facet = function(spec, no_init) {
     var that = IPA.facet(spec, no_init);
 
     /**
+     * Names of additional row attributes which will be send to another facet
+     * during navigation as URL parameters.
+     *
+     * @property {Array<string>}
+     */
+    that.additional_navigation_arguments = spec.additional_navigation_arguments;
+
+
+    /**
      * Entity of data displayed in the table
      * @property {entity.entity}
      */
@@ -2268,6 +2277,38 @@ exp.table_facet = IPA.table_facet = function(spec, no_init) {
 
 
     /**
+     * Extract data from command response and return them.
+     *
+     * @param pkey {string} primary key of row which is chosen
+     * @param attrs {Array} names of attributes which will be extracted
+     */
+    that.get_row_attribute_values = function(key, attrs) {
+        var result = that.data.result.result;
+        var options = {};
+        var row;
+
+        if (result) {
+            for (var i=0, l=result.length; i<l; i++) {
+                row = result[i];
+
+                var pkey = row[that.table.name];
+                if (pkey == key) break;
+            }
+
+            if (row) {
+                for (var j=0, le=attrs.length; j<le; j++) {
+                    var attr = attrs[j];
+                    var new_attr = {};
+                    new_attr[attr] = row[attr];
+                    $.extend(options, new_attr);
+                }
+            }
+        }
+
+        return options;
+    };
+
+    /**
      *
      * Method which will be called after clicking on pkey in table.
      *
@@ -2279,6 +2320,12 @@ exp.table_facet = IPA.table_facet = function(spec, no_init) {
      */
     that.on_column_link_click = function(value, entity) {
         var pkeys = [value];
+        var args;
+
+        var attributes = that.additional_navigation_arguments;
+        if (lang.isArray(attributes)) {
+            args = that.get_row_attribute_values(value, attributes);
+        }
 
         // for nested entities
         var containing_entity = entity.get_containing_entity();
@@ -2287,7 +2334,7 @@ exp.table_facet = IPA.table_facet = function(spec, no_init) {
             pkeys.push(value);
         }
 
-        navigation.show_entity(entity.name, that.details_facet_name, pkeys);
+        navigation.show_entity(entity.name, that.details_facet_name, pkeys, args);
         return false;
     };
 

From 394fe75faccf732c20118de4d351b99e6aa98089 Mon Sep 17 00:00:00 2001
From: Pavel Vomacka <pvoma...@redhat.com>
Date: Fri, 26 Aug 2016 13:03:58 +0200
Subject: [PATCH 2/2] WebUI: Fix showing certificates issued by sub-CA

The cert-show command needs to be called with cacn option. Cacn option is
passed using URL attribute.

https://fedorahosted.org/freeipa/ticket/6238
---
 install/ui/src/freeipa/certificate.js | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/install/ui/src/freeipa/certificate.js b/install/ui/src/freeipa/certificate.js
index 232bdbf..e67c348 100755
--- a/install/ui/src/freeipa/certificate.js
+++ b/install/ui/src/freeipa/certificate.js
@@ -1543,6 +1543,7 @@ return {
             row_enabled_attribute: 'status',
             facet_groups: [exp.facet_group],
             facet_group: 'certificates',
+            additional_navigation_arguments: [ 'cacn' ],
             pagination: false,
             no_update: true,
             columns: [
@@ -1552,6 +1553,7 @@ return {
                     width: '90px'
                 },
                 'subject',
+                'cacn',
                 {
                     name: 'status',
                     width: '120px'
@@ -1645,6 +1647,7 @@ return {
                     fields: [
                         'serial_number',
                         'serial_number_hex',
+                        'cacn',
                         'subject',
                         {
                             name: 'issuer',
@@ -1772,6 +1775,10 @@ IPA.cert.details_facet = function(spec, no_init) {
         var command = that.details_facet_create_refresh_command();
         delete command.options.all;
         delete command.options.rights;
+
+        command.options = command.options || {};
+        $.extend(command.options, { cacn: that.state.cacn });
+
         return command;
     };
 
-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to