From cd4c337002fa5c67d0dcad271790fc7130af47d1 Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Thu, 18 Sep 2014 17:28:41 +0200 Subject: webui: add simple link column support Usual link columns are link with primary key of current entity. This patch allows to create a link to arbitrary non-nested entity. Reviewed-By: Endi Sukma Dewata --- install/ui/src/freeipa/facet.js | 4 +++- install/ui/src/freeipa/widget.js | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/install/ui/src/freeipa/facet.js b/install/ui/src/freeipa/facet.js index c26df4e73..c06df00a8 100644 --- a/install/ui/src/freeipa/facet.js +++ b/install/ui/src/freeipa/facet.js @@ -1965,7 +1965,9 @@ exp.table_facet = IPA.table_facet = function(spec, no_init) { var metadata = IPA.get_entity_param(entity.name, column.name); column.primary_key = metadata && metadata.primary_key; - column.link = (column.link === undefined ? true : column.link) && column.primary_key; + if (column.primary_key) { + column.link = column.link === undefined ? true : column.link; + } if (column.link && column.primary_key) { column.link_handler = function(value) { diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index f44710384..c7a082b18 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -2489,6 +2489,8 @@ IPA.column = function (spec) { that.link = spec.link; that.adapter = builder.build('adapter', spec.adapter || 'adapter', { context: that }); that.formatter = builder.build('formatter', spec.formatter); + that.target_entity = spec.target_entity; + that.target_facet = spec.target_facet; if (!that.entity) { throw { @@ -2585,6 +2587,10 @@ IPA.column = function (spec) { * Intended to be overridden. */ that.link_handler = function(value) { + + // very simple implementation which doesn't handle navigation to + // nested entities + navigation.show_entity(that.target_entity, that.target_facet, [value]); return false; }; -- cgit