From 8cb211a24f141c6087be655f8754b21ca20d7266 Mon Sep 17 00:00:00 2001 From: Petr Vobornik Date: Thu, 15 Dec 2011 13:08:52 +0100 Subject: Distinguishing of external values in association tables Problem: Rule association widget was displaying standard records with external records in one table. User couldn't distinguish the values. When clicking on the external record link it navigated to appropriate page for that entity. But for external value there is no record to show so it displayed error. Solution: * For tables with possible external values a 'external' column was added. It displays "True" if the value is external and nothing if not. Displaying nothing is intentional. If user sees some text in external column he imidiately knows that the record is external without even reading the "True" text. * Rows with external values don't have a link for navigating to record page. This prevents showing the error as no record exists. Additional changes: * Association table widget was stripped of get_records method. Loading records isn't its resposibility it's a resposibility of field. * Column was extended by possible suppressing of link creation. It's done by optional suppress_link argument in setup method. * To allow setting suppress_link attribute in inherited tables a new overridable method was created - setup_column. Posible future improvements: * Table is using dynamic setting of width for columns. Each column has the same width. For flag columns such as 'external' the width of the column is too big. It would be better to be able to set smaller fixed width and the rest of the columns width (without the width set) would be computed (to fit the table). * When a table has displayed buttons in its last column header the cells in column header have different vertical alignmnent. It should be united. https://fedorahosted.org/freeipa/ticket/1993 --- install/ui/widget.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'install/ui/widget.js') diff --git a/install/ui/widget.js b/install/ui/widget.js index 69fe704b..ab39b24e 100644 --- a/install/ui/widget.js +++ b/install/ui/widget.js @@ -948,7 +948,7 @@ IPA.column = function (spec) { throw except; } - that.setup = function(container, record) { + that.setup = function(container, record, suppress_link) { container.empty(); @@ -958,7 +958,7 @@ IPA.column = function (spec) { } value = value ? value.toString() : ''; - if (that.link) { + if (that.link && !suppress_link) { $('', { href: '#'+value, text: value, @@ -1378,10 +1378,14 @@ IPA.table_widget = function (spec) { var div = $('div[name="'+column.name+'"]', tr); - column.setup(div, record); + that.setup_column(column, div, record); } }; + that.setup_column = function(column, div, record) { + column.setup(div, record); + }; + that.add_rows = function(rows) { for (var i=0; i