diff --git a/application/controllers/DaemonsetController.php b/application/controllers/DaemonsetController.php index 48148666..a1471d4d 100644 --- a/application/controllers/DaemonsetController.php +++ b/application/controllers/DaemonsetController.php @@ -10,6 +10,7 @@ use Icinga\Module\Kubernetes\Web\Controller; use Icinga\Module\Kubernetes\Web\DaemonSetDetail; use Icinga\Module\Kubernetes\Web\DaemonSetList; +use Icinga\Module\Kubernetes\Web\ViewModeSwitcher; use ipl\Stdlib\Filter; use Ramsey\Uuid\Uuid; @@ -33,7 +34,7 @@ public function indexAction(): void $this->httpNotFound($this->translate('Daemon Set not found')); } - $this->addControl(new DaemonSetList([$daemonSet])); + $this->addControl((new DaemonSetList([$daemonSet]))->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED)); $this->addContent(new DaemonSetDetail($daemonSet)); } diff --git a/application/controllers/DeploymentController.php b/application/controllers/DeploymentController.php index 8692c2d1..77c928e6 100644 --- a/application/controllers/DeploymentController.php +++ b/application/controllers/DeploymentController.php @@ -10,6 +10,7 @@ use Icinga\Module\Kubernetes\Web\Controller; use Icinga\Module\Kubernetes\Web\DeploymentDetail; use Icinga\Module\Kubernetes\Web\DeploymentList; +use Icinga\Module\Kubernetes\Web\ViewModeSwitcher; use ipl\Stdlib\Filter; use Ramsey\Uuid\Uuid; @@ -33,7 +34,7 @@ public function indexAction(): void $this->httpNotFound($this->translate('Deployment not found')); } - $this->addControl(new DeploymentList([$deployment])); + $this->addControl((new DeploymentList([$deployment]))->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED)); $this->addContent(new DeploymentDetail($deployment)); } diff --git a/application/controllers/JobController.php b/application/controllers/JobController.php index fe3dc1b2..6db9424e 100644 --- a/application/controllers/JobController.php +++ b/application/controllers/JobController.php @@ -10,6 +10,7 @@ use Icinga\Module\Kubernetes\Web\Controller; use Icinga\Module\Kubernetes\Web\JobDetail; use Icinga\Module\Kubernetes\Web\JobList; +use Icinga\Module\Kubernetes\Web\ViewModeSwitcher; use ipl\Stdlib\Filter; use Ramsey\Uuid\Uuid; @@ -33,7 +34,7 @@ public function indexAction(): void $this->httpNotFound($this->translate('Job not found')); } - $this->addControl(new JobList([$job])); + $this->addControl((new JobList([$job]))->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED)); $this->addContent(new JobDetail($job)); } diff --git a/application/controllers/NodeController.php b/application/controllers/NodeController.php index 41c7e84c..daddba11 100644 --- a/application/controllers/NodeController.php +++ b/application/controllers/NodeController.php @@ -10,6 +10,7 @@ use Icinga\Module\Kubernetes\Web\Controller; use Icinga\Module\Kubernetes\Web\NodeDetail; use Icinga\Module\Kubernetes\Web\NodeList; +use Icinga\Module\Kubernetes\Web\ViewModeSwitcher; use ipl\Stdlib\Filter; use Ramsey\Uuid\Uuid; @@ -33,7 +34,7 @@ public function indexAction(): void $this->httpNotFound($this->translate('Node not found')); } - $this->addControl(new NodeList([$node])); + $this->addControl((new NodeList([$node]))->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED)); $this->addContent(new NodeDetail($node)); } diff --git a/application/controllers/PodController.php b/application/controllers/PodController.php index b604ed66..d98c4826 100644 --- a/application/controllers/PodController.php +++ b/application/controllers/PodController.php @@ -10,6 +10,7 @@ use Icinga\Module\Kubernetes\Web\Controller; use Icinga\Module\Kubernetes\Web\PodDetail; use Icinga\Module\Kubernetes\Web\PodList; +use Icinga\Module\Kubernetes\Web\ViewModeSwitcher; use ipl\Stdlib\Filter; use Ramsey\Uuid\Uuid; @@ -32,8 +33,8 @@ public function indexAction(): void if ($pod === null) { $this->httpNotFound($this->translate('Pod not found')); } - - $this->addControl(new PodList([$pod])); + + $this->addControl((new PodList([$pod]))->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED)); $this->addContent(new PodDetail($pod)); } diff --git a/application/controllers/ReplicasetController.php b/application/controllers/ReplicasetController.php index 2b64ac20..66714ce1 100644 --- a/application/controllers/ReplicasetController.php +++ b/application/controllers/ReplicasetController.php @@ -10,6 +10,7 @@ use Icinga\Module\Kubernetes\Web\Controller; use Icinga\Module\Kubernetes\Web\ReplicaSetDetail; use Icinga\Module\Kubernetes\Web\ReplicaSetList; +use Icinga\Module\Kubernetes\Web\ViewModeSwitcher; use ipl\Stdlib\Filter; use Ramsey\Uuid\Uuid; @@ -33,7 +34,7 @@ public function indexAction(): void $this->httpNotFound($this->translate('Replica Set not found')); } - $this->addControl(new ReplicaSetList([$replicaSet])); + $this->addControl((new ReplicaSetList([$replicaSet]))->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED)); $this->addContent(new ReplicaSetDetail($replicaSet)); } diff --git a/application/controllers/StatefulsetController.php b/application/controllers/StatefulsetController.php index f32cb69d..0edb0742 100644 --- a/application/controllers/StatefulsetController.php +++ b/application/controllers/StatefulsetController.php @@ -10,6 +10,7 @@ use Icinga\Module\Kubernetes\Web\Controller; use Icinga\Module\Kubernetes\Web\StatefulSetDetail; use Icinga\Module\Kubernetes\Web\StatefulSetList; +use Icinga\Module\Kubernetes\Web\ViewModeSwitcher; use ipl\Stdlib\Filter; use Ramsey\Uuid\Uuid; @@ -33,7 +34,7 @@ public function indexAction(): void $this->httpNotFound($this->translate('Stateful Set not found')); } - $this->addControl(new StatefulSetList([$statefulSet])); + $this->addControl((new StatefulSetList([$statefulSet]))->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED)); $this->addContent(new StatefulSetDetail($statefulSet)); } diff --git a/library/Kubernetes/Common/BaseItemList.php b/library/Kubernetes/Common/BaseItemList.php index 204c8bfa..f9951f13 100644 --- a/library/Kubernetes/Common/BaseItemList.php +++ b/library/Kubernetes/Common/BaseItemList.php @@ -66,7 +66,10 @@ protected function assemble(): void Filter::equal('id', Uuid::fromBytes($item->uuid)->toString()) ) ]); - $listItem->setViewMode($this->getViewMode()); + + if ($this->getViewMode() !== null) { + $listItem->setViewMode($this->getViewMode()); + } $this->addHtml( $listItem diff --git a/library/Kubernetes/Web/CronJobDetail.php b/library/Kubernetes/Web/CronJobDetail.php index c9d0f90f..e5e9d7ea 100644 --- a/library/Kubernetes/Web/CronJobDetail.php +++ b/library/Kubernetes/Web/CronJobDetail.php @@ -68,10 +68,11 @@ protected function assemble(): void 'section', null, new HtmlElement('h2', null, new Text($this->translate('Jobs'))), - new JobList(Auth::getInstance()->withRestrictions( + (new JobList(Auth::getInstance()->withRestrictions( Auth::SHOW_JOBS, $this->cronJob->job - )) + ))) + ->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED) )); } @@ -80,8 +81,9 @@ protected function assemble(): void 'section', null, new HtmlElement('h2', null, new Text($this->translate('Events'))), - new EventList(Event::on(Database::connection()) - ->filter(Filter::equal('reference_uuid', $this->cronJob->uuid))) + (new EventList(Event::on(Database::connection()) + ->filter(Filter::equal('reference_uuid', $this->cronJob->uuid)))) + ->setViewMode(ViewModeSwitcher::VIEW_MODE_COMMON) )); } diff --git a/library/Kubernetes/Web/DaemonSetDetail.php b/library/Kubernetes/Web/DaemonSetDetail.php index 1e49a2b8..591a72ed 100644 --- a/library/Kubernetes/Web/DaemonSetDetail.php +++ b/library/Kubernetes/Web/DaemonSetDetail.php @@ -89,10 +89,11 @@ protected function assemble(): void 'section', null, new HtmlElement('h2', null, new Text($this->translate('Pods'))), - new PodList(Auth::getInstance()->withRestrictions( + (new PodList(Auth::getInstance()->withRestrictions( Auth::SHOW_PODS, $this->daemonSet->pod->with(['node']) - )) + ))) + ->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED) )); } @@ -101,8 +102,9 @@ protected function assemble(): void 'section', null, new HtmlElement('h2', null, new Text($this->translate('Events'))), - new EventList(Event::on(Database::connection()) - ->filter(Filter::equal('reference_uuid', $this->daemonSet->uuid))) + (new EventList(Event::on(Database::connection()) + ->filter(Filter::equal('reference_uuid', $this->daemonSet->uuid)))) + ->setViewMode(ViewModeSwitcher::VIEW_MODE_COMMON) )); } diff --git a/library/Kubernetes/Web/DeploymentDetail.php b/library/Kubernetes/Web/DeploymentDetail.php index 07bcef92..b9c397f7 100644 --- a/library/Kubernetes/Web/DeploymentDetail.php +++ b/library/Kubernetes/Web/DeploymentDetail.php @@ -91,10 +91,11 @@ protected function assemble(): void 'section', null, new HtmlElement('h2', null, new Text($this->translate('Replica Sets'))), - new ReplicaSetList(Auth::getInstance()->withRestrictions( + (new ReplicaSetList(Auth::getInstance()->withRestrictions( Auth::SHOW_REPLICA_SETS, $this->deployment->replica_set - )) + ))) + ->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED) )); } @@ -103,8 +104,9 @@ protected function assemble(): void 'section', null, new HtmlElement('h2', null, new Text($this->translate('Events'))), - new EventList(Event::on(Database::connection()) - ->filter(Filter::equal('reference_uuid', $this->deployment->uuid))) + (new EventList(Event::on(Database::connection()) + ->filter(Filter::equal('reference_uuid', $this->deployment->uuid)))) + ->setViewMode(ViewModeSwitcher::VIEW_MODE_COMMON) )); } diff --git a/library/Kubernetes/Web/EventDetail.php b/library/Kubernetes/Web/EventDetail.php index 9f107008..413481a7 100644 --- a/library/Kubernetes/Web/EventDetail.php +++ b/library/Kubernetes/Web/EventDetail.php @@ -58,7 +58,7 @@ protected function assemble(): void 'section', null, new HtmlElement('h2', null, new Text($this->translate('Referent'))), - Factory::createList($this->event->reference_kind, Filter::equal('uuid', $this->event->reference_uuid)) + Factory::createList($this->event->reference_kind, Filter::equal('uuid', $this->event->reference_uuid)) // TODO fix with restrictions ) ); diff --git a/library/Kubernetes/Web/JobDetail.php b/library/Kubernetes/Web/JobDetail.php index b77a64e6..b2344613 100644 --- a/library/Kubernetes/Web/JobDetail.php +++ b/library/Kubernetes/Web/JobDetail.php @@ -87,10 +87,11 @@ protected function assemble(): void 'section', null, new HtmlElement('h2', null, new Text($this->translate('Pods'))), - new PodList(Auth::getInstance()->withRestrictions( + (new PodList(Auth::getInstance()->withRestrictions( Auth::SHOW_PODS, $this->job->pod->with(['node']) - )) + ))) + ->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED) )); } @@ -99,8 +100,9 @@ protected function assemble(): void 'section', null, new HtmlElement('h2', null, new Text('Events')), - new EventList(Event::on(Database::connection()) - ->filter(Filter::equal('reference_uuid', $this->job->uuid))) + (new EventList(Event::on(Database::connection()) + ->filter(Filter::equal('reference_uuid', $this->job->uuid)))) + ->setViewMode(ViewModeSwitcher::VIEW_MODE_COMMON) )); } diff --git a/library/Kubernetes/Web/NamespaceDetail.php b/library/Kubernetes/Web/NamespaceDetail.php index 50c45b97..846afd35 100644 --- a/library/Kubernetes/Web/NamespaceDetail.php +++ b/library/Kubernetes/Web/NamespaceDetail.php @@ -55,8 +55,9 @@ protected function assemble(): void 'section', null, new HtmlElement('h2', null, new Text($this->translate('Events'))), - new EventList(Event::on(Database::connection()) - ->filter(Filter::equal('reference_uuid', $this->namespace->uuid))) + (new EventList(Event::on(Database::connection()) + ->filter(Filter::equal('reference_uuid', $this->namespace->uuid)))) + ->setViewMode(ViewModeSwitcher::VIEW_MODE_COMMON) )); } diff --git a/library/Kubernetes/Web/NodeDetail.php b/library/Kubernetes/Web/NodeDetail.php index 31426411..6421f912 100644 --- a/library/Kubernetes/Web/NodeDetail.php +++ b/library/Kubernetes/Web/NodeDetail.php @@ -101,8 +101,9 @@ protected function assemble(): void 'section', null, new HtmlElement('h2', null, new Text($this->translate('Events'))), - new EventList(Event::on(Database::connection()) - ->filter(Filter::equal('reference_uuid', $this->node->uuid))) + (new EventList(Event::on(Database::connection()) + ->filter(Filter::equal('reference_uuid', $this->node->uuid)))) + ->setViewMode(ViewModeSwitcher::VIEW_MODE_COMMON) )); } diff --git a/library/Kubernetes/Web/PersistentVolumeClaimDetail.php b/library/Kubernetes/Web/PersistentVolumeClaimDetail.php index b7f6deca..15a6cbfc 100644 --- a/library/Kubernetes/Web/PersistentVolumeClaimDetail.php +++ b/library/Kubernetes/Web/PersistentVolumeClaimDetail.php @@ -73,10 +73,11 @@ protected function assemble(): void 'section', null, new HtmlElement('h2', null, new Text($this->translate('Pods'))), - new PodList(Auth::getInstance()->withRestrictions( + (new PodList(Auth::getInstance()->withRestrictions( Auth::SHOW_PODS, $this->pvc->pod - )) + ))) + ->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED) )); } @@ -85,8 +86,9 @@ protected function assemble(): void 'section', null, new HtmlElement('h2', null, new Text($this->translate('Events'))), - new EventList(Event::on(Database::connection()) - ->filter(Filter::equal('reference_uuid', $this->pvc->uuid))) + (new EventList(Event::on(Database::connection()) + ->filter(Filter::equal('reference_uuid', $this->pvc->uuid)))) + ->setViewMode(ViewModeSwitcher::VIEW_MODE_COMMON) )); } diff --git a/library/Kubernetes/Web/PersistentVolumeDetail.php b/library/Kubernetes/Web/PersistentVolumeDetail.php index 2abc1b15..9836de99 100644 --- a/library/Kubernetes/Web/PersistentVolumeDetail.php +++ b/library/Kubernetes/Web/PersistentVolumeDetail.php @@ -67,10 +67,11 @@ protected function assemble(): void 'section', new Attributes(['class' => 'persistent-volume-claims']), new HtmlElement('h2', null, new Text($this->translate('Claims'))), - new PersistentVolumeClaimList(Auth::getInstance()->withRestrictions( + (new PersistentVolumeClaimList(Auth::getInstance()->withRestrictions( Auth::SHOW_PERSISTENT_VOLUME_CLAIMS, $this->persistentVolume->pvc - )) + ))) + ->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED) )); } @@ -79,8 +80,9 @@ protected function assemble(): void 'section', null, new HtmlElement('h2', null, new Text($this->translate('Events'))), - new EventList(Event::on(Database::connection()) - ->filter(Filter::equal('reference_uuid', $this->persistentVolume->uuid))) + (new EventList(Event::on(Database::connection()) + ->filter(Filter::equal('reference_uuid', $this->persistentVolume->uuid)))) + ->setViewMode(ViewModeSwitcher::VIEW_MODE_COMMON) )); } diff --git a/library/Kubernetes/Web/PodDetail.php b/library/Kubernetes/Web/PodDetail.php index c38f7bd1..d84f90ca 100644 --- a/library/Kubernetes/Web/PodDetail.php +++ b/library/Kubernetes/Web/PodDetail.php @@ -13,7 +13,6 @@ use Icinga\Module\Kubernetes\Model\Container; use Icinga\Module\Kubernetes\Model\Event; use Icinga\Module\Kubernetes\Model\Pod; -use Icinga\Module\Kubernetes\Model\PodOwner; use ipl\Html\Attributes; use ipl\Html\BaseHtmlElement; use ipl\Html\HtmlDocument; @@ -24,7 +23,6 @@ use ipl\Web\Widget\EmptyState; use ipl\Web\Widget\Icon; use ipl\Web\Widget\StateBall; -use Ramsey\Uuid\Uuid; class PodDetail extends BaseHtmlElement { @@ -123,10 +121,10 @@ protected function assemble(): void 'section', null, new HtmlElement('h2', null, new Text($this->translate('Persistent Volume Claims'))), - new PersistentVolumeClaimList(Auth::getInstance()->withRestrictions( + (new PersistentVolumeClaimList(Auth::getInstance()->withRestrictions( Auth::SHOW_PERSISTENT_VOLUME_CLAIMS, $this->pod->pvc - )) + )))->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED) )); } @@ -135,8 +133,9 @@ protected function assemble(): void 'section', null, new HtmlElement('h2', null, new Text('Events')), - new EventList(Event::on(Database::connection()) - ->filter(Filter::equal('reference_uuid', $this->pod->uuid))) + (new EventList(Event::on(Database::connection()) + ->filter(Filter::equal('reference_uuid', $this->pod->uuid)))) + ->setViewMode(ViewModeSwitcher::VIEW_MODE_COMMON) )); } diff --git a/library/Kubernetes/Web/ReplicaSetDetail.php b/library/Kubernetes/Web/ReplicaSetDetail.php index 5db81462..0d324150 100644 --- a/library/Kubernetes/Web/ReplicaSetDetail.php +++ b/library/Kubernetes/Web/ReplicaSetDetail.php @@ -82,10 +82,11 @@ protected function assemble(): void 'section', null, new HtmlElement('h2', null, new Text($this->translate('Pods'))), - new PodList(Auth::getInstance()->withRestrictions( + (new PodList(Auth::getInstance()->withRestrictions( Auth::SHOW_PODS, $this->replicaSet->pod->with(['node']) - )) + ))) + ->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED) )); } @@ -94,8 +95,9 @@ protected function assemble(): void 'section', null, new HtmlElement('h2', null, new Text($this->translate('Events'))), - new EventList(Event::on(Database::connection()) - ->filter(Filter::equal('reference_uuid', $this->replicaSet->uuid))) + (new EventList(Event::on(Database::connection()) + ->filter(Filter::equal('reference_uuid', $this->replicaSet->uuid)))) + ->setViewMode(ViewModeSwitcher::VIEW_MODE_COMMON) )); } diff --git a/library/Kubernetes/Web/ServiceDetail.php b/library/Kubernetes/Web/ServiceDetail.php index 02ba67c3..3ef97936 100644 --- a/library/Kubernetes/Web/ServiceDetail.php +++ b/library/Kubernetes/Web/ServiceDetail.php @@ -10,7 +10,6 @@ use Icinga\Module\Kubernetes\Common\ResourceDetails; use Icinga\Module\Kubernetes\Model\Endpoint; use Icinga\Module\Kubernetes\Model\EndpointSlice; -use Icinga\Module\Kubernetes\Model\Ingress; use Icinga\Module\Kubernetes\Model\Pod; use Icinga\Module\Kubernetes\Model\Service; use Icinga\Module\Kubernetes\Model\ServicePort; @@ -101,10 +100,11 @@ protected function assemble(): void 'section', null, new HtmlElement('h2', null, new Text($this->translate('Pods'))), - new PodList(Auth::getInstance()->withRestrictions( + (new PodList(Auth::getInstance()->withRestrictions( Auth::SHOW_PODS, $pods - )) + ))) + ->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED) )); } diff --git a/library/Kubernetes/Web/StatefulSetDetail.php b/library/Kubernetes/Web/StatefulSetDetail.php index ff272806..3a0ac51b 100644 --- a/library/Kubernetes/Web/StatefulSetDetail.php +++ b/library/Kubernetes/Web/StatefulSetDetail.php @@ -96,10 +96,11 @@ protected function assemble(): void 'section', null, new HtmlElement('h2', null, new Text($this->translate('Pods'))), - new PodList(Auth::getInstance()->withRestrictions( + (new PodList(Auth::getInstance()->withRestrictions( Auth::SHOW_PODS, $this->statefulSet->pod->with(['node']) - )) + ))) + ->setViewMode(ViewModeSwitcher::VIEW_MODE_DETAILED) )); } @@ -108,8 +109,9 @@ protected function assemble(): void 'section', null, new HtmlElement('h2', null, new Text($this->translate('Events'))), - new EventList(Event::on(Database::connection()) - ->filter(Filter::equal('reference_uuid', $this->statefulSet->uuid))) + (new EventList(Event::on(Database::connection()) + ->filter(Filter::equal('reference_uuid', $this->statefulSet->uuid)))) + ->setViewMode(ViewModeSwitcher::VIEW_MODE_COMMON) )); }