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

Feature/stacks cards #222

Merged
merged 14 commits into from
Dec 26, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion play-with-sld/kubernetes/k8s/sld-api-backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
subdomain: primary
containers:
- name: api-backend
image: d10s0vsky/sld-api:v3.3.1
image: d10s0vsky/sld-api:v3.4.0
imagePullPolicy: Always
command: ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000", "--workers", "1"]
ports:
Expand Down
2 changes: 1 addition & 1 deletion play-with-sld/kubernetes/k8s/sld-dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
subdomain: primary
containers:
- name: sld-dashboard
image: d10s0vsky/sld-dashboard:v3.3.1
image: d10s0vsky/sld-dashboard:v3.4.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"
Expand Down
2 changes: 1 addition & 1 deletion play-with-sld/kubernetes/k8s/sld-worker-default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
subdomain: primary
containers:
- name: stack-deploy-worker-default
image: d10s0vsky/sld-api:v3.3.1
image: d10s0vsky/sld-api:v3.4.0
imagePullPolicy: Always
env:
- name: TF_WARN_OUTPUT_ERRORS
Expand Down
2 changes: 1 addition & 1 deletion play-with-sld/kubernetes/k8s/sld-worker-squad1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
subdomain: primary
containers:
- name: stack-deploy-worker-squad1
image: d10s0vsky/sld-api:v3.3.1
image: d10s0vsky/sld-api:v3.4.0
imagePullPolicy: Always
env:
- name: TF_WARN_OUTPUT_ERRORS
Expand Down
2 changes: 1 addition & 1 deletion play-with-sld/kubernetes/k8s/sld-worker-squad2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
subdomain: primary
containers:
- name: stack-deploy-worker-squad2
image: d10s0vsky/sld-api:v3.3.1
image: d10s0vsky/sld-api:v3.4.0
imagePullPolicy: Always
env:
- name: TF_WARN_OUTPUT_ERRORS
Expand Down
2 changes: 1 addition & 1 deletion sld-api-backend/src/stacks/domain/entities/stacks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import List, Optional, Literal, Dict
from typing import List, Optional, Literal

