diff --git a/src/psm/Module/Server/Controller/StatusController.php b/src/psm/Module/Server/Controller/StatusController.php index dc425910..fcb8a642 100644 --- a/src/psm/Module/Server/Controller/StatusController.php +++ b/src/psm/Module/Server/Controller/StatusController.php @@ -73,6 +73,7 @@ class StatusController extends AbstractServerController { $servers = $this->getServers(); $layout_data['servers_offline'] = array(); + $layout_data['servers_warning'] = array(); $layout_data['servers_online'] = array(); foreach ($servers as $server) { @@ -91,8 +92,7 @@ class StatusController extends AbstractServerController { if ($server['status'] == "off") { $layout_data['servers_offline'][] = $server; } elseif ($server['warning_threshold_counter'] > 0) { - $server['class_warning'] = 'warning'; - $layout_data['servers_offline'][] = $server; + $layout_data['servers_warning'][] = $server; } else { $layout_data['servers_online'][] = $server; } diff --git a/src/templates/default/module/server/status/index.tpl.html b/src/templates/default/module/server/status/index.tpl.html index 37927a09..38abc58a 100644 --- a/src/templates/default/module/server/status/index.tpl.html +++ b/src/templates/default/module/server/status/index.tpl.html @@ -18,6 +18,21 @@ <noscript></a></noscript> </div> {% endfor %} + {% for server in servers_warning %} + <div class="col-sm-4 col-md-3"> + <noscript><a href="{{ server.url_view|raw }}"></noscript> + <div class="card text-white bg-warning mb-3" onclick="window.location.href='{{ server.url_view|raw }}'"> + <div class="card-header">{{ server.label }}<span class="sr-only"> ({{ label_warning }})</span></div> + <div class="card-body"> + <p class="card-text"> + {{ label_last_online }}: {{ server.last_online_nice }}<br> + {{ label_last_check }}: {{ server.last_checked_nice }} + </p> + </div> + </div> + <noscript></a></noscript> + </div> + {% endfor %} {% for server in servers_online %} <div class="col-sm-4 col-md-3"> <noscript><a href="{{ server.url_view|raw }}"></noscript> @@ -34,7 +49,7 @@ <noscript></a></noscript> </div> {% endfor %} - {% if not servers_offline and not servers_online %} + {% if not servers_offline and not servers_warning and not servers_online %} {{ label_none }} <div class="w-100"></div> <button class="btn btn-primary" onclick="window.location.href='{{ url_save|raw }}'">{{ label_add_server }}</button> @@ -43,9 +58,9 @@ </div> <div id="list-layout" class="{{ list_layout_active }}" aria-labelledby="block-layout" style="display:none;"> <div class="row table-responsive"> - {% if servers_offline or servers_online %} + {% if servers_offline or servers_warning or servers_online %} <table class="table table-bordered table-hover"> - {% if servers_offline %} + {% if servers_offline or servers_warning %} <thead> <tr> <th scope="col">#</th> @@ -63,6 +78,14 @@ <td></td> </tr> {% endfor %} + {% for server in servers_warning %} + <tr class="bg-warning text-white" onclick="window.location.href='{{ server.url_view|raw }}'"> + <th class="full">{{ server.label }}<span class="sr-only"> ({{ label_warning }})</span></th> + <td>{{ server.last_online_nice }}</td> + <td>{{ server.last_checked_nice }}</td> + <td></td> + </tr> + {% endfor %} </tbody> {% endif %} {% if servers_online %}