From 5251a9abbf55e6c9795d24d0c8506798126c4975 Mon Sep 17 00:00:00 2001 From: d10s <79284025+D10S0VSkY-OSS@users.noreply.github.com> Date: Fri, 17 Nov 2023 00:00:42 +0100 Subject: [PATCH] =?UTF-8?q?=E2=AC=86=20Bump=20docker=20version=20dashboard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workflows/sld-dashboard-docker-image.yml | 4 +- sld-dashboard/app/home/routes.py | 62 ++++++++++++------- 2 files changed, 40 insertions(+), 26 deletions(-) diff --git a/.github/workflows/sld-dashboard-docker-image.yml b/.github/workflows/sld-dashboard-docker-image.yml index d16b9ee6..aad97345 100644 --- a/.github/workflows/sld-dashboard-docker-image.yml +++ b/.github/workflows/sld-dashboard-docker-image.yml @@ -24,11 +24,11 @@ jobs: - name: Build the Docker image with tags working-directory: ./sld-dashboard - run: docker build . --file Dockerfile --tag ${{ secrets.DOCKER_USERNAME }}/sld-dashboard:2.16.0 + run: docker build . --file Dockerfile --tag ${{ secrets.DOCKER_USERNAME }}/sld-dashboard:2.17.0 - name: Docker Push with tags #if: github.event.pull_request.merged == true - run: docker push ${{ secrets.DOCKER_USERNAME }}/sld-dashboard:2.16.0 + run: docker push ${{ secrets.DOCKER_USERNAME }}/sld-dashboard:2.17.0 - name: Build the Docker image working-directory: ./sld-dashboard diff --git a/sld-dashboard/app/home/routes.py b/sld-dashboard/app/home/routes.py index 2e8ce0d9..37653ad8 100644 --- a/sld-dashboard/app/home/routes.py +++ b/sld-dashboard/app/home/routes.py @@ -44,35 +44,49 @@ def index(): @blueprint.route('/status/') def status(task_id): - token = decrypt(r.get(current_user.id)) - # Check if token no expired - check_unauthorized_token(token) - response = request_url( - verb="GET", - uri=f"tasks/id/{task_id}", - headers={"Authorization": f"Bearer {token}"} - ) - if response.get("status_code") == 200: - data = response.get("json").get("result") - return jsonify(data) - else: - return jsonify({"status": "Error"}), response.status_code + try: + token = decrypt(r.get(current_user.id)) + # Check if token no expired + check_unauthorized_token(token) + response = request_url( + verb="GET", + uri=f"tasks/id/{task_id}", + headers={"Authorization": f"Bearer {token}"} + ) + if response.get("status_code") == 200: + data = response.get("json").get("result") + return jsonify(data) + else: + return jsonify({"status": "Error"}), response.status_code + except TemplateNotFound: + return render_template("page-404.html"), 404 + except TypeError: + return redirect(url_for("base_blueprint.logout")) + except Exception: + return render_template("page-500.html"), 500 @blueprint.route('/output/') @login_required def output(task_id): - token = decrypt(r.get(current_user.id)) - # Check if token no expired - check_unauthorized_token(token) - response = request_url( - verb="GET", - uri=f"tasks/id/{task_id}", - headers={"Authorization": f"Bearer {token}"} - ) - if response.get("status_code") == 200: - data = response.get("json").get("result").get("module").get("stdout") - return data + try: + token = decrypt(r.get(current_user.id)) + # Check if token no expired + check_unauthorized_token(token) + response = request_url( + verb="GET", + uri=f"tasks/id/{task_id}", + headers={"Authorization": f"Bearer {token}"} + ) + if response.get("status_code") == 200: + data = response.get("json").get("result").get("module").get("stdout") + return data + except TemplateNotFound: + return render_template("page-404.html"), 404 + except TypeError: + return redirect(url_for("base_blueprint.logout")) + except Exception: + return render_template("page-500.html"), 500 # Start Deploy