Commit d7f13b9a authored by Vasyl Bodnaruk's avatar Vasyl Bodnaruk

log view

parent 70676a46
...@@ -18,7 +18,6 @@ class JobListView(ListView): ...@@ -18,7 +18,6 @@ class JobListView(ListView):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
self.service.update_jobs_status() self.service.update_jobs_status()
j = Job.objects.all().order_by('-create_time') j = Job.objects.all().order_by('-create_time')
print("NOOOOOT")
if request.is_ajax(): if request.is_ajax():
action = request.GET.get('action') action = request.GET.get('action')
job_id = request.GET.get('id') job_id = request.GET.get('id')
...@@ -32,12 +31,12 @@ class JobListView(ListView): ...@@ -32,12 +31,12 @@ class JobListView(ListView):
} }
return render(request, self.template_name, {'jobs': jobs}) return render(request, self.template_name, {'jobs': jobs})
@csrf_exempt
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
if request.is_ajax(): if request.is_ajax():
action = request.POST.get('action') action = request.POST.get('action')
job_id = request.POST.get('id') job_id = request.POST.get('id')
return self._logic(action, job_id) return self._logic(action, job_id)
return HttpResponseRedirect(reverse('job_list'))
def _logic(self, action, job_id): def _logic(self, action, job_id):
if action == 'run': if action == 'run':
...@@ -57,7 +56,6 @@ class JobListView(ListView): ...@@ -57,7 +56,6 @@ class JobListView(ListView):
if action == 'log': if action == 'log':
log = self.service.get_log(job_id) log = self.service.get_log(job_id)
return HttpResponse(log, content_type='text/plain') return HttpResponse(log, content_type='text/plain')
return HttpResponseRedirect(reverse('job_list'))
class NewJobCreateView(CreateView): class NewJobCreateView(CreateView):
......
...@@ -198,7 +198,7 @@ ...@@ -198,7 +198,7 @@
url: AJAX_URL, url: AJAX_URL,
cache: false, cache: false,
contentType: "application/json; charset=utf-8", contentType: "application/json; charset=utf-8",
// headers: { 'X-CSRFToken': $.cookie('csrftoken') }, headers: { 'X-CSRFToken': $.cookie('csrftoken') },
data: data, data: data,
success: success, success: success,
error: error error: error
......
...@@ -217,6 +217,7 @@ ...@@ -217,6 +217,7 @@
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js"
integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb"
crossorigin="anonymous"></script> crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.16.2/axios.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.16.2/axios.min.js"></script>
<script src="{% static 'js/highlight.pack.js' %}"></script> <script src="{% static 'js/highlight.pack.js' %}"></script>
<script src="{% static 'js/dateformat.js' %}"></script> <script src="{% static 'js/dateformat.js' %}"></script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment