From 4df434cdfb42b7afac3f8a4781c4aa0a3005d092 Mon Sep 17 00:00:00 2001 From: Sawyer Bergeron Date: Fri, 14 Dec 2018 16:05:47 -0500 Subject: Implement Segmented Workflows A major source of bugs has been how we've approached inlining workflows. We no longer inline them as of this commit, and instead use a stack structure. This commits the result of workflows to the database before other workflows try to read them, so we don't have to maintain a code path for when something is or isn't committed to db. This patchset allows for workflows to pass limited information to preset selections Change-Id: I3d040c7f3024c7420017ae4ec66a23219303dcb6 Signed-off-by: Sawyer Bergeron --- dashboard/src/workflow/views.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'dashboard/src/workflow/views.py') diff --git a/dashboard/src/workflow/views.py b/dashboard/src/workflow/views.py index e5ef5c6..6d59b1c 100644 --- a/dashboard/src/workflow/views.py +++ b/dashboard/src/workflow/views.py @@ -30,6 +30,17 @@ def attempt_auth(request): def delete_session(request): + manager = attempt_auth(request) + + if not manager: + return HttpResponseGone("No session found that relates to current request") + + if manager.pop_workflow(): + return HttpResponse('') + else: + del ManagerTracker.managers[request.session['manager_session']] + return render(request, 'workflow/exit_redirect.html') + try: del ManagerTracker.managers[request.session['manager_session']] return HttpResponse('') @@ -70,7 +81,8 @@ def manager_view(request): logger.debug("edit found") manager.add_workflow(workflow_type=request.POST.get('edit'), edit_object=int(request.POST.get('edit_id'))) elif request.POST.get('cancel') is not None: - del ManagerTracker.managers[request.session['manager_session']] + if not manager.pop_workflow(): + del ManagerTracker.managers[request.session['manager_session']] return manager.status(request) -- cgit 1.2.3-korg