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

Merge branch '594-improve-monitoring-page' into 'master'

bugfix error 500 when click service hold/resume button

See merge request !245
parents 4e97d7a8 7255dcb8
Branches
No related tags found
2 merge requests!246Master,!245bugfix error 500 when click service hold/resume button
Pipeline #29352 passed
...@@ -287,9 +287,9 @@ def convert_monitor_to_html(request, monitor_data): ...@@ -287,9 +287,9 @@ def convert_monitor_to_html(request, monitor_data):
# only provide the hold/resume buttons for superusers, otherwise just show the state # only provide the hold/resume buttons for superusers, otherwise just show the state
if request.user.is_superuser: if request.user.is_superuser:
if record.enabled=="True": 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>' service_enabled = str(record.enabled) + '&nbsp;&nbsp; <a href="service_hold_resume/' + record.name + '/' + record.hostname + '/False"' + 'class="btn btn-warning btn-sm" role="button"><i class="fas fa-pause"></i> Hold</a>'
else: 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>' service_enabled = str(record.enabled) + '&nbsp;&nbsp; <a href="service_hold_resume/' + record.name + '/' + record.hostname + '/True"' + 'class="btn btn-success btn-sm" role="button"><i class="fas fa-play"></i> Resume</a>'
else: else:
service_enabled = str(record.enabled) service_enabled = str(record.enabled)
......
...@@ -72,7 +72,8 @@ urlpatterns = [ ...@@ -72,7 +72,8 @@ urlpatterns = [
path('monitor/<int:pk>/', views.MonitorDetailsViewAPI.as_view(),name='monitor-detail-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('latest_monitor/', views.LatestMonitorListViewAPI.as_view(),name='latest-monitor-detail-view-api'),
path('monitor/clear_inactive_services/', views.ClearInactiveServices, name='clear-inactive-services'), path('monitor/clear_inactive_services/', views.ClearInactiveServices, name='clear-inactive-services'),
path('monitoring/service_hold_resume/<int:pk>/<enabled>', views.ServiceHoldResume, name='service-hold-resume'), # path('monitoring/service_hold_resume/<int:pk>/<enabled>', views.ServiceHoldResume, name='service-hold-resume'),
path('monitoring/service_hold_resume/<name>/<hostname>/<enabled>', views.ServiceHoldResume, name='service-hold-resume'),
# --- custom requests --- # --- custom requests ---
# /atdb/get_size?status__in=defined,staged # /atdb/get_size?status__in=defined,staged
......
...@@ -953,9 +953,9 @@ def HoldQuery(request, pk, hold_it, query_params): ...@@ -953,9 +953,9 @@ def HoldQuery(request, pk, hold_it, query_params):
return redirect('/atdb/query/?' + current_query_params) return redirect('/atdb/query/?' + current_query_params)
@login_required @login_required
def ServiceHoldResume(request, pk, enabled): def ServiceHoldResume(request, name, hostname, enabled):
model = LatestMonitor model = LatestMonitor
service = LatestMonitor.objects.get(pk=pk) service = LatestMonitor.objects.get(name=name,hostname=hostname)
metadata = service.metadata metadata = service.metadata
if not metadata: if not metadata:
metadata = {} metadata = {}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment