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/base/static/assets/css/volt.css b/sld-dashboard/app/base/static/assets/css/volt.css index 3ec33371..36468552 100644 --- a/sld-dashboard/app/base/static/assets/css/volt.css +++ b/sld-dashboard/app/base/static/assets/css/volt.css @@ -41746,6 +41746,71 @@ pre { position: relative; flex: 1 1 auto; padding: 1rem; - background-color: #040720; + background-color: #333; color: #fff; -} \ No newline at end of file +} + +.tag-style { + background-color: #262B40; +; /* Un gris oscuro */ + color: white; /* Texto en color blanco para contraste */ + padding: 5px 10px; /* Espaciado interno para dar forma al tag */ + border-radius: 5px; /* Bordes redondeados para la apariencia de un tag */ + font-weight: normal; /* Peso de la fuente, ajusta según necesidad */ + display: inline-block; /* Para asegurar que el estilo se aplique correctamente */ + margin: 2px; /* Un pequeño margen alrededor del tag */ + width: 100px; /* Ancho fijo para el tag */ + text-align: center; /* Centrar el texto dentro del tag */ +} + + +.tag-style-success { + background-color: var(--bs-soft-green); /* Un gris oscuro */ + color: white; /* Texto en color blanco para contraste */ + padding: 5px 10px; /* Espaciado interno para dar forma al tag */ + border-radius: 5px; /* Bordes redondeados para la apariencia de un tag */ + font-weight: normal; /* Peso de la fuente, ajusta según necesidad */ + display: inline-block; /* Para asegurar que el estilo se aplique correctamente */ + margin: 2px; /* Un pequeño margen alrededor del tag */ + width: 100px; /* Ancho fijo para el tag */ + text-align: center; /* Centrar el texto dentro del tag */ +} + +.tag-style-failure { + background-color: var(--bs-reddit); /* Un gris oscuro */ + color: white; /* Texto en color blanco para contraste */ + padding: 5px 10px; /* Espaciado interno para dar forma al tag */ + border-radius: 5px; /* Bordes redondeados para la apariencia de un tag */ + font-weight: normal; /* Peso de la fuente, ajusta según necesidad */ + display: inline-block; /* Para asegurar que el estilo se aplique correctamente */ + margin: 2px; /* Un pequeño margen alrededor del tag */ + width: 100px; /* Ancho fijo para el tag */ + text-align: center; /* Centrar el texto dentro del tag */ +} + +.tag-style-status { + background-color: var(--bs-purple); /* Un gris oscuro */ + color: white; /* Texto en color blanco para contraste */ + padding: 5px 10px; /* Espaciado interno para dar forma al tag */ + border-radius: 5px; /* Bordes redondeados para la apariencia de un tag */ + font-weight: normal; /* Peso de la fuente, ajusta según necesidad */ + display: inline-block; /* Para asegurar que el estilo se aplique correctamente */ + margin: 2px; /* Un pequeño margen alrededor del tag */ + width: 100px; /* Ancho fijo para el tag */ + text-align: center; /* Centrar el texto dentro del tag */ +} + +.tag-style-retry { + background-color: var(--bs-warning); /* Un gris oscuro */ + color: white; /* Texto en color blanco para contraste */ + padding: 5px 10px; /* Espaciado interno para dar forma al tag */ + border-radius: 5px; /* Bordes redondeados para la apariencia de un tag */ + font-weight: normal; /* Peso de la fuente, ajusta según necesidad */ + display: inline-block; /* Para asegurar que el estilo se aplique correctamente */ + margin: 2px; /* Un pequeño margen alrededor del tag */ + width: 100px; /* Ancho fijo para el tag */ + text-align: center; /* Centrar el texto dentro del tag */ +} + + + diff --git a/sld-dashboard/app/base/static/assets/js/pagination.js b/sld-dashboard/app/base/static/assets/js/pagination.js index 3e2b19ff..e81c2bc7 100644 --- a/sld-dashboard/app/base/static/assets/js/pagination.js +++ b/sld-dashboard/app/base/static/assets/js/pagination.js @@ -1,5 +1,5 @@ $(document).ready(function(){ - var rowsPerPage = 10; // Valor inicial + var rowsPerPage = 20; // Valor inicial var rows = $('#myTable tr'); var filteredRows = rows; // Inicialmente, todas las filas son el conjunto filtrado var pagesCount; diff --git a/sld-dashboard/app/base/static/assets/js/pyodide.js b/sld-dashboard/app/base/static/assets/js/pyodide.js new file mode 100644 index 00000000..15d21e73 --- /dev/null +++ b/sld-dashboard/app/base/static/assets/js/pyodide.js @@ -0,0 +1,17 @@ +window.languagePluginUrl = 'https://cdn.jsdelivr.net/pyodide/v0.18.1/full/'; +importScripts('https://cdn.jsdelivr.net/pyodide/v0.18.1/full/pyodide.js'); + +async function main() { + await loadPyodide(); +} +main(); + +async function runPython() { + let output = await pyodide.runPythonAsync(` + import numpy as np + x = np.array([1, 2, 3, 4, 5]) + y = np.sum(x) + y + `); + document.getElementById("pythonOutput").innerText = "Suma de array: " + output; +} \ No newline at end of file diff --git a/sld-dashboard/app/home/routes.py b/sld-dashboard/app/home/routes.py index 34ee5a93..37653ad8 100644 --- a/sld-dashboard/app/home/routes.py +++ b/sld-dashboard/app/home/routes.py @@ -3,6 +3,8 @@ import ast import json import time +from flask import jsonify, render_template, request, url_for, redirect, flash + import redis from app import login_manager @@ -40,6 +42,52 @@ def index(): "index.html", segment="index", external_api_dns=external_api_dns ) +@blueprint.route('/status/') +def status(task_id): + 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): + 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 @blueprint.route("/deploys-list", defaults={"limit": 0}) diff --git a/sld-dashboard/app/home/templates/activity-logs.html b/sld-dashboard/app/home/templates/activity-logs.html index dd159fea..94d23100 100644 --- a/sld-dashboard/app/home/templates/activity-logs.html +++ b/sld-dashboard/app/home/templates/activity-logs.html @@ -102,7 +102,7 @@

All Activity

{% endif %} {{ logs.id }} - {{ logs.username }} + {{ logs.username }} {{ logs.action }} {{ logs.squad}} {{ logs.created_at }} diff --git a/sld-dashboard/app/home/templates/deploy-plan.html b/sld-dashboard/app/home/templates/deploy-plan.html index 915cefd3..5062a961 100644 --- a/sld-dashboard/app/home/templates/deploy-plan.html +++ b/sld-dashboard/app/home/templates/deploy-plan.html @@ -58,7 +58,7 @@
{{key}}
{% endfor %} diff --git a/sld-dashboard/app/home/templates/deploys-list.html b/sld-dashboard/app/home/templates/deploys-list.html index ead9d178..a621f5d0 100644 --- a/sld-dashboard/app/home/templates/deploys-list.html +++ b/sld-dashboard/app/home/templates/deploys-list.html @@ -5,6 +5,7 @@ {% block stylesheets %}{% endblock stylesheets %} + {% block content %}
@@ -95,8 +96,7 @@

All Deploys

Id - Deploy Name - Stack + Deploy Name| Stack | Branch Squad Environment Username @@ -112,43 +112,36 @@

All Deploys

{% for deploy in deploys %} - - - - - - + - {{ deploy.id }} +
{{ deploy.id }}
- {{ deploy.name }} + +
{{ deploy.name }}
+
stack: {{ deploy.stack_name }}
+
branch: {{deploy.stack_branch }}
+
+ + copy: + + + | tfvars: + +
+
- - - {{ deploy.stack_name }} - - - {{ deploy.squad}} - {{ deploy.environment}} + {{ deploy.squad}} + {{ deploy.environment}} {{ deploy.username}} {{ deploy.start_time }} {{ deploy.destroy_time }} - {{ deploy.action}} - {% set status = task_status(deploy.task_id, token).result %} - {% if status == "SUCCESS" %} - {{ status }} - {% elif status == "ERROR" or (status == "FAILURE") %} - {{ status }} - {% elif status == "RETRY" %} - {{ status }} - {% else %} - {{ status }} - {% endif %} + {{ deploy.action}} + +
@@ -165,6 +158,8 @@

All Deploys

Edit Approve + + Plan delete @@ -191,11 +186,12 @@

All Deploys

{% endif %} - - - - + + + + + + @@ -242,42 +238,22 @@
@@ -365,4 +339,101 @@

All Stacks

{% endif %} {{ stack.id }} - {{ stack.stack_name }} + {{ stack.stack_name }} {% if "yoda" in current_user.role or "darth_vader" in current_user.role %} {{ stack.git_repo }} {{ stack.branch }} - {{ stack.tf_version }} + {{ stack.tf_version }} {{ stack.squad_access }} {% endif %} {{ stack.description}} diff --git a/sld-dashboard/app/home/templates/tasks-logs.html b/sld-dashboard/app/home/templates/tasks-logs.html index 68e18839..3d62617d 100644 --- a/sld-dashboard/app/home/templates/tasks-logs.html +++ b/sld-dashboard/app/home/templates/tasks-logs.html @@ -93,12 +93,20 @@

All Tasks

{% else %} {% endif %} - {{ task.task_id }} + +
+ {{ task.task_id }} + + +
+ + {{ task.deploy_id }} - {{ task.action }} - {{ task.username }} + {{ task.action }} + {{ task.username }} {{ task.task_name }} - {{ task.squad}} + {{ task.squad}} {{ task.created_at }} @@ -145,4 +153,5 @@

All Tasks

{% block javascripts %} + {% endblock javascripts %} diff --git a/sld-dashboard/app/home/templates/users-list.html b/sld-dashboard/app/home/templates/users-list.html index b5d7d270..616f052c 100644 --- a/sld-dashboard/app/home/templates/users-list.html +++ b/sld-dashboard/app/home/templates/users-list.html @@ -92,12 +92,20 @@

All users

{% endif %} {{ user.id }} - {{ user.username }} + +
+ {{ user.username }} + + +
+
+ {{ user.fullname }} {{ user.email }} {{ user.squad }} {{ user.role }} - {{ user.is_active }} + {{ user.is_active }} {% if current_user.master %} {{ user.master }} {% endif %} @@ -140,4 +148,5 @@

All users

{% block javascripts %} + {% endblock javascripts %}