Skip to content

Add icinga states to cron job and service #123

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

Closed
wants to merge 62 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
bc063f6
Add ViewModeSwitcher
jrauh01 Jan 3, 2025
7b7ddbe
Implement abstract function getIgnoredViewModes()
jrauh01 Jan 3, 2025
854ef35
Return the matching ListItem classes
jrauh01 Jan 3, 2025
b38b855
Implement the view modes
jrauh01 Jan 3, 2025
d502cd3
PHP style fixes
jrauh01 Jan 3, 2025
4eaa00a
Icon titles for namespace list item footer
jrauh01 Jan 7, 2025
393b141
Switch between view modes in one file
jrauh01 Jan 14, 2025
4e83cd9
Add visibility modifiers for constants
jrauh01 Jan 15, 2025
8506438
Replace 'else if' with 'elseif'
jrauh01 Jan 15, 2025
5bbfbf8
Fix detail view
jrauh01 Jan 15, 2025
bd36600
Fix referents in event detail view
jrauh01 Jan 15, 2025
8386191
Remove redundant line
jrauh01 Jan 16, 2025
400b12b
Add missing parameter and return type
jrauh01 Jan 16, 2025
1703e1d
Use match expressions instead of if-else
jrauh01 Jan 16, 2025
455b90e
Use ->viewMode instead of ->getViewMode()
jrauh01 Jan 16, 2025
2105ef9
Remove superfluous if statement
jrauh01 Jan 16, 2025
cc4a7cf
Simplify namespace's caption and footer
jrauh01 Jan 16, 2025
71ad621
Use view mode constants
jrauh01 Jan 16, 2025
32356db
Remove tabular view mode from ViewModeSwitcher
jrauh01 Jan 16, 2025
fb0f9c5
Add docs for addIgnoredViewModes()
jrauh01 Jan 16, 2025
fa2f32f
Hide view mode switcher
jrauh01 Jan 16, 2025
8fc2f7b
Format docs
jrauh01 Jan 16, 2025
0743912
Fix license headers
jrauh01 Jan 16, 2025
2f1f06b
Pass db via argument
jrauh01 Jan 21, 2025
f812f48
Make getIgnoredViewModes() not abstract anymore
jrauh01 Jan 22, 2025
111fa52
Add function to canonicalize resource kinds
jrauh01 Jan 22, 2025
3366625
Add default traits for list item parts
jrauh01 Jan 22, 2025
d9b29cd
Adjust function names to canonicalized kind names
jrauh01 Jan 22, 2025
a5076fc
Use default traits for item list parts
jrauh01 Jan 22, 2025
809b185
Add styles for list items
jrauh01 Feb 28, 2025
9eb5004
Add default item layout for resources
jrauh01 May 13, 2025
d50a371
Implement `ItemRenderer` ...
jrauh01 May 12, 2025
8fe19c9
Extend `BaseResourceRenderer` to render resources
jrauh01 May 12, 2025
335960b
Extend `ItemList` to display resources
jrauh01 May 12, 2025
6d08824
Use `ResourceList`
jrauh01 May 12, 2025
0347a71
Remove old list implementation
jrauh01 May 13, 2025
58e9708
Full width for list items in detail view
jrauh01 May 13, 2025
21e2bc3
Use new list implementation for conditions
jrauh01 May 12, 2025
2edb1cf
Adjust styles for new list implementation
jrauh01 May 13, 2025
0fd9e12
Add list items as detail view header
jrauh01 May 13, 2025
15448f9
Adjust size for pv and pvc state icons
jrauh01 May 13, 2025
40264a2
Switch between view modes in one file
jrauh01 Jan 14, 2025
dc7f577
Use DetailState in resource details
jrauh01 Dec 18, 2024
7f4f67f
Use own action list
jrauh01 Jan 2, 2025
5209a10
Add model for favorites
jrauh01 Jan 2, 2025
77eb843
Add QuickActions
jrauh01 Feb 20, 2025
c619f34
Add quick actions to toggle favorites
jrauh01 Feb 20, 2025
58dc3d9
Show favorite icon in action list
jrauh01 Feb 20, 2025
3259b0d
Remove multi select feature from action list
jrauh01 Feb 21, 2025
2d30ed3
Remove load more feature from action list
jrauh01 Feb 21, 2025
e409ce5
Add priority column to favorites
jrauh01 Feb 24, 2025
4097ce7
Add toggle to show only favorites
jrauh01 Feb 27, 2025
9c419e2
Add reordering via drag & drop
jrauh01 Feb 27, 2025
bbced0e
Dashboard to show all favorites
jrauh01 Mar 3, 2025
bba8dee
Disable auto refresh while dragging
jrauh01 Mar 10, 2025
9ec2605
fixup! Use own action list
jrauh01 Mar 12, 2025
91f5e56
fixup! Show favorite icon in action list
jrauh01 Mar 12, 2025
b036440
wip: custom order hint
jrauh01 Mar 13, 2025
f97bc27
wip
jrauh01 May 5, 2025
770024b
Add icinga state for services
jrauh01 Mar 3, 2025
87a954e
Add icinga state for cron jobs
jrauh01 Mar 3, 2025
4cd8ce7
wip
jrauh01 May 13, 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
17 changes: 11 additions & 6 deletions application/controllers/ConfigmapsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,12 @@
use Icinga\Module\Kubernetes\Common\Auth;
use Icinga\Module\Kubernetes\Common\Database;
use Icinga\Module\Kubernetes\Model\ConfigMap;
use Icinga\Module\Kubernetes\Web\ConfigMapList;
use Icinga\Module\Kubernetes\Web\ListController;
use Icinga\Module\Kubernetes\Web\ViewModeSwitcher;
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,14 @@ protected function getPermission(): string
{
return AUTH::SHOW_CONFIG_MAPS;
}

