Core*Table: work with ipl, no header w/o content

This commit is contained in:
Thomas Gelf 2019-09-16 11:30:53 +02:00
parent de2ad48c4f
commit 5304be4ec0
3 changed files with 17 additions and 9 deletions

View File

@ -31,8 +31,10 @@ class CoreApiFieldsTable extends Table
public function assemble()
{
$this->header();
$body = $this->body();
if (empty($this->fields)) {
return;
}
$this->add(Html::tag('thead', Html::tag('tr', Html::wrapEach($this->getColumnsToBeRendered(), 'th'))));
foreach ($this->fields as $name => $field) {
$tr = $this::tr([
$this::td($name),
@ -45,7 +47,7 @@ class CoreApiFieldsTable extends Table
// $this::td($this->renderKeyValue($field->attributes))
]);
$this->addAttributeColumns($tr, $field->attributes);
$body->add($tr);
$this->add($tr);
}
}

View File

@ -4,6 +4,7 @@ namespace Icinga\Module\Director\Web\Table;
use Icinga\Module\Director\Objects\IcingaEndpoint;
use gipfl\IcingaWeb2\Link;
use ipl\Html\Html;
use ipl\Html\Table;
use gipfl\Translation\TranslationHelper;
@ -32,10 +33,12 @@ class CoreApiObjectsTable extends Table
public function assemble()
{
$this->header();
$body = $this->body();
if (empty($this->objects)) {
return;
}
$this->add(Html::tag('thead', Html::tag('tr', Html::wrapEach($this->getColumnsToBeRendered(), 'th'))));
foreach ($this->objects as $name) {
$body->add($this::tr($this::td(Link::create(
$this->add($this::tr($this::td(Link::create(
str_replace('!', ': ', $name),
'director/inspect/object',
[

View File

@ -2,6 +2,7 @@
namespace Icinga\Module\Director\Web\Table;
use ipl\Html\Html;
use ipl\Html\Table;
use gipfl\Translation\TranslationHelper;
@ -23,11 +24,13 @@ class CoreApiPrototypesTable extends Table
public function assemble()
{
$this->header();
$body = $this->body();
if (empty($this->prototypes)) {
return;
}
$this->add(Html::tag('thead', Html::tag('tr', Html::wrapEach($this->getColumnsToBeRendered(), 'th'))));
$type = $this->typeName;
foreach ($this->prototypes as $name) {
$body->add($this::tr($this::td("$type.$name()")));
$this->add($this::tr($this::td("$type.$name()")));
}
}