From c0a08584efe84e873f7812002e1867af972f4b43 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 5 Sep 2017 10:57:37 +0200 Subject: [PATCH] ImportsourceHookTable: use root columns, improve ...styling fixes #243 fixes #1153 --- .../Director/Web/Table/ImportsourceHookTable.php | 14 +++++++++++--- public/css/module.less | 6 ++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/library/Director/Web/Table/ImportsourceHookTable.php b/library/Director/Web/Table/ImportsourceHookTable.php index 92fc48b6..c44210af 100644 --- a/library/Director/Web/Table/ImportsourceHookTable.php +++ b/library/Director/Web/Table/ImportsourceHookTable.php @@ -4,8 +4,10 @@ namespace Icinga\Module\Director\Web\Table; use Icinga\Data\DataArray\ArrayDatasource; use Icinga\Module\Director\Hook\ImportSourceHook; +use Icinga\Module\Director\Import\SyncUtils; use Icinga\Module\Director\Objects\ImportSource; use Icinga\Module\Director\PlainObjectRenderer; +use ipl\Html\Html; use ipl\Web\Table\SimpleQueryBasedTable; class ImportsourceHookTable extends SimpleQueryBasedTable @@ -22,10 +24,11 @@ class ImportsourceHookTable extends SimpleQueryBasedTable public function getColumns() { if ($this->columnCache === null) { - $this->columnCache = array_merge( + $this->columnCache = SyncUtils::getRootVariables( + array_merge( $this->sourceHook()->listColumns(), $this->source->listModifierTargetProperties() - ); + )); sort($this->columnCache); @@ -58,7 +61,12 @@ class ImportsourceHookTable extends SimpleQueryBasedTable foreach ($this->getColumnsToBeRendered() as $column) { $td = $this::td(); if (property_exists($row, $column)) { - $td->setContent(PlainObjectRenderer::render($row->$column)); + if (is_string($row->$column)) { + $td->setContent($row->$column); + } else { + $html = Html::tag('pre', null, PlainObjectRenderer::render($row->$column)); + $td->setContent($html); + } } $tr->add($td); } diff --git a/public/css/module.less b/public/css/module.less index 445c046c..3d44b9f4 100644 --- a/public/css/module.less +++ b/public/css/module.less @@ -64,9 +64,11 @@ table.common-table { pre { margin: 0; padding: 0.2em; - overflow: hidden; - max-height: 12em; + max-height: 18em; background: @gray-lightest; + overflow: auto; + word-break: keep-all; + white-space: pre; display: inline-block; } }