diff --git a/atdb/taskdatabase/templates/taskdatabase/index.html b/atdb/taskdatabase/templates/taskdatabase/index.html index 66d63c06367a86b7f3a23457521344c61684aaeb..c0027a5ff9a23ea9058bc867f84a36e77f83a3fe 100644 --- a/atdb/taskdatabase/templates/taskdatabase/index.html +++ b/atdb/taskdatabase/templates/taskdatabase/index.html @@ -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> diff --git a/atdb/taskdatabase/templates/taskdatabase/monitoring_page.html b/atdb/taskdatabase/templates/taskdatabase/monitoring_page.html index 98a438e6b996fd37c8e0544531cdf8bc961399fd..6b85c675e86ef472209e1402525f456b39e13d76 100644 --- a/atdb/taskdatabase/templates/taskdatabase/monitoring_page.html +++ b/atdb/taskdatabase/templates/taskdatabase/monitoring_page.html @@ -16,7 +16,11 @@ <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> diff --git a/atdb/taskdatabase/urls.py b/atdb/taskdatabase/urls.py index 9d0a5aaa55a15fcbb52c3b10fbfd3bbbc041e1d1..b59a75812adf8eb9ad8b8ae7c762cfeabf87db02 100644 --- a/atdb/taskdatabase/urls.py +++ b/atdb/taskdatabase/urls.py @@ -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 diff --git a/atdb/taskdatabase/views.py b/atdb/taskdatabase/views.py index 0fc33ba7a9836c4b4adcfc2dc68553caf270ae45..cc0bf873787d15c46d323cc99c65af79292080d0 100644 --- a/atdb/taskdatabase/views.py +++ b/atdb/taskdatabase/views.py @@ -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