Skip to content

Commit

Permalink
Merge pull request #214 from D10S0VSkY-OSS/feature/icons
Browse files Browse the repository at this point in the history
Feature/icons
  • Loading branch information
D10S0VSkY-OSS authored Dec 9, 2023
2 parents 9a2a4ab + c335266 commit c9f547c
Show file tree
Hide file tree
Showing 1,188 changed files with 21,784 additions and 169 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/sld-api-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ jobs:
- name: Build the Docker image with tag
working-directory: ./sld-api-backend
run: docker build . --file Dockerfile --tag ${{ secrets.DOCKER_USERNAME }}/sld-api:3.1.0
run: docker build . --file Dockerfile --tag ${{ secrets.DOCKER_USERNAME }}/sld-api:3.2.0

- name: Docker Push with tag
#if: github.event.pull_request.merged == true
run: docker push ${{ secrets.DOCKER_USERNAME }}/sld-api:3.1.0
run: docker push ${{ secrets.DOCKER_USERNAME }}/sld-api:3.2.0

- name: Build the Docker image
working-directory: ./sld-api-backend
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/sld-dashboard-docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:3.1.0
run: docker build . --file Dockerfile --tag ${{ secrets.DOCKER_USERNAME }}/sld-dashboard:3.2.0

- name: Docker Push with tags
#if: github.event.pull_request.merged == true
run: docker push ${{ secrets.DOCKER_USERNAME }}/sld-dashboard:3.1.0
run: docker push ${{ secrets.DOCKER_USERNAME }}/sld-dashboard:3.2.0
- name: Build the Docker image
working-directory: ./sld-dashboard
run: docker build . --file Dockerfile --tag ${{ secrets.DOCKER_USERNAME }}/sld-dashboard:latest
Expand Down
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:3.1.0
image: d10s0vsky/sld-api:3.2.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:3.1.0
image: d10s0vsky/sld-dashboard:3.2.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:3.1.0
image: d10s0vsky/sld-api:3.2.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:3.1.0
image: d10s0vsky/sld-api:3.2.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:3.1.0
image: d10s0vsky/sld-api:3.2.0
imagePullPolicy: Always
env:
- name: TF_WARN_OUTPUT_ERRORS
Expand Down
1 change: 1 addition & 0 deletions sld-api-backend/src/deploy/domain/entities/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ class DeployFilterResponse(BaseModel):
environment: str
tfvar_file: Optional[str]
project_path: Optional[str]
icon_path: Optional[str]


1 change: 1 addition & 0 deletions sld-api-backend/src/deploy/infrastructure/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class Deploy(Base):
username = Column(String(50), nullable=False)
squad = Column(String(50), nullable=False)
variables = Column(JSON)
tags = Column(JSON)
environment = Column(String(50))
tfvar_file = Column(String(50))
project_path = Column(String(500))
Expand Down
30 changes: 15 additions & 15 deletions sld-api-backend/src/deploy/infrastructure/repositories.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from src.deploy.domain.entities.repository import DeployFilter, DeployFilterResponse
from src.deploy.domain.entities.metrics import ActionCount, EnvironmentCount, MonthlyDeployCount, SquadDeployCount, StackUsage, UserActivity, CloudProviderUsage, SquadEnvironmentUsage
import src.deploy.infrastructure.models as models
from src.stacks.infrastructure.models import Stack


def create_new_deploy(
Expand Down Expand Up @@ -196,29 +197,28 @@ def get_all_deploys_by_squad(db: Session, squad: str, skip: int = 0, limit: int
raise err


def get_deploy_by_cloud_account(db: Session, squad: str, environment: str):
try:
return (
db.query(models.Deploy)
.filter(models.Deploy.environment == environment)
.filter(models.Deploy.squad == squad)
.first()
)
except Exception as err:
raise err

def get_deploys(db: Session, filters: DeployFilter, skip: int = 0, limit: int = 100) -> List[DeployFilterResponse]:
query = db.query(models.Deploy)

query = db.query(models.Deploy, Stack.icon_path).join(
Stack, models.Deploy.stack_name == Stack.stack_name
)
for field, value in filters.model_dump().items():
if value is not None:
if field == 'squad' and isinstance(value, list):
query = query.filter(getattr(models.Deploy, field).in_(value))
else:
query = query.filter(getattr(models.Deploy, field) == value)

deploys = query.order_by(desc(models.Deploy.id)).offset(skip).limit(limit).all()
return [DeployFilterResponse(**deploy.__dict__) for deploy in deploys]
results = query.order_by(desc(models.Deploy.id)).offset(skip).limit(limit).all()

# Crear una lista de DeployFilterResponse a partir de los resultados
deploy_responses = []
for deploy, icon_path in results:
deploy_dict = deploy.__dict__
deploy_dict['icon_path'] = icon_path # Agregar el icon_path al diccionario
deploy_responses.append(DeployFilterResponse(**deploy_dict))

return deploy_responses



class MetricsFetcher:
Expand Down
2 changes: 1 addition & 1 deletion sld-api-backend/src/shared/helpers/get_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@


def check_squad_user(squad_owner: list, squad_add: list) -> bool:
return all(item in squad_owner for item in squad_add)
return any(item in squad_owner for item in squad_add)


def check_role_user(role_owner: list, role_add: list) -> bool:
Expand Down
1 change: 1 addition & 0 deletions sld-api-backend/src/stacks/domain/entities/stacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class StackBase(BaseModel):
tags: Optional[List[str]] = []
project_path: Optional[constr(strip_whitespace=True)] = Field("", example="")
description: constr(strip_whitespace=True)
icon_path: Optional[constr(strip_whitespace=True)] = Field("", example="")

class Config:
freeze = True
Expand Down
1 change: 1 addition & 0 deletions sld-api-backend/src/stacks/infrastructure/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ class Stack(Base):
description = Column(Text())
user_id = Column(Integer)
username = Column(String(50))
icon_path = Column(String(255))
deploy = relationship("Deploy")
2 changes: 2 additions & 0 deletions sld-api-backend/src/stacks/infrastructure/repositories.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def create_new_stack(
tf_version=stack.tf_version,
project_path=stack.project_path,
description=stack.description,
icon_path=stack.icon_path,
branch=stack.branch,
user_id=user_id,
username=username,
Expand Down Expand Up @@ -65,6 +66,7 @@ def update_stack(
db_stack.var_json = var_json
db_stack.var_list = var_list
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:
Expand Down
6 changes: 6 additions & 0 deletions sld-dashboard/app/base/static/assets/css/volt.css
Original file line number Diff line number Diff line change
Expand Up @@ -41851,3 +41851,9 @@ pre {
margin-right: 5px;
}

.limit_words {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
width: 150px; /* Ajusta esto según el ancho deseado del contenedor */
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit c9f547c

Please sign in to comment.