summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2014-09-26 17:21:00 +0200
committerPetr Vobornik <pvoborni@redhat.com>2014-09-30 10:47:03 +0200
commit00d598bab043e277d3f57eab5092c04cf5d6f5f8 (patch)
treecdb65d124843c4e8957814ac9ad8c00ec0a9058e
parent0e76bc1cb65b3eb81b37b4b45ccb71bf91fe5fbc (diff)
downloadfreeipa-00d598bab043e277d3f57eab5092c04cf5d6f5f8.tar.gz
freeipa-00d598bab043e277d3f57eab5092c04cf5d6f5f8.tar.xz
freeipa-00d598bab043e277d3f57eab5092c04cf5d6f5f8.zip
webui: add link from host to idview
https://fedorahosted.org/freeipa/ticket/4535 Reviewed-By: Endi Sukma Dewata <edewata@redhat.com>
-rw-r--r--install/ui/src/freeipa/host.js7
-rw-r--r--install/ui/src/freeipa/util.js17
-rw-r--r--install/ui/src/freeipa/widget.js15
-rw-r--r--install/ui/test/data/ipa_init.json1
-rw-r--r--ipalib/plugins/internal.py1
5 files changed, 40 insertions, 1 deletions
diff --git a/install/ui/src/freeipa/host.js b/install/ui/src/freeipa/host.js
index 692441f6b..5b886b639 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 0032c8ace..adebe2cdb 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 c7a082b18..b9ab82cbc 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 9b6a528e4..f40ff14df 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 c58f8314a..43805daa8 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"),