#monotoring_detail

This commit is contained in:
xieshen 2020-11-11 08:48:03 +08:00
parent 52c8dbaa9c
commit fa85962618
2 changed files with 23 additions and 4 deletions

View File

@ -4,6 +4,7 @@ from dashboard import views
urlpatterns = [
path('monotoring/',views.monotoring),
path('monotoring/detail/<str:pk>/',views.monotoring_detail),
path('alarm/',views.alarm),
path('task/histories/',views.task_histories),
path('task/histories/detail/<str:pk>/',views.task_histories_detail),

View File

@ -172,8 +172,26 @@ def task_histories_detail(request, pk):
o['msg'] = output_list[2]
res.append(o)
return HttpResponse(json.dumps({
"status":"1",
"res":res,
"count":len(row),
"page_count":math.ceil(len(row)/10),
"status": "1",
"res": res,
"count": len(row),
"page_count": math.ceil(len(row) / 10),
}))
def monotoring_detail(request, pk):
with connection.cursor() as cursor:
cursor.execute("select * from detections where id = '%s'" % (pk))
row = cursor.fetchall()
res = []
for r in row:
o = dict()
o['addr'] = r[3]
o['rate'] = r[7]
o['latest'] = r[13]
o['latest_run_time'] = r[14]
res.append(o)
return HttpResponse(json.dumps({
"status": "1",
"res": res
}))