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

add 'clear services' button

parent d7a4c12d
No related branches found
No related tags found
2 merge requests!230Master,!229add 'clear services' button
......@@ -34,7 +34,7 @@
{% include 'taskdatabase/pagination.html' %}
</div>
</div>
<p class="footer"> Version 1.0.0 (11 apr 2021 - 8:00)
<p class="footer"> Version 1.0.0 (11 apr 2021 - 13:00)
</div>
......
......@@ -16,7 +16,11 @@
&nbsp;
<div class="thumbnail">
<h5>Health and Status of the LDV services.</h5>
{% if user.is_superuser %}
<p>
<a href="{% url 'clear-inactive-services' %}" class="btn btn-secondary btn-sm" role="button"><i class="fas fa-window-close"></i> Clear Services</a>
</p>
{% endif %}
<table class="table table-striped">
<th>LDV-Service</th><th>Host</th><th>Status</th><th>Timestamp</th><th>Process id</th><th>Description</th>
<tbody>
......
......@@ -70,6 +70,8 @@ urlpatterns = [
path('monitor/', views.MonitorListViewAPI.as_view(),name='monitor-list-view-api'),
path('monitor/<int:pk>/', views.MonitorDetailsViewAPI.as_view(),name='monitor-detail-view-api'),
path('latest_monitor/', views.LatestMonitorListViewAPI.as_view(),name='latest-monitor-detail-view-api'),
path('monitor/clear_inactive_services/', views.ClearInactiveServices, name='clear-inactive-services'),
# --- custom requests ---
# /atdb/get_size?status__in=defined,staged
......
......@@ -894,6 +894,12 @@ class LatestMonitorListViewAPI(generics.ListCreateAPIView):
filter_class = MonitorFilter
@login_required
def ClearInactiveServices(request):
LatestMonitor.objects.all().delete()
return redirect("/atdb/monitoring")
# example: /atdb/job/5/
class MonitorDetailsViewAPI(generics.RetrieveUpdateDestroyAPIView):
model = Monitor
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment