Skip to content
Snippets Groups Projects
Commit fa6c1dc1 authored by Nico Vermaas's avatar Nico Vermaas
Browse files

service resume/hold buttons (in progress)

parent 144fe561
No related branches found
No related tags found
2 merge requests!244Master,!241594 improve monitoring page
...@@ -288,18 +288,22 @@ def convert_monitor_to_html(request, monitor_data): ...@@ -288,18 +288,22 @@ def convert_monitor_to_html(request, monitor_data):
line += "<td><b>" + link_to_service_history + "</b></td>" line += "<td><b>" + link_to_service_history + "</b></td>"
line += "<td>" + str(record.hostname) + "</td>" line += "<td>" + str(record.hostname) + "</td>"
if record.enabled=="True": # only provide the hold/resume buttons for superusers, otherwise just show the state
button_html = '<a href="service_hold_resume/' + str(record.pk) + '/False"' + 'class="btn btn-warning btn-sm" role="button"><i class="fas fa-pause"></i> Hold</a>' if request.user.is_superuser:
if record.enabled=="True":
service_enabled = str(record.enabled) + '&nbsp;&nbsp; <a href="service_hold_resume/' + str(record.pk) + '/False"' + 'class="btn btn-warning btn-sm" role="button"><i class="fas fa-pause"></i> Hold</a>'
else:
service_enabled = str(record.enabled) + '&nbsp;&nbsp; <a href="service_hold_resume/' + str(record.pk) + '/True"' + 'class="btn btn-success btn-sm" role="button"><i class="fas fa-play"></i> Resume</a>'
else: else:
button_html = '<a href="service_hold_resume/' + str(record.pk) + '/True"' + 'class="btn btn-success btn-sm" role="button"><i class="fas fa-play"></i> Resume</a>' service_enabled = str(record.enabled)
# if the heartbeat is 30 minutes late, show '(late)' in red # if the heartbeat is 30 minutes late, show '(late)' in red
if delta.seconds > 1800: if delta.seconds > 1800:
line += '<td>' + button_html + str(record.enabled) + "</td>" line += "<td>" + service_enabled + "</td>"
line += "<td><i>unknown</i></td>" line += "<td><i>unknown</i></td>"
line += '<td class="error">' + str(record.timestamp.strftime(TIME_FORMAT)) + " - (late)</td>" line += '<td class="error">' + str(record.timestamp.strftime(TIME_FORMAT)) + " - (late)</td>"
else: else:
line += '<td>' + button_html + str(record.enabled) + "</td>" line += "<td>" + service_enabled + "</td>"
line += '<td class="' + record.status + '" >' + str(record.status) + "</td>" line += '<td class="' + record.status + '" >' + str(record.status) + "</td>"
line += '<td>' + str(record.timestamp.strftime(TIME_FORMAT)) + "</td>" line += '<td>' + str(record.timestamp.strftime(TIME_FORMAT)) + "</td>"
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
{% include 'taskdatabase/pagination.html' %} {% include 'taskdatabase/pagination.html' %}
</div> </div>
</div> </div>
<p class="footer"> Version 1.0.0 (14 apr 2021 - 13:00) <p class="footer"> Version 1.0.0 (19 apr 2021 - 13:00)
</div> </div>
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</p> </p>
{% endif %} {% endif %}
<table class="table table-striped"> <table class="table table-striped">
<th>LDV-Service</th><th>Host</th><th>Enabled</th><th>Status</th><th>Timestamp</th><th>Process id</th><th>Description</th> <th>LDV-Service</th><th>Host</th><th>Enabled</th><th>Last Status</th><th>Timestamp</th><th>Process id</th><th>Description</th>
<tbody> <tbody>
{{ monitor_results | safe }} {{ monitor_results | safe }}
</tbody> </tbody>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment