diff --git a/CHANGELOG.md b/CHANGELOG.md index b4e7635..f29af71 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,13 @@ # Changelog +## [0.20.0] - 2025-08-25 +### Added +- Se ha añadido un nuevo boton en "Trazas" para marcar la misma como completada cuando se requiera. +- Nuevo estado "ocupado" en las trazas para indicar que el cliente envia un "409" y que ya esta ejecutando una accion + +### Improved +- Mejorada la interfaz para gestionar las tareas. + +--- ## [0.19.0] - 2025-08-06 ### Added - Se ha añadido un nuevo estado "enviado" para cuando se ejecuten acciones a equipos en estado Windows o Linux diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/create-image/create-image.component.css b/ogWebconsole/src/app/components/groups/components/client-main-view/create-image/create-image.component.css index a1ed15d..cf41b39 100644 --- a/ogWebconsole/src/app/components/groups/components/client-main-view/create-image/create-image.component.css +++ b/ogWebconsole/src/app/components/groups/components/client-main-view/create-image/create-image.component.css @@ -129,8 +129,9 @@ .button-row { display: flex; + padding-right: 1em; gap: 12px; - padding-right: 0; + align-items: center; } /* Tabla de particiones modernizada */ diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/create-image/create-image.component.html b/ogWebconsole/src/app/components/groups/components/client-main-view/create-image/create-image.component.html index 70eedfe..c19f0d8 100644 --- a/ogWebconsole/src/app/components/groups/components/client-main-view/create-image/create-image.component.html +++ b/ogWebconsole/src/app/components/groups/components/client-main-view/create-image/create-image.component.html @@ -23,6 +23,13 @@
+
+ +
diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/create-image/create-image.component.ts b/ogWebconsole/src/app/components/groups/components/client-main-view/create-image/create-image.component.ts index 88a8f57..70e6b27 100644 --- a/ogWebconsole/src/app/components/groups/components/client-main-view/create-image/create-image.component.ts +++ b/ogWebconsole/src/app/components/groups/components/client-main-view/create-image/create-image.component.ts @@ -9,6 +9,7 @@ import {MatDialog} from "@angular/material/dialog"; import {QueueConfirmationModalComponent} from "../../../../../shared/queue-confirmation-modal/queue-confirmation-modal.component"; import {CreateRepositoryModalComponent} from "./create-repository-modal/create-repository-modal.component"; import {CreateBranchModalComponent} from "../../../../repositories/show-git-images/create-branch-modal/create-branch-modal.component"; +import {CreateTaskComponent} from "../../../../commands/commands-task/create-task/create-task.component"; @Component({ selector: 'app-create-image', @@ -108,7 +109,6 @@ export class CreateClientImageComponent implements OnInit{ } ngOnInit() { - console.log('CreateImageComponent ngOnInit ejecutado'); this.clientId = this.route.snapshot.paramMap.get('id'); this.loadPartitions(); this.loadImages(); @@ -612,8 +612,102 @@ export class CreateClientImageComponent implements OnInit{ this.isDestinationBranchEditable = !this.isDestinationBranchEditable; if (!this.isDestinationBranchEditable) { - // Opcional: Aquí se pueden agregar validaciones adicionales console.log('Rama destino guardada:', this.destinationBranch); } } + + isFormValid(): boolean { + if (!this.selectedPartition) { + return false; + } + + if (this.imageType === 'monolithic') { + if (this.monolithicAction === 'create') { + return this.name !== null && this.name.trim().length > 0; + } else if (this.monolithicAction === 'update') { + return this.selectedImage !== null; + } + } else if (this.imageType === 'git') { + if (this.hasValidGitData) { + return this.destinationBranch !== null && this.destinationBranch.trim().length > 0; + } else { + return this.selectedGitRepository !== null; + } + } + + return false; + } + + openScheduleModal(): void { + let scope = 'clients'; + + // Verificar que tenemos la información del cliente + if (!this.client) { + this.toastService.error('No se ha cargado la información del cliente'); + return; + } + + // Crear un array con el objeto cliente completo + let selectedClients = [this.client]; + console.log(selectedClients); + + const dialogRef = this.dialog.open(CreateTaskComponent, { + width: '800px', + data: { + scope: scope, + selectedClients: selectedClients, + organizationalUnit: this.client['@id'], + source: 'create-image', + runScriptContext: null + } + }); + + dialogRef.afterClosed().subscribe((result: any) => { + if (result) { + // Verificar que tenemos la partición seleccionada + if (!this.selectedPartition) { + this.toastService.error('Debe seleccionar una partición'); + return; + } + + let payload: any = {}; + + if (this.imageType === 'monolithic') { + payload = { + type: 'monolithic', + action: this.monolithicAction, + diskNumber: this.selectedPartition.diskNumber, + partitionNumber: this.selectedPartition.partitionNumber, + imageName: this.monolithicAction === 'create' ? this.name : this.selectedImage?.name + }; + } else if (this.imageType === 'git') { + payload = { + type: 'git', + diskNumber: this.selectedPartition.diskNumber, + partitionNumber: this.selectedPartition.partitionNumber, + repository: this.selectedGitRepository?.name || this.gitData?.repo, + sourceBranch: this.gitData?.branch, + destinationBranch: this.destinationBranch + }; + } + + const taskId = result['taskId'] ? result['taskId']['@id'] : result['@id']; + const executionOrder = result['executionOrder'] || 1; + + this.http.post(`${this.baseUrl}/command-task-scripts`, { + commandTask: taskId, + parameters: payload, + order: executionOrder, + type: 'create-image', + }).subscribe({ + next: () => { + this.toastService.success('Tarea de creación de imagen programada con éxito'); + }, + error: (error) => { + this.toastService.error(error.error['hydra:description'] || 'Error al programar la tarea'); + } + }); + } + }); + } }