Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/deploy table #181

Merged
merged 4 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 67 additions & 2 deletions sld-dashboard/app/base/static/assets/css/volt.css
Original file line number Diff line number Diff line change
Expand Up @@ -41746,6 +41746,71 @@ pre {
position: relative;
flex: 1 1 auto;
padding: 1rem;
background-color: #040720;
background-color: #333;
color: #fff;
}
}

.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 */
}



2 changes: 1 addition & 1 deletion sld-dashboard/app/base/static/assets/js/pagination.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
17 changes: 17 additions & 0 deletions sld-dashboard/app/base/static/assets/js/pyodide.js
Original file line number Diff line number Diff line change
@@ -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;
}
34 changes: 34 additions & 0 deletions sld-dashboard/app/home/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -40,6 +42,38 @@
"index.html", segment="index", external_api_dns=external_api_dns
)

@blueprint.route('/status/<task_id>')
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)

Check warning

Code scanning / CodeQL

Information exposure through an exception Medium

Stack trace information
flows to this location and may be exposed to an external user.
else:
return jsonify({"status": "Error"}), response.status_code


@blueprint.route('/output/<task_id>')
@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

Check warning

Code scanning / CodeQL

Reflected server-side cross-site scripting Medium

Cross-site scripting vulnerability due to a
user-provided value
.

Check warning

Code scanning / CodeQL

Information exposure through an exception Medium

Stack trace information
flows to this location and may be exposed to an external user.


# Start Deploy
@blueprint.route("/deploys-list", defaults={"limit": 0})
Expand Down
2 changes: 1 addition & 1 deletion sld-dashboard/app/home/templates/activity-logs.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ <h2 class="h4">All Activity</h2>
<td><span class="icon icon-sm"><span class="fas fa-box-open"></span></span></td>
{% endif %}
<td><span class="font-weight-normal">{{ logs.id }}</span></td>
<td><span class="font-weight-normal">{{ logs.username }}</span></td>
<td><span class="tag-style">{{ logs.username }}</span></td>
<td><span class="font-weight-normal">{{ logs.action }}</span></td>
<td><span class="font-weight-normal">{{ logs.squad}}</span></td>
<td><span class="font-weight-bold">{{ logs.created_at }}</span></td>
Expand Down
2 changes: 1 addition & 1 deletion sld-dashboard/app/home/templates/deploy-plan.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ <h6><strong>{{key}}</strong></h6>
{% endfor %}
<button type="submit" class="btn btn-primary" name="button"
action="{{url_for('.plan')}}">
Deploydddd
Deploy
</button>

</form>
Expand Down
Loading
Loading