Skip to content

Commit e734f7d

Browse files
committed
Add Icinga state to cron job
1 parent ddaa6e3 commit e734f7d

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
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

+2-3
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ class CronJobListItem extends BaseListItem
3131

3232
protected function assembleCaption(BaseHtmlElement $caption): void
3333
{
34-
// TODO add state reason then replace function by DefaultListItemCaption trait
35-
$caption->addHtml(new Text('Placeholder for Icinga State Reason'));
34+
$caption->addHtml(new Text($this->item->icinga_state_reason));
3635
}
3736

3837
protected function assembleFooter(BaseHtmlElement $footer): void
@@ -87,7 +86,7 @@ protected function assembleVisual(BaseHtmlElement $visual): void
8786
};
8887

8988
// TODO add icinga state then replace function by DefaultListItemVisual trait
90-
$visual->addHtml(new StateBall('none', $size));
89+
$visual->addHtml(new StateBall($this->item->icinga_state, $size));
9190

9291
if ($this->getViewMode() === ViewModeSwitcher::VIEW_MODE_MINIMAL) {
9392
return;

0 commit comments

Comments
 (0)