class MonitorList: @csrf_exempt def routing(self, request, region=None): if request.method == "GET": return self.get(request, region) @csrf_exempt def __init__(self): self.event = EventBLL() @csrf_exempt def get(self, request, region=None): args = {} monitor_list = self.event.get_event_monitor_list(region=region) args['monitor_list'] = monitor_list date_time = DateTime() args['now'] = date_time.get_now() data = json.dumps(args) return HttpResponse(data, content_type='application/json', status=status.HTTP_200_OK) @csrf_exempt def get_running_monitor_list(self, request, region=None): running_monitor_list = self.event.get_running_event_monitor_list( region=region) args = {} args['monitor_running_list'] = running_monitor_list date_time = DateTime() args['now'] = date_time.get_now() data = json.dumps(args) return HttpResponse(data, content_type='application/json', status=status.HTTP_200_OK) @csrf_exempt def get_waiting_monitor_list(self, request, region=None): waiting_monitor_list = self.event.get_waiting_event_monitor_list( region=region) args = {} args['monitor_running_list'] = waiting_monitor_list date_time = DateTime() args['now'] = date_time.get_now() data = json.dumps(args) return HttpResponse(data, content_type='application/json', status=status.HTTP_200_OK) @csrf_exempt def get_completed_monitor_list(self, request, region=None): completed_monitor_list = self.event.get_completed_event_monitor_list( region=region) args = {} args['monitor_completed_list'] = completed_monitor_list date_time = DateTime() args['now'] = date_time.get_now() data = json.dumps(args) return HttpResponse(data, content_type='application/json', status=status.HTTP_200_OK)
class MonitorList: @csrf_exempt def routing(self, request): if not request.user.is_authenticated(): return HttpResponseRedirect('/accounts/login') if request.method == "GET": return self.get(request) @csrf_exempt def __init__(self): self.event = EventBLL() @csrf_exempt def get(self, request): args = {} monitor_list = self.event.get_event_monitor_list() args['monitor_list'] = monitor_list data = json.dumps(args) return HttpResponse(data, content_type='application/json', status=status.HTTP_200_OK) @csrf_exempt def get_running_monitor_list(self, request): running_monitor_list = self.event.get_running_event_monitor_list() data = json.dumps(running_monitor_list) return HttpResponse(data, content_type='application/json', status=status.HTTP_200_OK) @csrf_exempt def get_waiting_monitor_list(self, request): running_monitor_list = self.event.get_waiting_event_monitor_list() data = json.dumps(running_monitor_list) return HttpResponse(data, content_type='application/json', status=status.HTTP_200_OK) @csrf_exempt def get_completed_monitor_list(self, request): running_monitor_list = self.event.get_completed_event_monitor_list() data = json.dumps(running_monitor_list) return HttpResponse(data, content_type='application/json', status=status.HTTP_200_OK)
class MonitorDetail: @csrf_exempt def routing(self, request, event_monitor_id): if request.method == "GET": return self.get(request, event_monitor_id) @csrf_exempt def __init__(self): self.event = EventBLL() @csrf_exempt def get(self, request, event_monitor_id): args = {} monitor = self.event.get_event_monitor(event_monitor_id) #update last update self.event.update_last_update(event_monitor_id) args["monitor"] = monitor date_time = DateTime() args['now'] = date_time.get_now() data = json.dumps(args) return HttpResponse(data, content_type='application/json', status=status.HTTP_200_OK)
def __init__(self): self.event = EventBLL()