Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make headers non-clickable #90

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion application/controllers/DaemonsetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,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));
}
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/DeploymentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,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));
}
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/JobController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,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));
}
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/NodeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,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));
}
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/PodController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,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));
}
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/ReplicasetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,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));
}
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/StatefulsetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,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));
}
Expand Down
32 changes: 27 additions & 5 deletions library/Kubernetes/Common/BaseItemList.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,21 @@ abstract class BaseItemList extends BaseHtmlElement
use BaseFilter;
use Translation;

/**
* Indicates whether the item list should be treated as an action list.
*
* @var bool $actionList
*/
protected bool $actionList = true;
jhoxhaa marked this conversation as resolved.
Show resolved Hide resolved

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)
Expand All @@ -35,6 +42,20 @@ public function __construct(iterable $query)
$this->init();
}

/**
* Enable or disable the action list functionality by setting the $actionList
* property.
*
* @param bool $actionList
* @return static
*/
public function setActionList(bool $actionList): static
jhoxhaa marked this conversation as resolved.
Show resolved Hide resolved
{
$this->actionList = $actionList;

return $this;
}

/**
* Initialize the item list
* If you want to adjust the item list after construction, override this method.
Expand All @@ -45,12 +66,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())
)
Expand Down
Loading