From c09e392a66548d67034a174fe3d17cc27a0db259 Mon Sep 17 00:00:00 2001 From: Jonada Hoxha Date: Sun, 25 Aug 2024 21:46:11 +0200 Subject: [PATCH] Add `headers` --- .../controllers/DaemonsetController.php | 3 ++ .../controllers/DeploymentController.php | 3 ++ application/controllers/JobController.php | 3 ++ application/controllers/PodController.php | 48 +------------------ .../controllers/ReplicasetController.php | 3 ++ .../controllers/StatefulsetController.php | 3 ++ 6 files changed, 17 insertions(+), 46 deletions(-) diff --git a/application/controllers/DaemonsetController.php b/application/controllers/DaemonsetController.php index 1b7246c3..11125ad9 100644 --- a/application/controllers/DaemonsetController.php +++ b/application/controllers/DaemonsetController.php @@ -8,6 +8,7 @@ use Icinga\Module\Kubernetes\Model\DaemonSet; use Icinga\Module\Kubernetes\Web\Controller; use Icinga\Module\Kubernetes\Web\DaemonSetDetail; +use Icinga\Module\Kubernetes\Web\DaemonSetList; use ipl\Stdlib\Filter; use Ramsey\Uuid\Uuid; @@ -29,6 +30,8 @@ public function indexAction(): void $this->httpNotFound($this->translate('Daemon Set not found')); } + $this->addControl(new DaemonSetList([$daemonSet])); + $this->addContent(new DaemonSetDetail($daemonSet)); } } diff --git a/application/controllers/DeploymentController.php b/application/controllers/DeploymentController.php index f67d0d67..8198d338 100644 --- a/application/controllers/DeploymentController.php +++ b/application/controllers/DeploymentController.php @@ -8,6 +8,7 @@ use Icinga\Module\Kubernetes\Model\Deployment; use Icinga\Module\Kubernetes\Web\Controller; use Icinga\Module\Kubernetes\Web\DeploymentDetail; +use Icinga\Module\Kubernetes\Web\DeploymentList; use ipl\Stdlib\Filter; use Ramsey\Uuid\Uuid; @@ -29,6 +30,8 @@ public function indexAction(): void $this->httpNotFound($this->translate('Deployment not found')); } + $this->addControl(new DeploymentList([$deployment])); + $this->addContent(new DeploymentDetail($deployment)); } } diff --git a/application/controllers/JobController.php b/application/controllers/JobController.php index 8cdf5ab7..6cd1d5c4 100644 --- a/application/controllers/JobController.php +++ b/application/controllers/JobController.php @@ -7,6 +7,7 @@ use Icinga\Module\Kubernetes\Common\Database; use Icinga\Module\Kubernetes\Model\Job; use Icinga\Module\Kubernetes\Web\JobDetail; +use Icinga\Module\Kubernetes\Web\JobList; use ipl\Stdlib\Filter; use ipl\Web\Compat\CompatController; use Ramsey\Uuid\Uuid; @@ -29,6 +30,8 @@ public function indexAction(): void $this->httpNotFound($this->translate('Job not found')); } + $this->addControl(new JobList([$job])); + $this->addContent(new JobDetail($job)); } } diff --git a/application/controllers/PodController.php b/application/controllers/PodController.php index 9cc8376e..9a8b1c15 100644 --- a/application/controllers/PodController.php +++ b/application/controllers/PodController.php @@ -4,22 +4,13 @@ namespace Icinga\Module\Kubernetes\Controllers; -use Icinga\Module\Icingadb\Model\Behavior\ActionAndNoteUrl; -use Icinga\Module\Icingadb\Model\State; use Icinga\Module\Kubernetes\Common\Database; use Icinga\Module\Kubernetes\Model\Pod; -use Icinga\Module\Kubernetes\Web\EndpointTable; use Icinga\Module\Kubernetes\Web\PodDetail; -use ipl\Html\Attributes; -use ipl\Html\HtmlElement; -use ipl\Html\Text; +use Icinga\Module\Kubernetes\Web\PodList; use ipl\Stdlib\Filter; use ipl\Web\Compat\CompatController; use Ramsey\Uuid\Uuid; -use ipl\Web\Widget\HorizontalKeyValue; -use ipl\Web\Widget\StateBall; -use ipl\Web\Widget\TimeAgo; -use ipl\Web\Widget\TimeSince; class PodController extends CompatController { @@ -39,42 +30,7 @@ public function indexAction(): void $this->httpNotFound($this->translate('Pod not found')); } - $this->addControl( - new HtmlElement('div', new Attributes(['class' => 'resource-list item-list']), - new HtmlElement('div', new Attributes(['class' => 'list-item']), - new HtmlElement('div', new Attributes(['class' => 'visual']), - new StateBall('critical', StateBall::SIZE_MEDIUM_LARGE)), - new HtmlElement('div', new Attributes(['class' => 'main']), - new HtmlElement('header', null, - new HtmlElement('div', new Attributes(['class' => 'title']), - new HtmlElement('span', new Attributes(['class' => 'subject']), - new HtmlElement('i', new Attributes(['class' => 'ikicon-kubernetes ikicon-kubernetes-pod'])), - new Text($pod->name) - ), - new Text(' is '), - new HtmlElement('span', new Attributes(['class' => 'state-text']), new Text($pod->phase)) - ), - new TimeSince('1716284368') - ), - new HtmlElement('section', new Attributes(['class' => 'caption']), - new HorizontalKeyValue('created', new Text('2024-12-23 12:24')) - ), - /* - new HtmlElement('br'), - new Text($pod->uid), - new Text(' / '), - new Text($pod->resource_version), - */ - new HtmlElement('footer', null, - new HtmlElement('span', new Attributes(['class' => 'badge-namespace']), - new HtmlElement('i', new Attributes(['class' => 'ikicon-kubernetes ikicon-kubernetes-ns'])), - new Text($pod->namespace) - ) - ) - ) - ) - ) - ); + $this->addControl(new PodList([$pod])); $this->addContent(new PodDetail($pod)); } diff --git a/application/controllers/ReplicasetController.php b/application/controllers/ReplicasetController.php index d608ccf3..b1739948 100644 --- a/application/controllers/ReplicasetController.php +++ b/application/controllers/ReplicasetController.php @@ -8,6 +8,7 @@ use Icinga\Module\Kubernetes\Model\ReplicaSet; use Icinga\Module\Kubernetes\Web\Controller; use Icinga\Module\Kubernetes\Web\ReplicaSetDetail; +use Icinga\Module\Kubernetes\Web\ReplicaSetList; use ipl\Stdlib\Filter; use Ramsey\Uuid\Uuid; @@ -29,6 +30,8 @@ public function indexAction(): void $this->httpNotFound($this->translate('Replica Set not found')); } + $this->addControl(new ReplicaSetList([$replicaSet])); + $this->addContent(new ReplicaSetDetail($replicaSet)); } } diff --git a/application/controllers/StatefulsetController.php b/application/controllers/StatefulsetController.php index 86616ae0..94d65d5a 100644 --- a/application/controllers/StatefulsetController.php +++ b/application/controllers/StatefulsetController.php @@ -8,6 +8,7 @@ use Icinga\Module\Kubernetes\Model\StatefulSet; use Icinga\Module\Kubernetes\Web\Controller; use Icinga\Module\Kubernetes\Web\StatefulSetDetail; +use Icinga\Module\Kubernetes\Web\StatefulSetList; use ipl\Stdlib\Filter; use Ramsey\Uuid\Uuid; @@ -29,6 +30,8 @@ public function indexAction(): void $this->httpNotFound($this->translate('Stateful Set not found')); } + $this->addControl(new StatefulSetList([$statefulSet])); + $this->addContent(new StatefulSetDetail($statefulSet)); } }