On 25.9.2014 19:07, Petr Vobornik wrote:
All issues will be done separately as already stated in other
sub-thread. I've removed issues which are discussed in the other
sub-thread.


2. The tab titles in the ID view details page are quite long, and the
"User ID overrides" and "Group ID overrides" labels aren't quite
appropriate because the ID view can override other attributes too. How
about using facet groups like in User Groups? For example:
- <ID view> applies to:
  - Hosts
- <ID view> overrides:
  - Users
  - Groups
- Settings


Attached patch 758




7. Related to #6, there probably should be a tab in the Host details
page showing which ID views apply to it.
There is only a single view and yes, it would be good to add a property
there, linking it to the ID view tab, if possible.

Will add simple readonly field (link to view). It will be improved later
(based on ipa-4-1 priorities)

Attached patch 760



9. This probably requires server support. In the "Apply to hosts"
association dialog, if a host is already added it will still appear in
the dialog box. As a comparison, a User that has been added into a
User Group will not appear in the association dialog anymore.
Could be trivially filtered out on Web UI side.

Will be implemented.

Attached patch 759 - quite ugly hack but does the job

--
Petr Vobornik
From b3c3791b78d1364e59f65d11976d83d5f278a437 Mon Sep 17 00:00:00 2001
From: Petr Vobornik <pvobo...@redhat.com>
Date: Fri, 26 Sep 2014 17:21:00 +0200
Subject: [PATCH] webui: add link from host to idview

https://fedorahosted.org/freeipa/ticket/4535
---
 install/ui/src/freeipa/host.js     |  7 +++++++
 install/ui/src/freeipa/util.js     | 17 ++++++++++++++++-
 install/ui/src/freeipa/widget.js   | 15 +++++++++++++++
 install/ui/test/data/ipa_init.json |  1 +
 ipalib/plugins/internal.py         |  1 +
 5 files changed, 40 insertions(+), 1 deletion(-)

diff --git a/install/ui/src/freeipa/host.js b/install/ui/src/freeipa/host.js
index 692441f6b7bdb3dd96bafa87451955b8d5e3a3f4..5b886b6394e73533d73f0d1a3d800922e4ef3e4d 100644
--- a/install/ui/src/freeipa/host.js
+++ b/install/ui/src/freeipa/host.js
@@ -112,6 +112,13 @@ return {
                             $type: 'checkbox',
                             acl_param: 'krbticketflags',
                             flags: ['w_if_no_aci']
+                        },
+                        {
+                            name: 'ipaassignedidview',
+                            $type: 'link',
+                            label: '@i18n:objects.idview.ipaassignedidview',
+                            ui_formatter: 'dn',
+                            other_entity: 'idview'
                         }
                     ]
                 },
diff --git a/install/ui/src/freeipa/util.js b/install/ui/src/freeipa/util.js
index 0032c8ace38c1c449589d558c6ee6cb3286bc54a..adebe2cdb397a1728d578c53a0f87a88f6f1f8e1 100644
--- a/install/ui/src/freeipa/util.js
+++ b/install/ui/src/freeipa/util.js
@@ -241,6 +241,13 @@ define([
         return els;
     }
 
+    function get_val_from_dn(dn, pos) {
+        if (!dn) return '';
+        pos = pos === undefined ? 0 : pos;
+        var val = dn.split(',')[pos].split('=')[1];
+        return val;
+    }
+
     /**
      * Module with utility functions
      * @class
@@ -362,7 +369,15 @@ define([
          * @param {string} text
          * @return {Array} array of jQuery elements
          */
-        beautify_message: beautify_message
+        beautify_message: beautify_message,
+
+        /**
+         * Return value of part of DN on specified position
+         * @param {string} dn Distinguished name
+         * @param {Number} [position=0] Zero-based DN part position
+         * @return {string}
+         */
+        get_val_from_dn: get_val_from_dn
     };
 
     return util;
diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js
index c7a082b187e06221846487fbb137811b9edb5e55..b9ab82cbceff5a8cef12828b0d4006fea2cf578e 100644
--- a/install/ui/src/freeipa/widget.js
+++ b/install/ui/src/freeipa/widget.js
@@ -2457,6 +2457,20 @@ IPA.datetime_formatter = function(spec) {
 };
 
 /**
+ * Format DN into single pkey
+ * @class
+ * @extends IPA.formatter
+ */
+IPA.dn_formatter = function(spec) {
+
+    var that = IPA.formatter(spec);
+    that.format = function(value) {
+        return util.get_val_from_dn(value);
+    };
+    return that;
+};
+
+/**
  * Column for {@link IPA.table_widget}
  *
  * Handles value rendering.
@@ -6180,6 +6194,7 @@ exp.register = function() {
     f.register('boolean', IPA.boolean_formatter);
     f.register('boolean_status', IPA.boolean_status_formatter);
     f.register('datetime', IPA.datetime_formatter);
+    f.register('dn', IPA.dn_formatter);
 };
 
 phases.on('registration', exp.register);
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index 9b6a528e4e72a4efc586ca87a71c7e6f1eaa47a6..f40ff14dfb3ecae40e6921da29ce3e2916121268 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -376,6 +376,7 @@
                             "apply_hostgroups_title": "Apply ID View ${primary_key} on hosts of ${entity}",
                             "apply_hosts": "Apply to hosts",
                             "apply_hosts_title": "Apply ID view ${primary_key} on ${entity}",
+                            "ipaassignedidview": "Assigned ID View",
                             "overrides_tab": "${primary_key} overrides:",
                             "unapply_hostgroups": "Un-apply from host groups",
                             "unapply_hostgroups_all_title": "Un-apply ID Views from hosts of hostgroups",
diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py
index c58f8314a67cb6cb54913c4e746bdbef18f0d928..43805daa8d8765e5d0adfb41d89c26c41dd061c0 100644
--- a/ipalib/plugins/internal.py
+++ b/ipalib/plugins/internal.py
@@ -520,6 +520,7 @@ class i18n_messages(Command):
                 "apply_hostgroups_title": _("Apply ID View ${primary_key} on hosts of ${entity}"),
                 "apply_hosts": _("Apply to hosts"),
                 "apply_hosts_title": _("Apply ID view ${primary_key} on ${entity}"),
+                "ipaassignedidview": _("Assigned ID View"),
                 "overrides_tab": _("${primary_key} overrides:"),
                 "unapply_hostgroups": _("Un-apply from host groups"),
                 "unapply_hostgroups_all_title": _("Un-apply ID Views from hosts of hostgroups"),
-- 
1.9.3

From 20bb0575a93bb5d0fc744c09e00940484a79e2ec Mon Sep 17 00:00:00 2001
From: Petr Vobornik <pvobo...@redhat.com>
Date: Fri, 26 Sep 2014 16:41:00 +0200
Subject: [PATCH] webui: list only not-applied hosts in "apply to host" dialog

https://fedorahosted.org/freeipa/ticket/4535
---
 install/ui/src/freeipa/idviews.js | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/install/ui/src/freeipa/idviews.js b/install/ui/src/freeipa/idviews.js
index 2ba1fd68158fd0110da67c5f606c1699c33e144b..18f48acb691ddc1265d8168139ba86472e126602 100644
--- a/install/ui/src/freeipa/idviews.js
+++ b/install/ui/src/freeipa/idviews.js
@@ -415,11 +415,12 @@ idviews.apply_action = function(spec) {
     /**
      * Create and open dialog
      */
