mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-28 08:14:04 +02:00
ImportedrowsTable: Render complex data types in pre tag
Just like ImportsourceHookTable. refs #1325
This commit is contained in:
parent
d69c5a7cc7
commit
034319dbe7
@ -2,9 +2,12 @@
|
|||||||
|
|
||||||
namespace Icinga\Module\Director\Web\Table;
|
namespace Icinga\Module\Director\Web\Table;
|
||||||
|
|
||||||
|
use dipl\Html\Html;
|
||||||
|
use dipl\Html\ValidHtml;
|
||||||
|
use dipl\Web\Table\SimpleQueryBasedTable;
|
||||||
use Icinga\Data\DataArray\ArrayDatasource;
|
use Icinga\Data\DataArray\ArrayDatasource;
|
||||||
use Icinga\Module\Director\Objects\ImportRun;
|
use Icinga\Module\Director\Objects\ImportRun;
|
||||||
use dipl\Web\Table\SimpleQueryBasedTable;
|
use Icinga\Module\Director\PlainObjectRenderer;
|
||||||
|
|
||||||
class ImportedrowsTable extends SimpleQueryBasedTable
|
class ImportedrowsTable extends SimpleQueryBasedTable
|
||||||
{
|
{
|
||||||
@ -49,6 +52,30 @@ class ImportedrowsTable extends SimpleQueryBasedTable
|
|||||||
return array_combine($cols, $cols);
|
return array_combine($cols, $cols);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function renderRow($row)
|
||||||
|
{
|
||||||
|
// Find a better place!
|
||||||
|
if ($row === null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
$tr = $this::tr();
|
||||||
|
|
||||||
|
foreach ($this->getColumnsToBeRendered() as $column) {
|
||||||
|
$td = $this::td();
|
||||||
|
if (property_exists($row, $column)) {
|
||||||
|
if (is_string($row->$column) || $row->$column instanceof ValidHtml) {
|
||||||
|
$td->setContent($row->$column);
|
||||||
|
} else {
|
||||||
|
$html = Html::tag('pre', null, PlainObjectRenderer::render($row->$column));
|
||||||
|
$td->setContent($html);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$tr->add($td);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $tr;
|
||||||
|
}
|
||||||
|
|
||||||
public function getColumnsToBeRendered()
|
public function getColumnsToBeRendered()
|
||||||
{
|
{
|
||||||
return $this->getColumns();
|
return $this->getColumns();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user