From 441fba19e3d80fe504e87343d642922c1299f1c1 Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Mon, 22 Sep 2025 15:26:24 +0200 Subject: [PATCH 1/2] refs #2820. Fixed bug in assistants --- .../deploy-image/deploy-image.component.ts | 36 ++++--------------- .../partition-assistant.component.ts | 13 ++----- .../run-script-assistant.component.ts | 2 +- 3 files changed, 10 insertions(+), 41 deletions(-) diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.ts b/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.ts index 24f9d63..0396eae 100644 --- a/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.ts +++ b/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.ts @@ -131,9 +131,7 @@ export class DeployImageComponent implements OnInit{ }); this.clientId = this.clientData?.length ? this.clientData[0]['@id'] : null; this.clientData.forEach((client: { selected: boolean; status: string}) => { client.selected = true; }); - this.selectedClients = this.clientData.filter((client: { selected: boolean; status: string}) => client.selected); - this.selectedModelClient = this.clientData.find((client: { selected: boolean; status: string}) => client.selected) || null; if (this.selectedModelClient) { @@ -289,8 +287,7 @@ export class DeployImageComponent implements OnInit{ } save(): void { - // Función para ejecutar inmediatamente el despliegue de imagen - // Maneja tanto contextos de clientes individuales como unidades organizacionales (aulas, grupos, etc.) + if (!this.selectedClients.length) { this.toastService.error('Debe seleccionar al menos un cliente'); return; @@ -340,18 +337,10 @@ export class DeployImageComponent implements OnInit{ repositoryName: this.selectedGitRepository, branch: this.selectedBranch, hexsha: this.selectedCommit.hexsha, - queue: result + queue: result, + clients: this.selectedClients.map((client: any) => client.uuid), }; - // Determinar el ámbito correcto basado en runScriptContext - const isOrganizationalContext = this.runScriptContext?.type && - ['organizational-unit', 'classroom', 'classrooms-group', 'clients-group'].includes(this.runScriptContext.type); - - if (isOrganizationalContext) { - payload.organizationalUnit = this.runScriptContext['@id']; - } else { - payload.clients = this.selectedClients.map((client: any) => client.uuid); - } url = `${this.baseUrl}/git-repositories/deploy-image`; } else { payload = { @@ -367,18 +356,10 @@ export class DeployImageComponent implements OnInit{ maxTime: this.mcastMaxTime, maxClients: this.mcastMaxClients, type: this.imageType, - queue: result + queue: result, + clients: this.selectedClients.map((client: any) => client.uuid), }; - // Determinar el ámbito correcto basado en runScriptContext - const isOrganizationalContext = this.runScriptContext?.type && - ['organizational-unit', 'classroom', 'classrooms-group', 'clients-group'].includes(this.runScriptContext.type); - - if (isOrganizationalContext) { - payload.organizationalUnit = this.runScriptContext['@id']; - } else { - payload.clients = this.selectedClients.map((client: any) => client.uuid); - } url = `${this.baseUrl}/image-image-repositories/${this.selectedImage.uuid}/deploy-image`; } @@ -443,8 +424,6 @@ export class DeployImageComponent implements OnInit{ openScheduleModal(): void { - // Función para programar la ejecución del despliegue de imagen - // Maneja tanto contextos de clientes individuales como unidades organizacionales (aulas, grupos, etc.) let scope = this.runScriptContext?.type || 'clients'; let selectedClients = null; @@ -452,7 +431,6 @@ export class DeployImageComponent implements OnInit{ this.updateSelectedClients(); } - // Determinar si es un contexto organizacional const isOrganizationalContext = this.runScriptContext?.type && ['organizational-unit', 'classroom', 'classrooms-group', 'clients-group'].includes(this.runScriptContext.type); @@ -476,7 +454,6 @@ export class DeployImageComponent implements OnInit{ }); dialogRef.afterClosed().subscribe((result: { [x: string]: any; }) => { - console.log(result); if (result) { const basePayload: any = { method: this.selectedMethod, @@ -484,7 +461,8 @@ export class DeployImageComponent implements OnInit{ partitionNumber: this.selectedPartition.partitionNumber, imageName: this.selectedImage.name, imageUuid: this.selectedImage.uuid, - type: this.imageType + type: this.imageType, + clients: this.selectedClients.map((client: any) => client.uuid), }; if (this.selectedMethod === 'p2p' && this.p2pMode) { diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.ts b/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.ts index 82a6608..adcdc58 100644 --- a/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.ts +++ b/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.ts @@ -267,7 +267,6 @@ export class PartitionAssistantComponent implements OnInit, AfterViewInit, OnDes }); disksMap.forEach((disk, diskNumber) => { - console.log(this.selectedModelClient?.firmwareType); const isUEFI = this.selectedModelClient?.firmwareType === 'UEFI'; const hasNoPartitions = disk.partitions.length === 0; @@ -490,18 +489,10 @@ export class PartitionAssistantComponent implements OnInit, AfterViewInit, OnDes const bulkPayload: any = { partitions: newPartitions, - queue: result + queue: result, + clients: this.selectedClients.map((client: any) => client.uuid), }; - const isOrganizationalContext = this.runScriptContext?.type && - ['organizational-unit', 'classroom', 'classrooms-group', 'clients-group'].includes(this.runScriptContext.type); - - if (isOrganizationalContext) { - bulkPayload.organizationalUnit = this.runScriptContext['@id']; - } else { - bulkPayload.clients = this.selectedClients.map((client: any) => client.uuid); - } - this.http.post(this.apiUrl, bulkPayload).subscribe( (response) => { this.toastService.success('Particiones creadas exitosamente para el disco seleccionado.'); diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/run-script-assistant/run-script-assistant.component.ts b/ogWebconsole/src/app/components/groups/components/client-main-view/run-script-assistant/run-script-assistant.component.ts index 82c4de0..b844010 100644 --- a/ogWebconsole/src/app/components/groups/components/client-main-view/run-script-assistant/run-script-assistant.component.ts +++ b/ogWebconsole/src/app/components/groups/components/client-main-view/run-script-assistant/run-script-assistant.component.ts @@ -195,7 +195,7 @@ export class RunScriptAssistantComponent implements OnInit{ }); dialogRef.afterClosed().subscribe(result => { - if (result) { + if (result !== undefined) { this.loading = true; this.http.post(`${this.baseUrl}/commands/run-script`, { clients: this.selectedClients.map((client: any) => client.uuid), From b0b1fc929af5c63c2f433858d75098638f41b45b Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Mon, 22 Sep 2025 15:27:29 +0200 Subject: [PATCH 2/2] updated changelog --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 96cc9b7..e29efc6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,9 @@ # Changelog +## [0.23.4] - 2025-09-22 +### Fixed +- Se ha arreglado en error a la hora de mandar el ambito de ejecucion en lso asistentes + +--- ## [0.23.3] - 2025-09-10 ### Improved - Se han realizado mejoras sobre la funcionalidad de tareas programadas.