Skip to content

Add different view modes for resource lists #118

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

Merged
merged 41 commits into from
May 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
8602e36
Add ViewModeSwitcher
jrauh01 Jan 3, 2025
5a4f357
Implement abstract function getIgnoredViewModes()
jrauh01 Jan 3, 2025
3cd0fe2
Return the matching ListItem classes
jrauh01 Jan 3, 2025
d46d208
Implement the view modes
jrauh01 Jan 3, 2025
bef7b2d
PHP style fixes
jrauh01 Jan 3, 2025
7862e65
Icon titles for namespace list item footer
jrauh01 Jan 7, 2025
b6510e6
Switch between view modes in one file
jrauh01 Jan 14, 2025
9f4834d
Replace 'else if' with 'elseif'
jrauh01 Jan 15, 2025
4364b24
Fix detail view
jrauh01 Jan 15, 2025
89e045b
Fix referents in event detail view
jrauh01 Jan 15, 2025
7d2ce3a
Remove redundant line
jrauh01 Jan 16, 2025
1204de8
Add missing parameter and return type
jrauh01 Jan 16, 2025
9a1d4b4
Use match expressions instead of if-else
jrauh01 Jan 16, 2025
9abbbc1
Use ->viewMode instead of ->getViewMode()
jrauh01 Jan 16, 2025
eba0778
Remove superfluous if statement
jrauh01 Jan 16, 2025
63af367
Simplify namespace's caption and footer
jrauh01 Jan 16, 2025
6abdea8
Hide view mode switcher
jrauh01 Jan 16, 2025
72c3d40
Format docs
jrauh01 Jan 16, 2025
32e989e
Fix license headers
jrauh01 Jan 16, 2025
f2d56cb
Pass db via argument
jrauh01 Jan 21, 2025
26c6b3e
Make getIgnoredViewModes() not abstract anymore
jrauh01 Jan 22, 2025
f5e7abf
Add function to canonicalize resource kinds
jrauh01 Jan 22, 2025
61629e9
Add default traits for list item parts
jrauh01 Jan 22, 2025
de60bff
Adjust function names to canonicalized kind names
jrauh01 Jan 22, 2025
0c066e3
Use default traits for item list parts
jrauh01 Jan 22, 2025
6695ce0
Add styles for list items
jrauh01 Feb 28, 2025
513c3c6
Add default item layout for resources
jrauh01 May 13, 2025
d62d023
Implement `ItemRenderer` ...
jrauh01 May 12, 2025
68bcac8
Extend `BaseResourceRenderer` to render resources
jrauh01 May 12, 2025
a67760b
Adjust `createDetailUrl()` factory function
jrauh01 May 15, 2025
ee7d574
Extend `ItemList` to display resources
jrauh01 May 12, 2025
5fcd909
Use `ResourceList`
jrauh01 May 12, 2025
a41b872
Remove old list implementation
jrauh01 May 13, 2025
1106420
Full width for list items in detail view
jrauh01 May 13, 2025
e86fd65
Use new list implementation for conditions
jrauh01 May 12, 2025
ad7e5ff
Adjust styles for new list implementation
jrauh01 May 13, 2025
bb09b50
Add list items as detail view header
jrauh01 May 13, 2025
286f10f
Adjust size for pv and pvc state icons
jrauh01 May 13, 2025
51536bf
Standardize empty state messages in detail view
jrauh01 May 15, 2025
40898c7
Lowercase container links functions
jrauh01 May 20, 2025
97703ee
Use new container icon
jrauh01 May 20, 2025
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
12 changes: 6 additions & 6 deletions application/controllers/ConfigmapsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,13 @@

use Icinga\Module\Kubernetes\Common\Auth;
use Icinga\Module\Kubernetes\Common\Database;
use Icinga\Module\Kubernetes\Common\ViewMode;
use Icinga\Module\Kubernetes\Model\ConfigMap;
use Icinga\Module\Kubernetes\Web\ConfigMapList;
use Icinga\Module\Kubernetes\Web\ListController;
use ipl\Orm\Query;

