diff --git a/library/Director/Web/Table/CoreApiFieldsTable.php b/library/Director/Web/Table/CoreApiFieldsTable.php index 90c3e5eb..df3ca887 100644 --- a/library/Director/Web/Table/CoreApiFieldsTable.php +++ b/library/Director/Web/Table/CoreApiFieldsTable.php @@ -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); } } diff --git a/library/Director/Web/Table/CoreApiObjectsTable.php b/library/Director/Web/Table/CoreApiObjectsTable.php index 0dd223d5..c2cefeaa 100644 --- a/library/Director/Web/Table/CoreApiObjectsTable.php +++ b/library/Director/Web/Table/CoreApiObjectsTable.php @@ -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', [ diff --git a/library/Director/Web/Table/CoreApiPrototypesTable.php b/library/Director/Web/Table/CoreApiPrototypesTable.php index ecc62bda..78fd964c 100644 --- a/library/Director/Web/Table/CoreApiPrototypesTable.php +++ b/library/Director/Web/Table/CoreApiPrototypesTable.php @@ -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()"))); } }