diff --git a/application/controllers/DaemonsetController.php b/application/controllers/DaemonsetController.php index 1daeda81..5b7edc22 100644 --- a/application/controllers/DaemonsetController.php +++ b/application/controllers/DaemonsetController.php @@ -30,7 +30,7 @@ public function indexAction(): void $this->httpNotFound($this->translate('Daemon Set not found')); } - $this->addControl(new DaemonSetList([$daemonSet])); + $this->addControl((new DaemonSetList([$daemonSet]))->setActionList(false)); $this->addContent(new DaemonSetDetail($daemonSet)); } diff --git a/application/controllers/DeploymentController.php b/application/controllers/DeploymentController.php index 4ed2c1df..bd12832a 100644 --- a/application/controllers/DeploymentController.php +++ b/application/controllers/DeploymentController.php @@ -30,7 +30,7 @@ public function indexAction(): void $this->httpNotFound($this->translate('Deployment not found')); } - $this->addControl(new DeploymentList([$deployment])); + $this->addControl((new DeploymentList([$deployment]))->setActionList(false)); $this->addContent(new DeploymentDetail($deployment)); } diff --git a/application/controllers/JobController.php b/application/controllers/JobController.php index a9b2679a..a0a14ec2 100644 --- a/application/controllers/JobController.php +++ b/application/controllers/JobController.php @@ -30,7 +30,7 @@ public function indexAction(): void $this->httpNotFound($this->translate('Job not found')); } - $this->addControl(new JobList([$job])); + $this->addControl((new JobList([$job]))->setActionList(false)); $this->addContent(new JobDetail($job)); } diff --git a/application/controllers/NodeController.php b/application/controllers/NodeController.php index c9f7e420..dadd3aef 100644 --- a/application/controllers/NodeController.php +++ b/application/controllers/NodeController.php @@ -30,7 +30,7 @@ public function indexAction(): void $this->httpNotFound($this->translate('Node not found')); } - $this->addControl(new NodeList([$node])); + $this->addControl((new NodeList([$node]))->setActionList(false)); $this->addContent(new NodeDetail($node)); } diff --git a/application/controllers/PodController.php b/application/controllers/PodController.php index 1952fcca..785e859b 100644 --- a/application/controllers/PodController.php +++ b/application/controllers/PodController.php @@ -30,7 +30,7 @@ public function indexAction(): void $this->httpNotFound($this->translate('Pod not found')); } - $this->addControl(new PodList([$pod])); + $this->addControl((new PodList([$pod]))->setActionList(false)); $this->addContent(new PodDetail($pod)); } diff --git a/application/controllers/ReplicasetController.php b/application/controllers/ReplicasetController.php index 27cbf644..512f773d 100644 --- a/application/controllers/ReplicasetController.php +++ b/application/controllers/ReplicasetController.php @@ -30,7 +30,7 @@ public function indexAction(): void $this->httpNotFound($this->translate('Replica Set not found')); } - $this->addControl(new ReplicaSetList([$replicaSet])); + $this->addControl((new ReplicaSetList([$replicaSet]))->setActionList(false)); $this->addContent(new ReplicaSetDetail($replicaSet)); } diff --git a/application/controllers/StatefulsetController.php b/application/controllers/StatefulsetController.php index c225ea9d..819e8d7f 100644 --- a/application/controllers/StatefulsetController.php +++ b/application/controllers/StatefulsetController.php @@ -30,7 +30,7 @@ public function indexAction(): void $this->httpNotFound($this->translate('Stateful Set not found')); } - $this->addControl(new StatefulSetList([$statefulSet])); + $this->addControl((new StatefulSetList([$statefulSet]))->setActionList(false)); $this->addContent(new StatefulSetDetail($statefulSet)); } diff --git a/library/Kubernetes/Common/BaseItemList.php b/library/Kubernetes/Common/BaseItemList.php index c0f19090..f8e2a94f 100644 --- a/library/Kubernetes/Common/BaseItemList.php +++ b/library/Kubernetes/Common/BaseItemList.php @@ -18,14 +18,16 @@ abstract class BaseItemList extends BaseHtmlElement use BaseFilter; use Translation; + protected bool $actionList = true; + + protected iterable $query; + protected array $baseAttributes = [ - 'class' => 'item-list action-list', + 'class' => 'item-list', 'data-base-target' => '_next', 'data-pdfexport-page-breaks-at' => '.list-item' ]; - protected iterable $query; - protected $tag = 'ul'; public function __construct(iterable $query) @@ -35,6 +37,13 @@ public function __construct(iterable $query) $this->init(); } + public function setActionList(bool $actionList): static + { + $this->actionList = $actionList; + + return $this; + } + /** * Initialize the item list * If you want to adjust the item list after construction, override this method. @@ -45,12 +54,13 @@ protected function init(): void protected function assemble(): void { - $detailUrlAdded = false; + $detailUrlAdded = ! $this->actionList; $itemClass = $this->getItemClass(); + $this->addAttributes($this->baseAttributes); foreach ($this->query as $item) { if (! $detailUrlAdded) { - $this->addAttributes($this->baseAttributes + [ + $this->addAttributes(['class' => 'action-list'] + [ 'data-icinga-detail-url' => Url::fromPath( 'kubernetes/' . str_replace('_', '-', $item->getTableAlias()) )