mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
ImportsourceHookTable: use root columns, improve
...styling fixes #243 fixes #1153
This commit is contained in:
parent
9cfc6bb46d
commit
c0a08584ef
@ -4,8 +4,10 @@ namespace Icinga\Module\Director\Web\Table;
|
|||||||
|
|
||||||
use Icinga\Data\DataArray\ArrayDatasource;
|
use Icinga\Data\DataArray\ArrayDatasource;
|
||||||
use Icinga\Module\Director\Hook\ImportSourceHook;
|
use Icinga\Module\Director\Hook\ImportSourceHook;
|
||||||
|
use Icinga\Module\Director\Import\SyncUtils;
|
||||||
use Icinga\Module\Director\Objects\ImportSource;
|
use Icinga\Module\Director\Objects\ImportSource;
|
||||||
use Icinga\Module\Director\PlainObjectRenderer;
|
use Icinga\Module\Director\PlainObjectRenderer;
|
||||||
|
use ipl\Html\Html;
|
||||||
use ipl\Web\Table\SimpleQueryBasedTable;
|
use ipl\Web\Table\SimpleQueryBasedTable;
|
||||||
|
|
||||||
class ImportsourceHookTable extends SimpleQueryBasedTable
|
class ImportsourceHookTable extends SimpleQueryBasedTable
|
||||||
@ -22,10 +24,11 @@ class ImportsourceHookTable extends SimpleQueryBasedTable
|
|||||||
public function getColumns()
|
public function getColumns()
|
||||||
{
|
{
|
||||||
if ($this->columnCache === null) {
|
if ($this->columnCache === null) {
|
||||||
$this->columnCache = array_merge(
|
$this->columnCache = SyncUtils::getRootVariables(
|
||||||
|
array_merge(
|
||||||
$this->sourceHook()->listColumns(),
|
$this->sourceHook()->listColumns(),
|
||||||
$this->source->listModifierTargetProperties()
|
$this->source->listModifierTargetProperties()
|
||||||
);
|
));
|
||||||
|
|
||||||
sort($this->columnCache);
|
sort($this->columnCache);
|
||||||
|
|
||||||
@ -58,7 +61,12 @@ class ImportsourceHookTable extends SimpleQueryBasedTable
|
|||||||
foreach ($this->getColumnsToBeRendered() as $column) {
|
foreach ($this->getColumnsToBeRendered() as $column) {
|
||||||
$td = $this::td();
|
$td = $this::td();
|
||||||
if (property_exists($row, $column)) {
|
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);
|
$tr->add($td);
|
||||||
}
|
}
|
||||||
|
@ -64,9 +64,11 @@ table.common-table {
|
|||||||
pre {
|
pre {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0.2em;
|
padding: 0.2em;
|
||||||
overflow: hidden;
|
max-height: 18em;
|
||||||
max-height: 12em;
|
|
||||||
background: @gray-lightest;
|
background: @gray-lightest;
|
||||||
|
overflow: auto;
|
||||||
|
word-break: keep-all;
|
||||||
|
white-space: pre;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user