From 587b7324fb1f6899deb151c30662362c18c5258e Mon Sep 17 00:00:00 2001 From: Pavel Vomacka Date: Fri, 9 Dec 2016 13:08:05 +0100 Subject: [PATCH] WebUI: allow to show rows with same pkey in tables Allows to show rows which have the same primary key. Used in Vault. https://fedorahosted.org/freeipa/ticket/5426 Reviewed-By: Martin Basti Reviewed-By: Petr Vobornik --- install/ui/src/freeipa/association.js | 24 ++++++++++-- install/ui/src/freeipa/automember.js | 5 ++- install/ui/src/freeipa/dns.js | 5 ++- install/ui/src/freeipa/facet.js | 56 ++++++++++++++++++++------- install/ui/src/freeipa/hbactest.js | 16 ++++++-- install/ui/src/freeipa/service.js | 10 ++++- install/ui/src/freeipa/topology.js | 4 +- 7 files changed, 90 insertions(+), 30 deletions(-) diff --git a/install/ui/src/freeipa/association.js b/install/ui/src/freeipa/association.js index 04b375a94..27a76a5cd 100644 --- a/install/ui/src/freeipa/association.js +++ b/install/ui/src/freeipa/association.js @@ -1042,6 +1042,7 @@ exp.association_facet = IPA.association_facet = function (spec, no_init) { that.facet_group = spec.facet_group; that.read_only = spec.read_only; + that.show_values_with_dup_key = spec.show_values_with_dup_key || false; that.associator = spec.associator || IPA.bulk_associator; that.add_method = spec.add_method || 'add_member'; @@ -1318,6 +1319,7 @@ exp.association_facet = IPA.association_facet = function (spec, no_init) { that.get_records_map = function(data) { var records_map = $.ordered_map(); + var pkeys_map = $.ordered_map(); var association_name = that.get_attribute_name(); var pkey_name = that.managed_entity.metadata.primary_key; @@ -1326,10 +1328,18 @@ exp.association_facet = IPA.association_facet = function (spec, no_init) { var pkey = pkeys[i]; var record = {}; record[pkey_name] = pkey; - records_map.put(pkey, record); + var compound_pkey = pkey; + if (that.show_values_with_dup_key) { + compound_pkey = pkey + i; + } + records_map.put(compound_pkey, record); + pkeys_map.put(compound_pkey, pkey); } - return records_map; + return { + records_map: records_map, + pkeys_map: pkeys_map + }; }; that.refresh = function() { @@ -1488,16 +1498,22 @@ exp.attribute_facet = IPA.attribute_facet = function(spec, no_init) { that.get_records_map = function(data) { var records_map = $.ordered_map(); + var pkeys_map = $.ordered_map(); var pkeys = data.result.result[that.attribute]; for (var i=0; pkeys && i} pkeys primary keys + * @param records_map of all records * @param {Function} on_success command success handler * @param {Function} on_failure command error handler */ - that.get_records = function(pkeys, on_success, on_error) { + that.get_records = function(records, pkeys, on_success, on_error) { - var batch = that.create_get_records_command(pkeys, on_success, on_error); + var batch = that.create_get_records_command(records, pkeys, on_success, on_error); batch.execute(); }; diff --git a/install/ui/src/freeipa/hbactest.js b/install/ui/src/freeipa/hbactest.js index 9ac4e8293..83e609381 100644 --- a/install/ui/src/freeipa/hbactest.js +++ b/install/ui/src/freeipa/hbactest.js @@ -706,12 +706,15 @@ IPA.hbac.test_run_facet = function(spec) { that.get_records_map = function(data) { var records_map = $.ordered_map(); + var pkeys_map = $.ordered_map(); var matched = data.result.matched; if (that.show_matched && matched) { for (var i=0; i