class ConfigmapsController extends ListController
{
protected function getContentClass(): string
{
return ConfigMapList::class;
}

protected function getQuery(): Query
{
return ConfigMap::on(Database::connection());
Expand All @@ -41,4 +36,9 @@ protected function getPermission(): string
{
return AUTH::SHOW_CONFIG_MAPS;
}

protected function getIgnoredViewModes(): array
{
return [ViewMode::Common, ViewMode::Detailed];
}
}
8 changes: 8 additions & 0 deletions application/controllers/CronjobController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

use Icinga\Module\Kubernetes\Common\Auth;
use Icinga\Module\Kubernetes\Common\Database;
use Icinga\Module\Kubernetes\Common\ViewMode;
use Icinga\Module\Kubernetes\Model\CronJob;
use Icinga\Module\Kubernetes\Web\Controller;
use Icinga\Module\Kubernetes\Web\CronJobDetail;
use Icinga\Module\Kubernetes\Web\ItemList\ResourceList;
use ipl\Stdlib\Filter;
use Ramsey\Uuid\Uuid;

Expand All @@ -32,6 +34,12 @@ public function indexAction(): void
$this->httpNotFound($this->translate('Cron Job not found'));
}

$this->addControl(
(new ResourceList([$cronJob]))
->setDetailActionsDisabled()
->setViewMode(ViewMode::Detailed)
);

$this->addContent(new CronJobDetail($cronJob));
}
}
6 changes: 0 additions & 6 deletions application/controllers/CronjobsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,11 @@
use Icinga\Module\Kubernetes\Common\Auth;
use Icinga\Module\Kubernetes\Common\Database;
use Icinga\Module\Kubernetes\Model\CronJob;
use Icinga\Module\Kubernetes\Web\CronJobList;
use Icinga\Module\Kubernetes\Web\ListController;
use ipl\Orm\Query;

class CronjobsController extends ListController
{
protected function getContentClass(): string
{
return CronJobList::class;
}

protected function getQuery(): Query
{
return CronJob::on(Database::connection());
Expand Down
9 changes: 7 additions & 2 deletions application/controllers/DaemonsetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@

use Icinga\Module\Kubernetes\Common\Auth;
use Icinga\Module\Kubernetes\Common\Database;
use Icinga\Module\Kubernetes\Common\ViewMode;
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 Icinga\Module\Kubernetes\Web\ItemList\ResourceList;
use ipl\Stdlib\Filter;
use Ramsey\Uuid\Uuid;

Expand All @@ -33,7 +34,11 @@ public function indexAction(): void
$this->httpNotFound($this->translate('Daemon Set not found'));
}

$this->addControl((new DaemonSetList([$daemonSet]))->setActionList(false));
$this->addControl(
(new ResourceList([$daemonSet]))
->setDetailActionsDisabled()
->setViewMode(ViewMode::Detailed)
);

$this->addContent(new DaemonSetDetail($daemonSet));
}
Expand Down
6 changes: 0 additions & 6 deletions application/controllers/DaemonsetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,11 @@
use Icinga\Module\Kubernetes\Common\Auth;
use Icinga\Module\Kubernetes\Common\Database;
use Icinga\Module\Kubernetes\Model\DaemonSet;
use Icinga\Module\Kubernetes\Web\DaemonSetList;
use Icinga\Module\Kubernetes\Web\ListController;
use ipl\Orm\Query;

class DaemonsetsController extends ListController
{
protected function getContentClass(): string
{
return DaemonSetList::class;
}

protected function getQuery(): Query
{
return DaemonSet::on(Database::connection());
Expand Down
9 changes: 7 additions & 2 deletions application/controllers/DeploymentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@

use Icinga\Module\Kubernetes\Common\Auth;
use Icinga\Module\Kubernetes\Common\Database;
use Icinga\Module\Kubernetes\Common\ViewMode;
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 Icinga\Module\Kubernetes\Web\ItemList\ResourceList;
use ipl\Stdlib\Filter;
use Ramsey\Uuid\Uuid;

Expand All @@ -33,7 +34,11 @@ public function indexAction(): void
$this->httpNotFound($this->translate('Deployment not found'));
}

$this->addControl((new DeploymentList([$deployment]))->setActionList(false));
$this->addControl(
(new ResourceList([$deployment]))
->setDetailActionsDisabled()
->setViewMode(ViewMode::Detailed)
);

$this->addContent(new DeploymentDetail($deployment));
}
Expand Down
6 changes: 0 additions & 6 deletions application/controllers/DeploymentsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,11 @@
use Icinga\Module\Kubernetes\Common\Auth;
use Icinga\Module\Kubernetes\Common\Database;
use Icinga\Module\Kubernetes\Model\Deployment;
use Icinga\Module\Kubernetes\Web\DeploymentList;
use Icinga\Module\Kubernetes\Web\ListController;
use ipl\Orm\Query;

