Skip to content

Commit ff1740d

Browse files
committed
Add icinga state for services
1 parent 07b5df8 commit ff1740d

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

library/Kubernetes/Model/Service.php

+4
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ public function getColumnDefinitions(): array
8383
'allocate_load_balancer_node_ports' => $this->translate('Allocated Load Balancer Node Ports'),
8484
'load_balancer_class' => $this->translate('Load Balancer Class'),
8585
'internal_traffic_policy' => $this->translate('Internal Traffic Policy'),
86+
'icinga_state' => $this->translate('Icinga State'),
87+
'icinga_state_reason' => $this->translate('Icinga State Reason'),
8688
'yaml' => $this->translate('YAML'),
8789
'created' => $this->translate('Created At')
8890
];
@@ -110,6 +112,8 @@ public function getColumns(): array
110112
'allocate_load_balancer_node_ports',
111113
'load_balancer_class',
112114
'internal_traffic_policy',
115+
'icinga_state',
116+
'icinga_state_reason',
113117
'yaml',
114118
'created'
115119
];

library/Kubernetes/Web/ServiceDetail.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@ protected function assemble(): void
7171
),
7272
$this->translate('Load Balancer Class') => $this->service->load_balancer_class ??
7373
new EmptyState($this->translate('None')),
74-
$this->translate('Internal Traffic Policy') => $this->service->internal_traffic_policy
74+
$this->translate('Internal Traffic Policy') => $this->service->internal_traffic_policy,
75+
$this->translate('Icinga State') => new DetailState($this->service->icinga_state),
76+
$this->translate('Icinga State Reason') => new IcingaStateReason(
77+
$this->service->icinga_state_reason
78+
)
7579
])),
7680
new Labels($this->service->label),
7781
new Annotations($this->service->annotation),

library/Kubernetes/Web/ServiceListItem.php

+4-12
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\Links;
1113
use ipl\Html\Attributes;
1214
use ipl\Html\BaseHtmlElement;
@@ -16,19 +18,14 @@
1618
use ipl\I18n\Translation;
1719
use ipl\Web\Widget\HorizontalKeyValue;
1820
use ipl\Web\Widget\Link;
19-
use ipl\Web\Widget\StateBall;
2021

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

3330
protected function assembleFooter(BaseHtmlElement $footer): void
3431
{
@@ -58,9 +55,4 @@ protected function assembleTitle(BaseHtmlElement $title): void
5855
)
5956
);
6057
}
61-
62-
protected function assembleVisual(BaseHtmlElement $visual): void
63-
{
64-
$visual->addHtml(new StateBall('none', StateBall::SIZE_MEDIUM));
65-
}
6658
}

0 commit comments

Comments
 (0)