+
{% set stdout = task_log(deploy.task_id, token).result %}
{% if stdout is iterable and (stdout is not string and stdout is not mapping) %}
{%for i in stdout %}
@@ -257,7 +257,7 @@
Output Deploy
{% elif stripped_line.startswith('~') %}
{{ i }}
{% else %}
-
{{i}}
+
{{i}}
{% endif %}
{% endfor %}
{% else %}
From 62b70367d0ae8af1c508d19cfef5ba1b7381501f Mon Sep 17 00:00:00 2001
From: d10s <79284025+D10S0VSkY-OSS@users.noreply.github.com>
Date: Mon, 13 Nov 2023 01:46:34 +0100
Subject: [PATCH 2/4] =?UTF-8?q?=F0=9F=94=A7refactor:=20deploy=20orders?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sld-api-backend/src/deploy/infrastructure/repositories.py | 3 ++-
sld-dashboard/app/home/templates/deploys-list.html | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/sld-api-backend/src/deploy/infrastructure/repositories.py b/sld-api-backend/src/deploy/infrastructure/repositories.py
index 673d7070..c72ac30c 100644
--- a/sld-api-backend/src/deploy/infrastructure/repositories.py
+++ b/sld-api-backend/src/deploy/infrastructure/repositories.py
@@ -1,6 +1,7 @@
import datetime
from sqlalchemy.orm import Session
+from sqlalchemy import desc
import src.deploy.domain.entities.deploy as schemas_deploy
import src.deploy.infrastructure.models as models
@@ -176,7 +177,7 @@ def get_deploy_by_name_squad(
def get_all_deploys(db: Session, skip: int = 0, limit: int = 100):
try:
- return db.query(models.Deploy).offset(skip).limit(limit).all()
+ return db.query(models.Deploy).order_by(desc(models.Deploy.id)).offset(skip).limit(limit).all()
except Exception as err:
raise err
diff --git a/sld-dashboard/app/home/templates/deploys-list.html b/sld-dashboard/app/home/templates/deploys-list.html
index cef76639..7b60963e 100644
--- a/sld-dashboard/app/home/templates/deploys-list.html
+++ b/sld-dashboard/app/home/templates/deploys-list.html
@@ -109,7 +109,7 @@
All Deploys
- {% for deploy in deploys| sort(attribute='id') %}
+ {% for deploy in deploys %}
From 70a546689168e85744207fc509289bce03d85307 Mon Sep 17 00:00:00 2001
From: d10s <79284025+D10S0VSkY-OSS@users.noreply.github.com>
Date: Mon, 13 Nov 2023 02:56:43 +0100
Subject: [PATCH 3/4] =?UTF-8?q?=F0=9F=94=A7refactor:=20Add=20copy=20deploy?=
=?UTF-8?q?data?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../base/static/assets/js/copy_clipboard.js | 41 +++++++++++++++++++
.../app/home/templates/deploys-list.html | 6 ++-
2 files changed, 46 insertions(+), 1 deletion(-)
create mode 100644 sld-dashboard/app/base/static/assets/js/copy_clipboard.js
diff --git a/sld-dashboard/app/base/static/assets/js/copy_clipboard.js b/sld-dashboard/app/base/static/assets/js/copy_clipboard.js
new file mode 100644
index 00000000..8f943871
--- /dev/null
+++ b/sld-dashboard/app/base/static/assets/js/copy_clipboard.js
@@ -0,0 +1,41 @@
+function copyToClipboard(text) {
+ // Create a new textarea element and give it the text to be copied
+ const elem = document.createElement('textarea');
+ elem.value = text;
+ // Append it to the body
+ document.body.appendChild(elem);
+ // Select the text
+ elem.select();
+ // Execute the copy command
+ document.execCommand('copy');
+ // Remove the textarea element from the document
+ document.body.removeChild(elem);
+ // Show a message that the text was copied
+ showMessage('Copied to clipboard!');
+}
+
+function showMessage(message) {
+ // Create a message element
+ const messageElem = document.createElement('div');
+ messageElem.textContent = message;
+ // Style the message element
+ messageElem.style.position = 'fixed';
+ messageElem.style.bottom = '20px';
+ messageElem.style.left = '50%';
+ messageElem.style.transform = 'translateX(-50%)';
+ messageElem.style.backgroundColor = 'rgba(0, 0, 0, 0.5)';
+ messageElem.style.color = 'white';
+ messageElem.style.padding = '10px';
+ messageElem.style.borderRadius = '5px';
+ messageElem.style.zIndex = '1000';
+ messageElem.style.transition = 'opacity 0.5s';
+ // Append the message element to the body
+ document.body.appendChild(messageElem);
+ // Remove the message after some time
+ setTimeout(() => {
+ messageElem.style.opacity = '0';
+ setTimeout(() => {
+ document.body.removeChild(messageElem);
+ }, 500); // Wait for the fade out to finish before removing the element
+ }, 2000); // Show the message for 2 seconds
+}
diff --git a/sld-dashboard/app/home/templates/deploys-list.html b/sld-dashboard/app/home/templates/deploys-list.html
index 7b60963e..8437b503 100644
--- a/sld-dashboard/app/home/templates/deploys-list.html
+++ b/sld-dashboard/app/home/templates/deploys-list.html
@@ -110,9 +110,12 @@ All Deploys
|
{% for deploy in deploys %}
-
+
+
+
{{ deploy.id }}
@@ -356,4 +359,5 @@ Delete Deploy
{% block javascripts %}
+
{% endblock javascripts %}
From 12620970dacbe6f6faeb736f25124f559602e3ad Mon Sep 17 00:00:00 2001
From: d10s <79284025+D10S0VSkY-OSS@users.noreply.github.com>
Date: Mon, 13 Nov 2023 04:14:19 +0100
Subject: [PATCH 4/4] =?UTF-8?q?=F0=9F=94=A7refactor:=20Add=20download=20tf?=
=?UTF-8?q?vars?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../base/static/assets/js/download_tfvars.js | 35 +++++++++++++++++++
.../app/home/templates/deploys-list.html | 5 +++
2 files changed, 40 insertions(+)
create mode 100644 sld-dashboard/app/base/static/assets/js/download_tfvars.js
diff --git a/sld-dashboard/app/base/static/assets/js/download_tfvars.js b/sld-dashboard/app/base/static/assets/js/download_tfvars.js
new file mode 100644
index 00000000..0993603b
--- /dev/null
+++ b/sld-dashboard/app/base/static/assets/js/download_tfvars.js
@@ -0,0 +1,35 @@
+// script.js
+function downloadTFVars(element) {
+ // Retrieve the data-variables content, which is a string representation of a Python dictionary
+ var data = element.getAttribute('data-variables');
+
+ // Log the data for debugging
+ console.log('Data-variables content:', data);
+
+ // Convert and format the string to a pretty-printed JSON string
+ try {
+ var jsonString = data
+ .replace(/'/g, '"') // Replace single quotes with double quotes
+ .replace(/False/g, 'false') // Replace Python's False with JavaScript's false
+ .replace(/True/g, 'true') // Replace Python's True with JavaScript's true
+ .replace(/None/g, 'null'); // Replace Python's None with JavaScript's null
+
+ // Parse and re-stringify with indentation for pretty-printing
+ var formattedJsonString = JSON.stringify(JSON.parse(jsonString), null, 2);
+
+ // Download the formatted JSON string as a blob
+ var blob = new Blob([formattedJsonString], { type: 'application/json' });
+ var url = URL.createObjectURL(blob);
+
+ // Create a link, trigger a download, and clean up
+ var a = document.createElement('a');
+ a.download = 'terraform.tfvars.json';
+ a.href = url;
+ document.body.appendChild(a);
+ a.click();
+ URL.revokeObjectURL(url);
+ document.body.removeChild(a);
+ } catch (error) {
+ console.error('Error converting dictionary string to JSON:', error);
+ }
+}
diff --git a/sld-dashboard/app/home/templates/deploys-list.html b/sld-dashboard/app/home/templates/deploys-list.html
index 8437b503..ead9d178 100644
--- a/sld-dashboard/app/home/templates/deploys-list.html
+++ b/sld-dashboard/app/home/templates/deploys-list.html
@@ -115,10 +115,14 @@ All Deploys
+
+
+
{{ deploy.id }}
+
|
{{ deploy.name }}
@@ -360,4 +364,5 @@ Delete Deploy
{% block javascripts %}
+
{% endblock javascripts %}
|