class DeploymentsController extends ListController
{
protected function getContentClass(): string
{
return DeploymentList::class;
}

protected function getQuery(): Query
{
return Deployment::on(Database::connection());
Expand Down
12 changes: 6 additions & 6 deletions application/controllers/EventsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,14 @@

use Icinga\Module\Kubernetes\Common\Auth;
use Icinga\Module\Kubernetes\Common\Database;
use Icinga\Module\Kubernetes\Common\ViewMode;
use Icinga\Module\Kubernetes\Model\Event;
use Icinga\Module\Kubernetes\Web\EventList;
use Icinga\Module\Kubernetes\Web\ListController;
use ipl\Orm\Query;
use ipl\Stdlib\Filter;

class EventsController extends ListController
{
protected function getContentClass(): string
{
return EventList::class;
}

protected function getQuery(): Query
{
$events = Auth::getInstance()->withRestrictions(Auth::SHOW_EVENTS, Event::on(Database::connection()));
Expand Down Expand Up @@ -51,4 +46,9 @@ protected function getPermission(): string
{
return Auth::SHOW_EVENTS;
}

protected function getIgnoredViewModes(): array
{
return [ViewMode::Detailed];
}
}
8 changes: 8 additions & 0 deletions application/controllers/IngressController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

use Icinga\Module\Kubernetes\Common\Auth;
use Icinga\Module\Kubernetes\Common\Database;
use Icinga\Module\Kubernetes\Common\ViewMode;
use Icinga\Module\Kubernetes\Model\Ingress;
use Icinga\Module\Kubernetes\Web\Controller;
use Icinga\Module\Kubernetes\Web\IngressDetail;
use Icinga\Module\Kubernetes\Web\ItemList\ResourceList;
use ipl\Stdlib\Filter;
use Ramsey\Uuid\Uuid;

Expand All @@ -32,6 +34,12 @@ public function indexAction(): void
$this->httpNotFound($this->translate('Ingress not found'));
}

$this->addControl(
(new ResourceList([$ingress]))
->setDetailActionsDisabled()
->setViewMode(ViewMode::Detailed)
);

$this->addContent(new IngressDetail($ingress));
}
}
6 changes: 0 additions & 6 deletions application/controllers/IngressesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,11 @@
use Icinga\Module\Kubernetes\Common\Auth;
use Icinga\Module\Kubernetes\Common\Database;
use Icinga\Module\Kubernetes\Model\Ingress;
use Icinga\Module\Kubernetes\Web\IngressList;
use Icinga\Module\Kubernetes\Web\ListController;
use ipl\Orm\Query;

class IngressesController extends ListController
{
protected function getContentClass(): string
{
return IngressList::class;
}

protected function getQuery(): Query
{
return Ingress::on(Database::connection());
Expand Down
9 changes: 7 additions & 2 deletions application/controllers/JobController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@

use Icinga\Module\Kubernetes\Common\Auth;
use Icinga\Module\Kubernetes\Common\Database;
use Icinga\Module\Kubernetes\Common\ViewMode;
use Icinga\Module\Kubernetes\Model\Job;
use Icinga\Module\Kubernetes\Web\Controller;
use Icinga\Module\Kubernetes\Web\ItemList\ResourceList;
use Icinga\Module\Kubernetes\Web\JobDetail;
use Icinga\Module\Kubernetes\Web\JobList;
use ipl\Stdlib\Filter;
use Ramsey\Uuid\Uuid;

Expand All @@ -33,7 +34,11 @@ public function indexAction(): void
$this->httpNotFound($this->translate('Job not found'));
}

$this->addControl((new JobList([$job]))->setActionList(false));
$this->addControl(
(new ResourceList([$job]))
->setDetailActionsDisabled()
->setViewMode(ViewMode::Detailed)
);

$this->addContent(new JobDetail($job));
}
Expand Down
6 changes: 0 additions & 6 deletions application/controllers/JobsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,11 @@
use Icinga\Module\Kubernetes\Common\Auth;
use Icinga\Module\Kubernetes\Common\Database;
use Icinga\Module\Kubernetes\Model\Job;
use Icinga\Module\Kubernetes\Web\JobList;
use Icinga\Module\Kubernetes\Web\ListController;
use ipl\Orm\Query;

