From 336773bd2b11a4de92e24924c96c97b784019040 Mon Sep 17 00:00:00 2001 From: d10s <79284025+D10S0VSkY-OSS@users.noreply.github.com> Date: Fri, 1 Dec 2023 21:54:18 +0100 Subject: [PATCH 1/5] =?UTF-8?q?=F0=9F=94=A5feat:=20console=20logs=20icons?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sld-dashboard/app/home/routes.py | 16 +++++++++++++--- .../app/home/templates/deploy-stream.html | 18 ++++++++++++++++-- .../app/home/templates/deploys-list.html | 2 +- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/sld-dashboard/app/home/routes.py b/sld-dashboard/app/home/routes.py index 5755aa78..41a6c974 100644 --- a/sld-dashboard/app/home/routes.py +++ b/sld-dashboard/app/home/routes.py @@ -48,10 +48,20 @@ def index(): ) # stream SSE -@blueprint.route('/deploy-stream/') +@blueprint.route('/deploy-stream/') @login_required -def deploy_stream(task_id): - return render_template('deploy-stream.html', task_id=task_id) +def deploy_stream(deploy_id): + token = decrypt(r.get(current_user.id)) + # Check if token no expired + check_unauthorized_token(token) + # Get defaults vars by deploy + endpoint = f"deploy/{deploy_id}" + # Get deploy data vars and set var for render + response = request_url( + verb="GET", uri=f"{endpoint}", headers={"Authorization": f"Bearer {token}"} + ) + deploy = response.get("json") + return render_template('deploy-stream.html', deploy=deploy) @blueprint.route('/stream/') @login_required diff --git a/sld-dashboard/app/home/templates/deploy-stream.html b/sld-dashboard/app/home/templates/deploy-stream.html index 0b78a7db..3f943168 100644 --- a/sld-dashboard/app/home/templates/deploy-stream.html +++ b/sld-dashboard/app/home/templates/deploy-stream.html @@ -47,8 +47,21 @@ {% include 'includes/footer.html' %} + {% endblock content %} {% block javascripts %} + {% endblock javascripts %} From d2f95d35696751a84f24a8ad620388e6e3a79247 Mon Sep 17 00:00:00 2001 From: d10s <79284025+D10S0VSkY-OSS@users.noreply.github.com> Date: Sat, 2 Dec 2023 15:45:04 +0100 Subject: [PATCH 3/5] =?UTF-8?q?=F0=9F=93=9Dstyle:=20console=20log=20button?= =?UTF-8?q?=20applyand=20plan?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sld-dashboard/app/home/templates/deploy-stream.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sld-dashboard/app/home/templates/deploy-stream.html b/sld-dashboard/app/home/templates/deploy-stream.html index 7cc176ce..9325e415 100644 --- a/sld-dashboard/app/home/templates/deploy-stream.html +++ b/sld-dashboard/app/home/templates/deploy-stream.html @@ -101,7 +101,7 @@

Deployment Output:

- APPLY + APPLY {% include 'includes/footer.html' %} From 15e27bbad72985d99c5b037d59461fb69247641c Mon Sep 17 00:00:00 2001 From: d10s <79284025+D10S0VSkY-OSS@users.noreply.github.com> Date: Sat, 2 Dec 2023 20:54:51 +0100 Subject: [PATCH 4/5] =?UTF-8?q?=F0=9F=93=9Dstyle:=20console=20log=20add=20?= =?UTF-8?q?destroy=20button?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sld-dashboard/app/home/routes.py | 26 +++++++++++ .../app/home/templates/deploy-stream.html | 43 ++++++++++++++++++- 2 files changed, 67 insertions(+), 2 deletions(-) diff --git a/sld-dashboard/app/home/routes.py b/sld-dashboard/app/home/routes.py index 6d307d3c..2e90a05b 100644 --- a/sld-dashboard/app/home/routes.py +++ b/sld-dashboard/app/home/routes.py @@ -218,6 +218,32 @@ def destroy_deploy(deploy_id): return render_template("page-500.html"), 500 +@blueprint.route("/deploys/destroy_console/") +@login_required +def destroy_deploy_console(deploy_id): + try: + token = decrypt(r.get(current_user.id)) + # Check if token no expired + check_unauthorized_token(token) + endpoint = f"deploy/{deploy_id}" + response = request_url( + verb="PUT", uri=f"{endpoint}", headers={"Authorization": f"Bearer {token}"} + ) + if response.get("status_code") == 202: + flash(f"Destroying infra") + else: + flash(response["json"]["detail"], "error") + return redirect( + url_for("home_blueprint.route_template", template=f"deploy-stream/{deploy_id}") + ) + 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("/deploys/unlock/") @login_required def unlock_deploy(deploy_id): diff --git a/sld-dashboard/app/home/templates/deploy-stream.html b/sld-dashboard/app/home/templates/deploy-stream.html index 9325e415..74189399 100644 --- a/sld-dashboard/app/home/templates/deploy-stream.html +++ b/sld-dashboard/app/home/templates/deploy-stream.html @@ -11,7 +11,7 @@ border-radius: 4px; margin-top: 20px; overflow-y: auto; - max-height: 600px; + max-height: 530px; } #console-container h2 { @@ -103,6 +103,23 @@

Deployment Output:

APPLY + + + DESTROY + + + + + + + + + {% include 'includes/footer.html' %} @@ -150,6 +167,28 @@

Deployment Output:

} }; - + + {% endblock javascripts %} From ef251a9031f563b477f4ddf5f39bb64ed6ffda7d Mon Sep 17 00:00:00 2001 From: d10s <79284025+D10S0VSkY-OSS@users.noreply.github.com> Date: Sat, 2 Dec 2023 20:58:01 +0100 Subject: [PATCH 5/5] =?UTF-8?q?=E2=AC=86Bump:=20console=20logs=20add=20act?= =?UTF-8?q?ions=20buttons=202.29.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/sld-dashboard-docker-image.yml | 4 ++-- play-with-sld/kubernetes/k8s/sld-dashboard.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sld-dashboard-docker-image.yml b/.github/workflows/sld-dashboard-docker-image.yml index 19ddbec9..65e657e1 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.28.0 + run: docker build . --file Dockerfile --tag ${{ secrets.DOCKER_USERNAME }}/sld-dashboard:2.29.0 - name: Docker Push with tags #if: github.event.pull_request.merged == true - run: docker push ${{ secrets.DOCKER_USERNAME }}/sld-dashboard:2.28.0 + run: docker push ${{ secrets.DOCKER_USERNAME }}/sld-dashboard:2.29.0 - name: Build the Docker image working-directory: ./sld-dashboard run: docker build . --file Dockerfile --tag ${{ secrets.DOCKER_USERNAME }}/sld-dashboard:latest diff --git a/play-with-sld/kubernetes/k8s/sld-dashboard.yml b/play-with-sld/kubernetes/k8s/sld-dashboard.yml index a489702e..1191f757 100644 --- a/play-with-sld/kubernetes/k8s/sld-dashboard.yml +++ b/play-with-sld/kubernetes/k8s/sld-dashboard.yml @@ -17,7 +17,7 @@ spec: subdomain: primary containers: - name: sld-dashboard - image: d10s0vsky/sld-dashboard:2.28.0 + image: d10s0vsky/sld-dashboard:2.29.0 env: - name: PATH value: "/home/sld/.asdf/shims:/home/sld/.asdf/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"