mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
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 <edewata@redhat.com>
This commit is contained in:
@@ -1965,7 +1965,9 @@ exp.table_facet = IPA.table_facet = function(spec, no_init) {
|
|||||||
|
|
||||||
var metadata = IPA.get_entity_param(entity.name, column.name);
|
var metadata = IPA.get_entity_param(entity.name, column.name);
|
||||||
column.primary_key = metadata && metadata.primary_key;
|
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) {
|
if (column.link && column.primary_key) {
|
||||||
column.link_handler = function(value) {
|
column.link_handler = function(value) {
|
||||||
|
|||||||
@@ -2489,6 +2489,8 @@ IPA.column = function (spec) {
|
|||||||
that.link = spec.link;
|
that.link = spec.link;
|
||||||
that.adapter = builder.build('adapter', spec.adapter || 'adapter', { context: that });
|
that.adapter = builder.build('adapter', spec.adapter || 'adapter', { context: that });
|
||||||
that.formatter = builder.build('formatter', spec.formatter);
|
that.formatter = builder.build('formatter', spec.formatter);
|
||||||
|
that.target_entity = spec.target_entity;
|
||||||
|
that.target_facet = spec.target_facet;
|
||||||
|
|
||||||
if (!that.entity) {
|
if (!that.entity) {
|
||||||
throw {
|
throw {
|
||||||
@@ -2585,6 +2587,10 @@ IPA.column = function (spec) {
|
|||||||
* Intended to be overridden.
|
* Intended to be overridden.
|
||||||
*/
|
*/
|
||||||
that.link_handler = function(value) {
|
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;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user