from pydantic import BaseModel, Field, constr
from datetime import datetime
Expand Down
25 changes: 8 additions & 17 deletions sld-api-backend/src/stacks/infrastructure/repositories.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,23 +68,14 @@ def update_stack(
db_stack.tags = stack.tags
db_stack.icon_path = stack.icon_path
db_stack.updated_at = datetime.datetime.now()
check_None = ["string", ""]
if db_stack.stack_name not in check_None:
db_stack.stack_name = stack.stack_name
if db_stack.git_repo not in check_None:
db_stack.git_repo = stack.git_repo
if db_stack.branch not in check_None:
db_stack.branch = stack.branch
if db_stack.iac_type not in check_None:
db_stack.iac_type = stack.iac_type
if db_stack.tf_version not in check_None:
db_stack.tf_version = stack.tf_version
if db_stack.project_path not in check_None:
db_stack.project_path = stack.project_path
if db_stack.description not in check_None:
db_stack.description = stack.description
if db_stack.squad_access not in check_None:
db_stack.squad_access = squad_access
db_stack.stack_name = stack.stack_name
db_stack.git_repo = stack.git_repo
db_stack.branch = stack.branch
db_stack.iac_type = stack.iac_type
db_stack.tf_version = stack.tf_version
db_stack.project_path = stack.project_path
db_stack.description = stack.description
db_stack.squad_access = squad_access
try:
db.add(db_stack)
db.commit()
Expand Down
76 changes: 76 additions & 0 deletions sld-dashboard/app/base/static/assets/css/readme.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
table {
border-collapse: collapse;
width: 100%;
}
th, td {
border: 1px solid #020116;
padding: 8px;
text-align: left;
}
th {
background-color: #f2f2f2;
}


td {
word-wrap: break-word;
max-width: 300px; /* ajusta esto según tus necesidades */
}


h1, h2, h3, h4, h5, h6 {
color: #333;
margin-top: 20px;
}
p {
line-height: 1.6;
}

a {
color: #007bff;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}

@media screen and (max-width: 600px) {
table {
width: 100%;
}
td {
max-width: 100px; /* ajusta para dispositivos móviles */
}
}

img {
max-width: 150%;
height: auto;
}



/* offcanvas.css */
.offcanvas-header {
background-color: #007bff;
color: white;
}

.offcanvas-body {
padding: 15px;
background-color: #f8f9fa;
}

/* Style for the button that will toggle the offcanvas */
.offcanvas-toggle-btn {
background-color: #007bff;
color: white;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
}

.offcanvas-toggle-btn:hover {
background-color: #0056b3;
}
58 changes: 58 additions & 0 deletions sld-dashboard/app/base/static/assets/css/volt.css
Original file line number Diff line number Diff line change
Expand Up @@ -41866,3 +41866,61 @@ pre {
background-size: contain;
background-repeat: no-repeat;
}

.card-row {
display: flex;
justify-content: center;
flex-wrap: wrap;
align-items: center;
padding-top: 20px;
}

.card-header {
display: flex;
align-items: center;
gap: 10px;
}

.card-header img {
display: flex;

}

.card-header .title {
display: flex;

}

.card-columns {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 5px;
}

/*.card-columns::before {
content: "";
width: calc(100% - (100% / 4));
}
*/

.icon-with-text {
display: flex; /* Establece el contenedor como un flexbox */
align-items: flex-end; /* Alinea verticalmente los elementos al centro */
gap: 35px; /* Ajusta el espacio entre la imagen y el texto */
}

.icon-with-text img {
margin-right: 35px; /* Añade espacio a la derecha de la imagen */
display: flex;
justify-content: flex-end;
}

.icon-with-text span {
display: block; /* Hace que el span se comporte como un bloque */
line-height: 1; /* Ajusta la altura de línea si es necesario */
}

.gradient-background {
background: linear-gradient(to right, #ff6e7f, #bfe9ff); /* De izquierda a derecha */
}
23 changes: 23 additions & 0 deletions sld-dashboard/app/base/static/assets/js/selector_stacks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
document.addEventListener('DOMContentLoaded', function() {
let preferredView = localStorage.getItem('preferredView');

// Asegúrate de que estas rutas coincidan exactamente con la ubicación de tus archivos HTML
const cardsPath = '/stacks-cards';
const tablePath = '/stacks-list';

if (preferredView === 'table' && !window.location.href.endsWith(tablePath)) {
window.location.href = tablePath;
} else if (preferredView === 'cards' && !window.location.href.endsWith(cardsPath)) {
window.location.href = cardsPath;
}
});


function changeView(view) {
localStorage.setItem('preferredView', view);
if (view === 'table') {
window.location.href = '/stacks-list';
} else {
window.location.href = '/stacks-cards';
}
}
21 changes: 21 additions & 0 deletions sld-dashboard/app/helpers/parsers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import urllib.parse


def fetch_url_readme(git_repo, branch='main'):
if not git_repo.endswith('.git'):
git_repo += '.git'

parsed_url = urllib.parse.urlparse(git_repo)

if parsed_url.netloc == 'github.com':
raw_url = f"https://raw.githubusercontent.com/{parsed_url.path[1:-4]}"
url_readme = f"{raw_url}/{branch}/README.md"
elif parsed_url.netloc == 'gitlab.com':
raw_url = f"https://gitlab.com/{parsed_url.path[1:-4]}"
url_readme = f"{raw_url}/-/raw/{branch}/README.md"
else:
print("Unsupported Git repository platform.")
return None

print(f"Fetching {url_readme}...")
return url_readme
4 changes: 2 additions & 2 deletions sld-dashboard/app/home/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class StackForm(FlaskForm):
)
iac_type = SelectField(
"IaC Type",
choices=[('', 'Select an IaC Type'), ('terraform', 'Terraform'), ('openTofu', 'openTofu'), ('terragrunt', 'TerraGrunt')],
choices=[('', 'Select an IaC Type'), ('terraform', 'Terraform'), ('tofu', 'openTofu'), ('terragrunt', 'TerraGrunt')],
validators=[validators.DataRequired()],
coerce=lambda x: 'tofu' if x == 'openTofu' else x
)
Expand All @@ -58,7 +58,7 @@ class StackForm(FlaskForm):
description = StringField(
"Description",
[
validators.length(min=1, max=50, message="Set short Description"),
validators.length(min=30, max=60, message="Set short Description"),
],
)
squad_access_edit = StringField(
Expand Down
Loading
Loading