-    that.show_dialog = function(facet, current_pkeys) {
+    that.show_dialog = function(facet) {
 
         var pkey = facet.get_pkey();
         var other_entity = reg.entity.get(that.other_entity);
         var other_entity_label = other_entity.metadata.label;
+        var exclude = that.get_exclude(facet);
         var title = text.get(that.dialog_title);
         title = title.replace('${entity}', other_entity_label);
         title = title.replace('${primary_key}', pkey);
@@ -430,7 +431,7 @@ idviews.apply_action = function(spec) {
             pkey: pkey,
             other_entity: other_entity,
             attribute_member: that.attribute_member,
-            exclude: current_pkeys || [],
+            exclude: exclude,
             add_button_label: that.confirm_button_label
         });
 
@@ -478,6 +479,25 @@ idviews.apply_action = function(spec) {
     };
 
     /**
+     * Get pkeys which should be excluded from offered pkeys in the dialog
+     *
+     * By default it works only for 'host' of 'appliedtohosts' facet since
+     * other facets might contain completely different values or might have
+     * different API.
+     *
+     * @param {facet.facet} facet
+     * @return {string[]}
+     */
+    that.get_exclude = function(facet) {
+        if (facet && facet.name === 'appliedtohosts' &&
+                that.other_entity === 'host') {
+            var records = facet.get_records_map(facet.data);
+            return records.keys;
+        }
+        return [];
+    };
+
+    /**
      * Notify idview.appliedtohosts facet that there were possible changes
      * and a refresh is needed.
      */
-- 
1.9.3

From e40f6d369903dee6856992d62d27208002eabfdb Mon Sep 17 00:00:00 2001
From: Petr Vobornik <pvobo...@redhat.com>
Date: Thu, 25 Sep 2014 15:50:41 +0200
Subject: [PATCH] webui: facet group labels for idview's facets

https://fedorahosted.org/freeipa/ticket/4535
---
 install/ui/src/freeipa/idviews.js  | 12 +++++++++++-
 install/ui/test/data/ipa_init.json |  2 ++
 ipalib/plugins/internal.py         |  2 ++
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/install/ui/src/freeipa/idviews.js b/install/ui/src/freeipa/idviews.js
index aa24122546a289a3dad43dce61b9c47381af8f33..2ba1fd68158fd0110da67c5f606c1699c33e144b 100644
--- a/install/ui/src/freeipa/idviews.js
+++ b/install/ui/src/freeipa/idviews.js
@@ -45,7 +45,17 @@ return {
     enable_test: function() {
         return true;
     },
-    facet_groups: ['appliedto', 'overrides', 'settings'],
+    facet_groups: [
+        {
+            name: 'appliedto',
+            label: '@i18n:objects.idview.appliesto_tab'
+        },
+        {
+            name: 'overrides',
+            label: '@i18n:objects.idview.overrides_tab'
+        },
+        'settings'
+    ],
     facets: [
         {
             $type: 'search',
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index dfeffd9d1924ab0a8978f2225fcac4af9f437000..9b6a528e4e72a4efc586ca87a71c7e6f1eaa47a6 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -369,12 +369,14 @@
                             "anchor_tooltip": "Enter trusted or IPA group name. Note: search doesn't list groups from trusted domains."
                         },
                         "idview": {
+                            "appliesto_tab": "${primary_key} applies to:",
                             "appliedtohosts": "Applied to hosts",
                             "appliedtohosts_title": "Applied to hosts",
                             "apply_hostgroups": "Apply to host groups",
                             "apply_hostgroups_title": "Apply ID View ${primary_key} on hosts of ${entity}",
                             "apply_hosts": "Apply to hosts",
                             "apply_hosts_title": "Apply ID view ${primary_key} on ${entity}",
+                            "overrides_tab": "${primary_key} overrides:",
                             "unapply_hostgroups": "Un-apply from host groups",
                             "unapply_hostgroups_all_title": "Un-apply ID Views from hosts of hostgroups",
                             "unapply_hostgroups_title": "Un-apply ID View ${primary_key} from hosts of ${entity}",
diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py
index c2e0bc0e8367463c04bd1606501e28fc643efe80..c58f8314a67cb6cb54913c4e746bdbef18f0d928 100644
--- a/ipalib/plugins/internal.py
+++ b/ipalib/plugins/internal.py
@@ -513,12 +513,14 @@ class i18n_messages(Command):
                 "anchor_tooltip": _("Enter trusted or IPA group name. Note: search doesn't list groups from trusted domains."),
             },
             "idview": {
+                "appliesto_tab": _("${primary_key} applies to:"),
                 "appliedtohosts": _("Applied to hosts"),
                 "appliedtohosts_title": _("Applied to hosts"),
                 "apply_hostgroups": _("Apply to host groups"),
                 "apply_hostgroups_title": _("Apply ID View ${primary_key} on hosts of ${entity}"),
                 "apply_hosts": _("Apply to hosts"),
                 "apply_hosts_title": _("Apply ID view ${primary_key} on ${entity}"),
+                "overrides_tab": _("${primary_key} overrides:"),
                 "unapply_hostgroups": _("Un-apply from host groups"),
                 "unapply_hostgroups_all_title": _("Un-apply ID Views from hosts of hostgroups"),
                 "unapply_hostgroups_title": _("Un-apply ID View ${primary_key} from hosts of ${entity}"),
-- 
1.9.3

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

Reply via email to