class JobsController extends ListController
{
protected function getContentClass(): string
{
return JobList::class;
}

protected function getQuery(): Query
{
return Job::on(Database::connection());
Expand Down
8 changes: 8 additions & 0 deletions application/controllers/NamespaceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@

use Icinga\Module\Kubernetes\Common\Auth;
use Icinga\Module\Kubernetes\Common\Database;
use Icinga\Module\Kubernetes\Common\ViewMode;
use Icinga\Module\Kubernetes\Model\NamespaceModel;
use Icinga\Module\Kubernetes\Web\Controller;
use Icinga\Module\Kubernetes\Web\ItemList\ResourceList;
use Icinga\Module\Kubernetes\Web\NamespaceDetail;
use ipl\Stdlib\Filter;
use Ramsey\Uuid\Uuid;
Expand All @@ -32,6 +34,12 @@ public function indexAction(): void
$this->httpNotFound($this->translate('Namespace not found'));
}

$this->addControl(
(new ResourceList([$namespace]))
->setDetailActionsDisabled()
->setViewMode(ViewMode::Detailed)
);

$this->addContent(new NamespaceDetail($namespace));
}
}
6 changes: 0 additions & 6 deletions application/controllers/NamespacesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,10 @@
use Icinga\Module\Kubernetes\Common\Database;
use Icinga\Module\Kubernetes\Model\NamespaceModel;
use Icinga\Module\Kubernetes\Web\ListController;
use Icinga\Module\Kubernetes\Web\NamespaceList;
use ipl\Orm\Query;

class NamespacesController extends ListController
{
protected function getContentClass(): string
{
return NamespaceList::class;
}

protected function getQuery(): Query
{
return NamespaceModel::on(Database::connection());
Expand Down
9 changes: 7 additions & 2 deletions application/controllers/NodeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@

use Icinga\Module\Kubernetes\Common\Auth;
use Icinga\Module\Kubernetes\Common\Database;
use Icinga\Module\Kubernetes\Common\ViewMode;
use Icinga\Module\Kubernetes\Model\Node;
use Icinga\Module\Kubernetes\Web\Controller;
use Icinga\Module\Kubernetes\Web\ItemList\ResourceList;
use Icinga\Module\Kubernetes\Web\NodeDetail;
use Icinga\Module\Kubernetes\Web\NodeList;
use ipl\Stdlib\Filter;
use Ramsey\Uuid\Uuid;

Expand All @@ -33,7 +34,11 @@ public function indexAction(): void
$this->httpNotFound($this->translate('Node not found'));
}

$this->addControl((new NodeList([$node]))->setActionList(false));
$this->addControl(
(new ResourceList([$node]))
->setDetailActionsDisabled()
->setViewMode(ViewMode::Detailed)
);

$this->addContent(new NodeDetail($node));
}
Expand Down
6 changes: 0 additions & 6 deletions application/controllers/NodesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,10 @@
use Icinga\Module\Kubernetes\Common\Database;
use Icinga\Module\Kubernetes\Model\Node;
use Icinga\Module\Kubernetes\Web\ListController;
use Icinga\Module\Kubernetes\Web\NodeList;
use ipl\Orm\Query;

class NodesController extends ListController
{
protected function getContentClass(): string
{
return NodeList::class;
}

protected function getQuery(): Query
{
return Node::on(Database::connection());
Expand Down
8 changes: 8 additions & 0 deletions application/controllers/PersistentvolumeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@

use Icinga\Module\Kubernetes\Common\Auth;
use Icinga\Module\Kubernetes\Common\Database;
use Icinga\Module\Kubernetes\Common\ViewMode;
use Icinga\Module\Kubernetes\Model\PersistentVolume;
use Icinga\Module\Kubernetes\Web\Controller;
use Icinga\Module\Kubernetes\Web\ItemList\ResourceList;
use Icinga\Module\Kubernetes\Web\PersistentVolumeDetail;
use ipl\Stdlib\Filter;
use Ramsey\Uuid\Uuid;
Expand All @@ -32,6 +34,12 @@ public function indexAction(): void
$this->httpNotFound($this->translate('Persistent Volume not found'));
}

$this->addControl(
(new ResourceList([$persistentVolume]))
->setDetailActionsDisabled()
->setViewMode(ViewMode::Detailed)
);

$this->addContent(new PersistentVolumeDetail($persistentVolume));
}
}
Loading
Loading