protected function getIgnoredViewModes(): array
{
return [ViewModeSwitcher::VIEW_MODE_COMMON, ViewModeSwitcher::VIEW_MODE_DETAILED];
}

protected function getFavorable(): bool
{
return false;
}
}
21 changes: 21 additions & 0 deletions application/controllers/CronjobController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@
use Icinga\Module\Kubernetes\Common\Auth;
use Icinga\Module\Kubernetes\Common\Database;
use Icinga\Module\Kubernetes\Model\CronJob;
use Icinga\Module\Kubernetes\Model\Favorite;
use Icinga\Module\Kubernetes\Web\Controller;
use Icinga\Module\Kubernetes\Web\CronJobDetail;
use Icinga\Module\Kubernetes\Web\ItemList\ResourceList;
use Icinga\Module\Kubernetes\Web\QuickActions;
use Icinga\Module\Kubernetes\Web\ViewModeSwitcher;
use ipl\Stdlib\Filter;
use Ramsey\Uuid\Uuid;

Expand All @@ -28,10 +32,27 @@ public function indexAction(): void
->filter(Filter::equal('uuid', $uuidBytes))
->first();

$favorite = Favorite::on(Database::connection())
->filter(
Filter::all(
Filter::equal('resource_uuid', $uuidBytes),
Filter::equal('username', Auth::getInstance()->getUser()->getUsername())
)
)
->first();

if ($cronJob === null) {
$this->httpNotFound($this->translate('Cron Job not found'));
}

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

$this->addControl(new QuickActions($cronJob, $favorite));

$this->addContent(new CronJobDetail($cronJob));
}
}
11 changes: 5 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 All @@ -41,4 +35,9 @@ protected function getPermission(): string
{
return Auth::SHOW_CRON_JOBS;
}

protected function getFavorable(): bool
{
return true;
}
}
22 changes: 20 additions & 2 deletions application/controllers/DaemonsetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
use Icinga\Module\Kubernetes\Common\Auth;
use Icinga\Module\Kubernetes\Common\Database;
use Icinga\Module\Kubernetes\Model\DaemonSet;
use Icinga\Module\Kubernetes\Model\Favorite;
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 Icinga\Module\Kubernetes\Web\QuickActions;
use Icinga\Module\Kubernetes\Web\ViewModeSwitcher;
use ipl\Stdlib\Filter;
use Ramsey\Uuid\Uuid;

Expand All @@ -29,11 +32,26 @@ public function indexAction(): void
->filter(Filter::equal('uuid', $uuidBytes))
->first();

$favorite = Favorite::on(Database::connection())
->filter(
Filter::all(
Filter::equal('resource_uuid', $uuidBytes),
Filter::equal('username', Auth::getInstance()->getUser()->getUsername())
)
)
->first();

if ($daemonSet === null) {
$this->httpNotFound($this->translate('Daemon Set not found'));
}

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

$this->addControl(new QuickActions($daemonSet, $favorite));

$this->addContent(new DaemonSetDetail($daemonSet));
}
Expand Down
11 changes: 5 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 All @@ -41,4 +35,9 @@ protected function getPermission(): string
{
return Auth::SHOW_DAEMON_SETS;
}

protected function getFavorable(): bool
{
return true;
}
}
22 changes: 20 additions & 2 deletions application/controllers/DeploymentController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,12 @@
use Icinga\Module\Kubernetes\Common\Auth;
use Icinga\Module\Kubernetes\Common\Database;
use Icinga\Module\Kubernetes\Model\Deployment;
use Icinga\Module\Kubernetes\Model\Favorite;
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 Icinga\Module\Kubernetes\Web\QuickActions;
use Icinga\Module\Kubernetes\Web\ViewModeSwitcher;
use ipl\Stdlib\Filter;
use Ramsey\Uuid\Uuid;

Expand All @@ -29,11 +32,26 @@ public function indexAction(): void
->filter(Filter::equal('uuid', $uuidBytes))
->first();

$favorite = Favorite::on(Database::connection())
->filter(
Filter::all(
Filter::equal('resource_uuid', $uuidBytes),
Filter::equal('username', Auth::getInstance()->getUser()->getUsername())
)
)
->first();

if ($deployment === null) {
$this->httpNotFound($this->translate('Deployment not found'));
}

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

$this->addControl(new QuickActions($deployment, $favorite));

$this->addContent(new DeploymentDetail($deployment));
}
Expand Down
11 changes: 5 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 All @@ -41,4 +35,9 @@ protected function getPermission(): string
{
return Auth::SHOW_DEPLOYMENTS;
}

protected function getFavorable(): bool
{
return true;
}
}
17 changes: 11 additions & 6 deletions application/controllers/EventsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,13 @@
use Icinga\Module\Kubernetes\Common\Auth;
use Icinga\Module\Kubernetes\Common\Database;
use Icinga\Module\Kubernetes\Model\Event;
use Icinga\Module\Kubernetes\Web\EventList;
use Icinga\Module\Kubernetes\Web\ListController;
use Icinga\Module\Kubernetes\Web\ViewModeSwitcher;
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,14 @@ protected function getPermission(): string
{
return Auth::SHOW_EVENTS;
}

protected function getIgnoredViewModes(): array
{
return [ViewModeSwitcher::VIEW_MODE_DETAILED];
}

protected function getFavorable(): bool
{
return false;
}
}
Loading