File tree 8 files changed +47
-8
lines changed
8 files changed +47
-8
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ class Icons
10
10
11
11
const HOST_DOWN = 'sitemap ' ;
12
12
13
+ const UNREACHABLE = 'sitemap ' ;
14
+
13
15
const IN_DOWNTIME = 'plug ' ;
14
16
15
17
const IS_ACKNOWLEDGED = 'check ' ;
Original file line number Diff line number Diff line change 56
56
* @property ?string $zone_id
57
57
* @property string $command_endpoint_name
58
58
* @property ?string $command_endpoint_id
59
+ * @property ?int $affected_children
59
60
*/
60
61
class Host extends Model
61
62
{
@@ -111,7 +112,8 @@ public function getColumns()
111
112
'zone_name ' ,
112
113
'zone_id ' ,
113
114
'command_endpoint_name ' ,
114
- 'command_endpoint_id '
115
+ 'command_endpoint_id ' ,
116
+ 'affected_children '
115
117
];
116
118
}
117
119
@@ -155,7 +157,8 @@ public function getColumnDefinitions()
155
157
'zone_name ' => t ('Zone Name ' ),
156
158
'zone_id ' => t ('Zone Id ' ),
157
159
'command_endpoint_name ' => t ('Endpoint Name ' ),
158
- 'command_endpoint_id ' => t ('Endpoint Id ' )
160
+ 'command_endpoint_id ' => t ('Endpoint Id ' ),
161
+ 'affected_children ' => t ('Affected Children ' ),
159
162
];
160
163
}
161
164
Original file line number Diff line number Diff line change @@ -53,7 +53,8 @@ public function getColumnDefinitions()
53
53
'last_update ' => t ('Host Last Update ' ),
54
54
'last_state_change ' => t ('Host Last State Change ' ),
55
55
'next_check ' => t ('Host Next Check ' ),
56
- 'next_update ' => t ('Host Next Update ' )
56
+ 'next_update ' => t ('Host Next Update ' ),
57
+ 'affects_children ' => t ('Host Affects Children ' ),
57
58
];
58
59
}
59
60
Original file line number Diff line number Diff line change 51
51
* @property ?string $zone_id
52
52
* @property string $command_endpoint_name
53
53
* @property ?string $command_endpoint_id
54
+ * @property ?int $affected_children
54
55
*/
55
56
class Service extends Model
56
57
{
@@ -103,7 +104,8 @@ public function getColumns()
103
104
'zone_name ' ,
104
105
'zone_id ' ,
105
106
'command_endpoint_name ' ,
106
- 'command_endpoint_id '
107
+ 'command_endpoint_id ' ,
108
+ 'affected_children '
107
109
];
108
110
}
109
111
@@ -144,7 +146,8 @@ public function getColumnDefinitions()
144
146
'zone_name ' => t ('Zone Name ' ),
145
147
'zone_id ' => t ('Zone Id ' ),
146
148
'command_endpoint_name ' => t ('Endpoint Name ' ),
147
- 'command_endpoint_id ' => t ('Endpoint Id ' )
149
+ 'command_endpoint_id ' => t ('Endpoint Id ' ),
150
+ 'affected_children ' => t ('Affected Children ' )
148
151
];
149
152
}
150
153
Original file line number Diff line number Diff line change @@ -55,7 +55,8 @@ public function getColumnDefinitions()
55
55
'last_update ' => t ('Service Last Update ' ),
56
56
'last_state_change ' => t ('Service Last State Change ' ),
57
57
'next_check ' => t ('Service Next Check ' ),
58
- 'next_update ' => t ('Service Next Update ' )
58
+ 'next_update ' => t ('Service Next Update ' ),
59
+ 'affects_children ' => t ('Service Affects Children ' ),
59
60
];
60
61
}
61
62
Original file line number Diff line number Diff line change 48
48
* @property DateTime $last_state_change The time when the node last got a status change
49
49
* @property DateTime $next_check The time when the node will execute the next check
50
50
* @property DateTime $next_update The time when the next check of the node is expected to end
51
+ * @property bool $affects_children Whether any of the children is affected if there is a problem
51
52
*/
52
53
abstract class State extends Model
53
54
{
@@ -98,7 +99,8 @@ public function getColumns()
98
99
'last_update ' ,
99
100
'last_state_change ' ,
100
101
'next_check ' ,
101
- 'next_update '
102
+ 'next_update ' ,
103
+ 'affects_children '
102
104
];
103
105
}
104
106
@@ -111,7 +113,8 @@ public function createBehaviors(Behaviors $behaviors)
111
113
'is_flapping ' ,
112
114
'is_overdue ' ,
113
115
'is_acknowledged ' ,
114
- 'in_downtime '
116
+ 'in_downtime ' ,
117
+ 'affects_children '
115
118
]));
116
119
117
120
$ behaviors ->add (new MillisecondTimestamp ([
Original file line number Diff line number Diff line change 13
13
use ipl \Html \HtmlElement ;
14
14
use ipl \Web \Common \BaseListItem ;
15
15
use ipl \Web \Widget \EmptyState ;
16
+ use ipl \Web \Widget \StateBadge ;
16
17
use ipl \Web \Widget \TimeSince ;
17
18
use ipl \Html \BaseHtmlElement ;
18
19
use ipl \Html \Html ;
@@ -93,6 +94,23 @@ protected function assembleTitle(BaseHtmlElement $title): void
93
94
$ this ->createSubject (),
94
95
Html::tag ('span ' , ['class ' => 'state-text ' ], $ this ->state ->getStateTextTranslated ())
95
96
));
97
+
98
+ if ($ this ->state ->affects_children ) {
99
+ $ total = $ this ->item ->affected_children ;
100
+
101
+ if ((int ) $ total > 1000 ) {
102
+ $ total = '1000+ ' ;
103
+ }
104
+
105
+ $ icon = new Icon (Icons::UNREACHABLE );
106
+
107
+ $ title ->addHtml ((new StateBadge ([$ icon , Text::create ($ total )], '' ))
108
+ ->addAttributes ([
109
+ 'class ' => 'affected-objects ' ,
110
+ 'title ' => sprintf (t ('Up to %s affected objects ' ), $ total )
111
+ ])
112
+ );
113
+ }
96
114
}
97
115
98
116
protected function assembleVisual (BaseHtmlElement $ visual ): void
Original file line number Diff line number Diff line change @@ -403,3 +403,11 @@ div.show-more {
403
403
form [name= " form_confirm_removal" ] {
404
404
text-align : center ;
405
405
}
406
+
407
+ .affected-objects {
408
+ display : inline-flex ;
409
+ align-items : baseline ;
410
+ background-color : @state-critical ;
411
+ color : @text-color-inverted ;
412
+ padding : 0 0.25em ;
413
+ }
You can’t perform that action at this time.
0 commit comments