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\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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue