Skip to content

Commit d093bca

Browse files
committed
Add icinga state for cron jobs
1 parent ff1740d commit d093bca

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

library/Kubernetes/Model/CronJob.php

+4
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ public function getColumnDefinitions(): array
7272
'active' => $this->translate('Active'),
7373
'last_schedule_time' => $this->translate('Last Schedule Time'),
7474
'last_successful_time' => $this->translate('Last Successful Time'),
75+
'icinga_state' => $this->translate('Icinga State'),
76+
'icinga_state_reason' => $this->translate('Icinga State Reason'),
7577
'yaml' => $this->translate('YAML'),
7678
'created' => $this->translate('Created At')
7779
];
@@ -95,6 +97,8 @@ public function getColumns(): array
9597
'active',
9698
'last_schedule_time',
9799
'last_successful_time',
100+
'icinga_state',
101+
'icinga_state_reason',
98102
'yaml',
99103
'created'
100104
];

library/Kubernetes/Web/CronJobDetail.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ protected function assemble(): void
5656
$this->translate('Successful Jobs History Limit') => $this->cronJob->successful_jobs_history_limit,
5757
$this->translate('Failed Jobs History Limit') => $this->cronJob->failed_jobs_history_limit,
5858
$this->translate('Last Successful Time') => $lastSuccessfulTime,
59-
$this->translate('Last Schedule Time') => $lastScheduleTime
59+
$this->translate('Last Schedule Time') => $lastScheduleTime,
60+
$this->translate('Icinga State') => new DetailState($this->cronJob->icinga_state),
61+
$this->translate('Icinga State Reason') => new IcingaStateReason(
62+
$this->cronJob->icinga_state_reason
63+
)
6064
])),
6165
new Labels($this->cronJob->label),
6266
new Annotations($this->cronJob->annotation),

library/Kubernetes/Web/CronJobListItem.php

+4-13
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
namespace Icinga\Module\Kubernetes\Web;
66

77
use Icinga\Module\Kubernetes\Common\BaseListItem;
8+
use Icinga\Module\Kubernetes\Common\DefaultListItemCaption;
89
use Icinga\Module\Kubernetes\Common\DefaultListItemHeader;
910
use Icinga\Module\Kubernetes\Common\DefaultListItemMain;
11+
use Icinga\Module\Kubernetes\Common\DefaultListItemVisual;
1012
use Icinga\Module\Kubernetes\Common\Icons;
1113
use Icinga\Module\Kubernetes\Common\Links;
1214
use ipl\Html\Attributes;
@@ -17,19 +19,14 @@
1719
use ipl\I18n\Translation;
1820
use ipl\Web\Widget\HorizontalKeyValue;
1921
use ipl\Web\Widget\Link;
20-
use ipl\Web\Widget\StateBall;
2122

2223
class CronJobListItem extends BaseListItem
2324
{
2425
use Translation;
2526
use DefaultListItemHeader;
27+
use DefaultListItemCaption;
2628
use DefaultListItemMain;
27-
28-
protected function assembleCaption(BaseHtmlElement $caption): void
29-
{
30-
// TODO add state reason then replace function by DefaultListItemCaption trait
31-
$caption->addHtml(new Text('Placeholder for Icinga State Reason'));
32-
}
29+
use DefaultListItemVisual;
3330

3431
protected function assembleFooter(BaseHtmlElement $footer): void
3532
{
@@ -73,10 +70,4 @@ protected function assembleTitle(BaseHtmlElement $title): void
7370
)
7471
);
7572
}
76-
77-
protected function assembleVisual(BaseHtmlElement $visual): void
78-
{
79-
// TODO add icinga state then replace function by DefaultListItemVisual trait
80-
$visual->addHtml(new StateBall('none', StateBall::SIZE_MEDIUM));
81-
}
8273
}

0 commit comments

Comments
 (0)