From b4ba0b124492fbdf7f42c94ec3931695fde0c0b6 Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Mon, 9 Jun 2025 12:05:35 +0200 Subject: [PATCH] refs #2182. Changed Output messages --- ogWebconsole/src/app/app.module.ts | 4 +- .../execute-command.component.ts | 70 ++++++++++- .../software-profile-partition.component.css | 117 ++++++++++++++++++ .../software-profile-partition.component.html | 55 ++++++++ ...ftware-profile-partition.component.spec.ts | 23 ++++ .../software-profile-partition.component.ts | 107 ++++++++++++++++ .../global-status/global-status.component.ts | 10 +- .../deploy-image/deploy-image.component.css | 21 ++++ .../deploy-image/deploy-image.component.html | 20 +++ .../deploy-image/deploy-image.component.ts | 38 ++++++ .../partition-assistant.component.css | 7 ++ .../partition-assistant.component.html | 18 ++- .../partition-assistant.component.ts | 2 + .../components/groups/groups.component.html | 6 +- .../app/components/groups/groups.component.ts | 10 +- .../classroom-view.component.ts | 3 +- .../ogboot-status/ogboot-status.component.ts | 3 +- .../create-image/create-image.component.ts | 4 +- .../pxe-images/pxe-images.component.html | 2 +- .../ogboot/pxe-images/pxe-images.component.ts | 7 +- .../components/ogboot/pxe/pxe.component.ts | 2 - .../ogdhcp/og-dhcp-subnets.component.html | 2 - .../ogdhcp/og-dhcp-subnets.component.ts | 3 + .../convert-image-to-virtual.component.css | 5 + .../convert-image-to-virtual.component.html | 3 +- .../convert-image-to-virtual.component.ts | 14 ++- .../convert-image/convert-image.component.css | 6 + .../convert-image.component.html | 8 +- .../convert-image/convert-image.component.ts | 15 +-- .../import-image/import-image.component.css | 9 +- .../import-image/import-image.component.html | 3 +- .../import-image/import-image.component.ts | 12 +- .../show-monolitic-images.component.css | 5 + .../show-monolitic-images.component.html | 8 +- .../show-monolitic-images.component.ts | 9 +- .../create-software-profile.component.html | 4 +- .../create-software-profile.component.ts | 2 +- .../software-profile.component.ts | 6 +- .../components/software/software.component.ts | 15 +-- .../task-logs/task-logs.component.html | 19 ++- .../task-logs/task-logs.component.ts | 28 ++++- 41 files changed, 618 insertions(+), 87 deletions(-) create mode 100644 ogWebconsole/src/app/components/commands/main-commands/execute-command/software-profile-partition/software-profile-partition.component.css create mode 100644 ogWebconsole/src/app/components/commands/main-commands/execute-command/software-profile-partition/software-profile-partition.component.html create mode 100644 ogWebconsole/src/app/components/commands/main-commands/execute-command/software-profile-partition/software-profile-partition.component.spec.ts create mode 100644 ogWebconsole/src/app/components/commands/main-commands/execute-command/software-profile-partition/software-profile-partition.component.ts diff --git a/ogWebconsole/src/app/app.module.ts b/ogWebconsole/src/app/app.module.ts index ed2d3f9..a172a3c 100644 --- a/ogWebconsole/src/app/app.module.ts +++ b/ogWebconsole/src/app/app.module.ts @@ -153,6 +153,7 @@ import { ClientTaskLogsComponent } from './components/task-logs/client-task-logs import { BootSoPartitionComponent } from './components/commands/main-commands/execute-command/boot-so-partition/boot-so-partition.component'; import { RemoveCacheImageComponent } from './components/commands/main-commands/execute-command/remove-cache-image/remove-cache-image.component'; import { ChangeParentComponent } from './components/groups/shared/change-parent/change-parent.component'; +import { SoftwareProfilePartitionComponent } from './components/commands/main-commands/execute-command/software-profile-partition/software-profile-partition.component'; export function HttpLoaderFactory(http: HttpClient) { return new TranslateHttpLoader(http, './locale/', '.json'); @@ -263,7 +264,8 @@ registerLocaleData(localeEs, 'es-ES'); ClientTaskLogsComponent, BootSoPartitionComponent, RemoveCacheImageComponent, - ChangeParentComponent + ChangeParentComponent, + SoftwareProfilePartitionComponent ], bootstrap: [AppComponent], imports: [BrowserModule, diff --git a/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.ts b/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.ts index 0efcd55..0912afc 100644 --- a/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.ts +++ b/ogWebconsole/src/app/components/commands/main-commands/execute-command/execute-command.component.ts @@ -7,6 +7,7 @@ import { BootSoPartitionComponent } from "./boot-so-partition/boot-so-partition. import { MatDialog } from "@angular/material/dialog"; import { RemoveCacheImageComponent } from "./remove-cache-image/remove-cache-image.component"; import { AuthService } from '@services/auth.service'; +import {SoftwareProfilePartitionComponent} from "./software-profile-partition/software-profile-partition.component"; @Component({ selector: 'app-execute-command', @@ -33,7 +34,7 @@ export class ExecuteCommandComponent implements OnInit { { translationKey: 'executeCommands.deployImage', slug: 'deploy-image', disabled: false }, { translationKey: 'executeCommands.deleteImageCache', slug: 'remove-cache-image', disabled: false }, { translationKey: 'executeCommands.partition', slug: 'partition', disabled: false }, - { translationKey: 'executeCommands.softwareInventory', slug: 'software-inventory', disabled: true }, + { translationKey: 'executeCommands.softwareInventory', slug: 'software-inventory', disabled: false }, { translationKey: 'executeCommands.hardwareInventory', slug: 'hardware-inventory', disabled: true }, { translationKey: 'executeCommands.runScript', slug: 'run-script', disabled: false }, ]; @@ -111,10 +112,10 @@ export class ExecuteCommandComponent implements OnInit { if (states[0] === 'off' || states[0] === 'disconnected') { command.disabled = command.slug !== 'power-on'; } else { - command.disabled = !['power-off', 'reboot', 'login', 'create-image', 'deploy-image', 'remove-cache-image', 'partition', 'run-script'].includes(command.slug); + command.disabled = !['power-off', 'reboot', 'login', 'create-image', 'deploy-image', 'remove-cache-image', 'partition', 'run-script', 'software-inventory'].includes(command.slug); } } else { - if (command.slug === 'create-image') { + if (command.slug === 'create-image'|| command.slug === 'software-inventory') { command.disabled = multipleClients; } else if ( ['power-on', 'power-off', 'reboot', 'login', 'deploy-image', 'partition', 'remove-cache-image', 'run-script'].includes(command.slug) @@ -164,6 +165,14 @@ export class ExecuteCommandComponent implements OnInit { if (action === 'remove-cache-image') { this.removeImageCache(); } + + if (action === 'hardware-inventory') { + this.hardwareInventory(); + } + + if (action === 'software-inventory') { + this.softwareInventory(); + } } rebootClient(): void { @@ -174,7 +183,7 @@ export class ExecuteCommandComponent implements OnInit { this.toastService.success('Cliente actualizado correctamente'); }, error => { - this.toastService.error('Error de conexión con el cliente'); + this.toastService.error(error.error['hydra:description'] || 'Error de conexión con el cliente'); } ); } @@ -227,6 +236,55 @@ export class ExecuteCommandComponent implements OnInit { }); } + hardwareInventory(): void { + if (this.clientData.length === 0) { + this.toastService.error('No hay clientes seleccionados'); + return; + } + + const clientId = this.clientData[0].uuid; + + this.http.post(`${this.baseUrl}/clients/server/${clientId}/hardware-inventory`, { + clients: this.clientData.map((client: any) => client['@id']) + }).subscribe( + response => { + this.toastService.success('Inventario de hardware actualizado correctamente'); + }, + error => { + this.toastService.error(error.error['hydra:description'] || 'Error de conexión con el cliente'); + } + ); + } + + softwareInventory(): void { + if (this.clientData.length === 0) { + this.toastService.error('No hay clientes seleccionados'); + return; + } + + const clientDataToSend = { + clientId: this.clientData[0].uuid, + name: this.clientData[0].name, + mac: this.clientData[0].mac, + status: this.clientData[0].status, + partitions: this.clientData[0].partitions, + firmwareType: this.clientData[0].firmwareType, + ip: this.clientData[0].ip + } + + const clientId = this.clientData[0].uuid; + + const dialogRef = this.dialog.open(SoftwareProfilePartitionComponent, { + width: '70vw', + height: 'auto', + data: { client: clientDataToSend } + }); + + dialogRef.afterClosed().subscribe(result => { + + }); + } + powerOnClient(): void { this.http.post(`${this.baseUrl}/image-repositories/wol`, { clients: this.clientData.map((client: any) => client['@id']) @@ -235,7 +293,7 @@ export class ExecuteCommandComponent implements OnInit { this.toastService.success('Petición de encendido enviada correctamente'); }, error => { - this.toastService.error('Error de conexión con el cliente'); + this.toastService.error(error.error['hydra:description'] || 'Error de conexión con el cliente'); } ); } @@ -248,7 +306,7 @@ export class ExecuteCommandComponent implements OnInit { this.toastService.success('Petición de apagado enviada correctamente'); }, error => { - this.toastService.error('Error de conexión con el cliente'); + this.toastService.error(error.error['hydra:description'] || 'Error de conexión con el cliente'); } ); } diff --git a/ogWebconsole/src/app/components/commands/main-commands/execute-command/software-profile-partition/software-profile-partition.component.css b/ogWebconsole/src/app/components/commands/main-commands/execute-command/software-profile-partition/software-profile-partition.component.css new file mode 100644 index 0000000..9f58e44 --- /dev/null +++ b/ogWebconsole/src/app/components/commands/main-commands/execute-command/software-profile-partition/software-profile-partition.component.css @@ -0,0 +1,117 @@ +.dialog-content { + display: flex; + flex-direction: column; + padding: 40px; +} + +.action-container { + display: flex; + justify-content: flex-end; + gap: 1em; + padding: 1.5em; +} + +.select-container { + margin-top: 20px; + align-items: center; + padding: 20px; + box-sizing: border-box; +} + +.clients-grid { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); + gap: 8px; +} + +.client-card { + background: #ffffff; + border-radius: 6px; + box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); + overflow: hidden; + position: relative; + padding: 8px; + text-align: center; + cursor: pointer; + transition: background-color 0.3s, transform 0.2s; + + &:hover { + background-color: #f0f0f0; + transform: scale(1.02); + } +} + +.button-row { + display: flex; + padding-right: 1em; +} + +.action-button { + margin-top: 10px; + margin-bottom: 10px; +} + +.client-item { + position: relative; +} + +.mat-expansion-panel-header-description { + justify-content: space-between; + align-items: center; +} + +.selected-client { + background-color: #a0c2e5 !important; + color: white !important; +} + +.loading-spinner { + display: block; + margin: 0 auto; + align-items: center; + justify-content: center; +} + +.client-details { + margin-top: 4px; +} + +.client-name { + font-size: 0.9em; + font-weight: 600; + color: #333; + margin-bottom: 5px; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + max-width: 150px; + display: inline-block; +} + +.client-ip { + display: block; + font-size: 0.9em; + color: #666; +} + + +.mat-elevation-z8 { + box-shadow: 0px 0px 0px rgba(0,0,0,0.2); +} + +@media (max-width: 600px) { + .form-field { + width: 100%; + } + + .dialog-actions { + flex-direction: column; + align-items: stretch; + } + + button { + width: 100%; + margin-left: 0; + margin-bottom: 8px; + } +} diff --git a/ogWebconsole/src/app/components/commands/main-commands/execute-command/software-profile-partition/software-profile-partition.component.html b/ogWebconsole/src/app/components/commands/main-commands/execute-command/software-profile-partition/software-profile-partition.component.html new file mode 100644 index 0000000..3f7bf5c --- /dev/null +++ b/ogWebconsole/src/app/components/commands/main-commands/execute-command/software-profile-partition/software-profile-partition.component.html @@ -0,0 +1,55 @@ +

Seleccionar partición para inventariar

+ + + + + + +
+ + + + + + + + + + + + + +
Seleccionar imagen + + + + + {{ column.header }} + + {{ column.cell(image) }} + + + +
+ {{ image.size }} MB + {{ image.size / 1024 }} GB +
+
+ + +
+ {{ image.operativeSystem?.name }} + {{ image.image?.name}} +
+
+ +
+
+
+ +
+ + +
diff --git a/ogWebconsole/src/app/components/commands/main-commands/execute-command/software-profile-partition/software-profile-partition.component.spec.ts b/ogWebconsole/src/app/components/commands/main-commands/execute-command/software-profile-partition/software-profile-partition.component.spec.ts new file mode 100644 index 0000000..98afae3 --- /dev/null +++ b/ogWebconsole/src/app/components/commands/main-commands/execute-command/software-profile-partition/software-profile-partition.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { SoftwareProfilePartitionComponent } from './software-profile-partition.component'; + +describe('SoftwareProfilePartitionComponent', () => { + let component: SoftwareProfilePartitionComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [SoftwareProfilePartitionComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(SoftwareProfilePartitionComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/ogWebconsole/src/app/components/commands/main-commands/execute-command/software-profile-partition/software-profile-partition.component.ts b/ogWebconsole/src/app/components/commands/main-commands/execute-command/software-profile-partition/software-profile-partition.component.ts new file mode 100644 index 0000000..5110f2a --- /dev/null +++ b/ogWebconsole/src/app/components/commands/main-commands/execute-command/software-profile-partition/software-profile-partition.component.ts @@ -0,0 +1,107 @@ +import {Component, Inject, OnInit} from '@angular/core'; +import {MatTableDataSource} from "@angular/material/table"; +import {MAT_DIALOG_DATA, MatDialogRef} from "@angular/material/dialog"; +import {ConfigService} from "@services/config.service"; +import {HttpClient} from "@angular/common/http"; +import {ToastrService} from "ngx-toastr"; + +@Component({ + selector: 'app-software-profile-partition', + templateUrl: './software-profile-partition.component.html', + styleUrl: './software-profile-partition.component.css' +}) +export class SoftwareProfilePartitionComponent implements OnInit{ + baseUrl: string; + selectedPartition: any = null; + dataSource = new MatTableDataSource(); + clientId: string | null = null; + selectedClients: any[] = []; + selectedModelClient: any = null; + filteredPartitions: any[] = []; + allSelected: boolean = false; + clientData: any[] = []; + loading: boolean = false; + columns = [ + { + columnDef: 'diskNumber', + header: 'Disco', + cell: (partition: any) => partition.diskNumber + }, + { + columnDef: 'partitionNumber', + header: 'Particion', + cell: (partition: any) => partition.partitionNumber + }, + { + columnDef: 'size', + header: 'Tamaño', + cell: (partition: any) => `${partition.size} MB` + }, + { + columnDef: 'partitionCode', + header: 'Tipo de partición', + cell: (partition: any) => partition.partitionCode + }, + { + columnDef: 'filesystem', + header: 'Sistema de ficheros', + cell: (partition: any) => partition.filesystem + }, + { + columnDef: 'operativeSystem', + header: 'SO', + cell: (partition: any) => partition.operativeSystem?.name + } + ]; + + displayedColumns = ['select', ...this.columns.map(column => column.columnDef)]; + + constructor( + @Inject(MAT_DIALOG_DATA) public data: { client: any }, + private dialogRef: MatDialogRef, + private configService: ConfigService, + private http: HttpClient, + private toastService: ToastrService, + ) { + this.baseUrl = this.configService.apiUrl; + this.clientId = this.data.client.clientId + } + + ngOnInit() { + this.loadPartitions(); + } + + loadPartitions() { + const url = `${this.baseUrl}/clients/${this.data.client.clientId}`; + this.http.get(url).subscribe( + (response: any) => { + if (response.partitions) { + this.dataSource.data = response.partitions; + } + }, + (error) => { + console.error('Error al cargar los datos del cliente:', error); + } + ); + } + + close() { + this.dialogRef.close(); + } + + execute(): void { + this.loading = true; + + this.http.post(`${this.baseUrl}/clients/server/${this.data.client.clientId}/software-inventory`, { + partition: this.selectedPartition['@id'], + }).subscribe( + response => { + this.toastService.success('Inventario de software actualizado correctamente'); + this.dialogRef.close(response); + }, + error => { + this.toastService.error(error.error['hydra:description'] || 'Error al actualizar el inventario de software'); + } + ); + } +} diff --git a/ogWebconsole/src/app/components/global-status/global-status.component.ts b/ogWebconsole/src/app/components/global-status/global-status.component.ts index 8115ba7..e55179e 100644 --- a/ogWebconsole/src/app/components/global-status/global-status.component.ts +++ b/ogWebconsole/src/app/components/global-status/global-status.component.ts @@ -69,7 +69,7 @@ export class GlobalStatusComponent implements OnInit { }, error: (error) => { clearTimeout(timeoutId); - this.toastService.error('Error al sincronizar las subredes DHCP'); + this.toastService.error(error.error['hydra:description'] || 'Error al sincronizar las subredes'); } }); } @@ -85,7 +85,7 @@ export class GlobalStatusComponent implements OnInit { this.toastService.success('Sincronización de las plantillas Pxe completada'); }, error => { clearTimeout(timeoutId); - this.toastService.error('Error al sincronizar las plantillas Pxe'); + this.toastService.error(error.error['hydra:description'] || 'Error al sincronizar las plantillas Pxe'); }); } @@ -100,7 +100,7 @@ export class GlobalStatusComponent implements OnInit { this.toastService.success('Sincronización con los ogLives completada'); }, error => { clearTimeout(timeoutId); - this.toastService.error('Error al sincronizar imágenes ogLive'); + this.toastService.error(error.error['hydra:description'] || 'Error al sincronizar las imagenes ogLive'); }); } @@ -144,7 +144,7 @@ export class GlobalStatusComponent implements OnInit { clearTimeout(timeoutId); }, error: error => { - console.log(error); + this.toastService.error(error.error['hydra:description'] || 'Error al cargar el estado de ogBoot'); this.loading = false; this[errorState] = true; clearTimeout(timeoutId); @@ -217,7 +217,7 @@ export class GlobalStatusComponent implements OnInit { callback(false); }, error => { - console.error(`Error fetching status for repository ${repositoryUuid}`, error); + this.toastService.error(error.error['hydra:description'] || 'Error al cargar el estado del repositorio'); clearTimeout(timeoutId); callback(true); } diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.css b/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.css index f932c98..69ad087 100644 --- a/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.css +++ b/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.css @@ -196,3 +196,24 @@ mat-option .unit-name { justify-content: space-between; align-items: center; } + +.instructions-box { + margin-top: 15px; + background-color: #f5f5f5; + border: 1px solid #ccc; + padding: 15px; + border-radius: 6px; +} + +.instructions-textarea textarea { + font-family: monospace; + white-space: pre; +} + +.instructions-card { + background-color: #f5f5f5; + box-shadow: none !important; + margin-top: 15px; +} + + diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.html b/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.html index 006f2e8..1a5bd76 100644 --- a/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.html +++ b/ogWebconsole/src/app/components/groups/components/client-main-view/deploy-image/deploy-image.component.html @@ -15,6 +15,12 @@ (click)="save()">Ejecutar +
+ +
+
+ + +
{{ ogInstructions }}
+
+ +
+ 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 ff560c5..5ebe993 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 @@ -37,6 +37,9 @@ export class DeployImageComponent implements OnInit{ loading: boolean = false; allSelected = true; runScriptContext: any = null; + ogInstructions: string = ''; + deployImage: boolean = true; + showInstructions: boolean = false; protected p2pModeOptions = [ { name: 'Leecher', value: 'leecher' }, @@ -395,4 +398,39 @@ export class DeployImageComponent implements OnInit{ } }); } + + generateOgInstructions() { + let script = ''; + const disk = this.selectedPartition?.disk; + const partition = this.selectedPartition?.partition; + + let ip = this.selectedImage?.repository?.ip || 'REPO'; + let imgName = this.selectedImage?.canonicalName || ''; + let target = ` ${disk} ${partition}`; + let log = `ogEcho log session "[0] $MSG_SCRIPTS_TASK_START `; + + if (this.deployImage) { + script = 'deployImage '; + } else { + script = 'updateCache '; + imgName += '.img'; + target = ''; + } + + script += `${ip} /${imgName}${target} ${this.selectedMethod}`; + log += `${script}"\n`; + script = log + script; + + let params = ''; + if (['udpcast', 'uftp', 'udpcast-direct'].includes(this.selectedMethod)) { + params = `${this.mcastPort}:${this.mcastMode}:${this.mcastIp}:${this.mcastSpeed}M:${this.mcastMaxClients}:${this.mcastMaxTime}`; + } else if (this.selectedMethod === 'p2p') { + params = `${this.p2pMode}:${this.p2pTime}`; + } + + script += ` ${params}`; + + this.ogInstructions = script; + this.showInstructions = true + } } diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.css b/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.css index 9513cb6..aa7ed80 100644 --- a/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.css +++ b/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.css @@ -280,5 +280,12 @@ button.remove-btn:hover { white-space: pre; } +.instructions-card { + background-color: #f5f5f5; + box-shadow: none !important; + margin-top: 15px; +} + + diff --git a/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.html b/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.html index 838f72d..76c4a11 100644 --- a/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.html +++ b/ogWebconsole/src/app/components/groups/components/client-main-view/partition-assistant/partition-assistant.component.html @@ -92,11 +92,18 @@
- -
- - - +
+ + + Instrucciones generadas + + + +
{{ generatedInstructions }}
+
+
@@ -107,7 +114,6 @@ Tabla de particiones: {{ partitionCode }} -
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 5fc8b78..cb77c97 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 @@ -44,6 +44,7 @@ export class PartitionAssistantComponent implements OnInit{ clientData: any = []; loading: boolean = false; runScriptContext: any = null; + showInstructions = false; view: [number, number] = [400, 300]; showLegend = true; @@ -509,5 +510,6 @@ export class PartitionAssistantComponent implements OnInit{ instructions += `ogExecAndLog command session ogListPartitions ${diskNumber}\n`; this.generatedInstructions = instructions; + this.showInstructions = true } } diff --git a/ogWebconsole/src/app/components/groups/groups.component.html b/ogWebconsole/src/app/components/groups/groups.component.html index 2895e9a..bf30523 100644 --- a/ogWebconsole/src/app/components/groups/groups.component.html +++ b/ogWebconsole/src/app/components/groups/groups.component.html @@ -265,8 +265,7 @@
+ [checked]="selection.isSelected(client)"> Client Icon @@ -341,8 +340,7 @@
diff --git a/ogWebconsole/src/app/components/groups/groups.component.ts b/ogWebconsole/src/app/components/groups/groups.component.ts index ade27dd..c301173 100644 --- a/ogWebconsole/src/app/components/groups/groups.component.ts +++ b/ogWebconsole/src/app/components/groups/groups.component.ts @@ -587,11 +587,11 @@ export class GroupsComponent implements OnInit, OnDestroy { onRoomMap(room: TreeNode | null): void { if (!room || !room['@id']) return; this.subscriptions.add( - this.http.get<{ clients: Client[] }>(`${this.baseUrl}${room['@id']}`).subscribe( - (response) => { + this.http.get<{ clients: Client[] }>(`${this.baseUrl}/clients?organizationalUnit.id=${room.id}`).subscribe( + (response: any) => { this.dialog.open(ClassroomViewDialogComponent, { width: '90vw', - data: { clients: response.clients }, + data: { clients: response['hydra:member'] }, }); }, (error) => { @@ -750,8 +750,8 @@ export class GroupsComponent implements OnInit, OnDestroy { this.syncingClientId = null; this.refreshData(parentNodeId) }, - () => { - this.toastr.error('Error de conexión con el cliente'); + (error) => { + this.toastr.error(error.error['hydra:description'] || 'Error al actualizar el cliente'); this.syncStatus = false; this.syncingClientId = null; this.refreshData(parentNodeId) diff --git a/ogWebconsole/src/app/components/groups/shared/classroom-view/classroom-view.component.ts b/ogWebconsole/src/app/components/groups/shared/classroom-view/classroom-view.component.ts index 6058b57..2bc4d9a 100644 --- a/ogWebconsole/src/app/components/groups/shared/classroom-view/classroom-view.component.ts +++ b/ogWebconsole/src/app/components/groups/shared/classroom-view/classroom-view.component.ts @@ -72,7 +72,6 @@ export class ClassroomViewComponent implements OnInit, OnChanges { } handleClientClick(client: any): void { - console.log('Client clicked:', client); this.dialog.open(ClientViewComponent, { data: { client }, width: '800px', height: '700px' }); } @@ -108,4 +107,4 @@ export class ClassroomViewComponent implements OnInit, OnChanges { } else this.toastService.success('Cliente actualizado!', 'Éxito'); } -} \ No newline at end of file +} diff --git a/ogWebconsole/src/app/components/ogboot/ogboot-status/ogboot-status.component.ts b/ogWebconsole/src/app/components/ogboot/ogboot-status/ogboot-status.component.ts index aefc115..84bbde5 100644 --- a/ogWebconsole/src/app/components/ogboot/ogboot-status/ogboot-status.component.ts +++ b/ogWebconsole/src/app/components/ogboot/ogboot-status/ogboot-status.component.ts @@ -60,7 +60,8 @@ export class OgbootStatusComponent implements OnInit { this.loading = false; }, error => { - this.toastService.error('Error al sincronizar con el el servicio de og-boot'); + console.log(error) + this.toastService.error(error.error['hydra:description']); this.loading = false; }); } diff --git a/ogWebconsole/src/app/components/ogboot/pxe-images/create-image/create-image/create-image.component.ts b/ogWebconsole/src/app/components/ogboot/pxe-images/create-image/create-image/create-image.component.ts index 0458adb..a8f0ea2 100644 --- a/ogWebconsole/src/app/components/ogboot/pxe-images/create-image/create-image/create-image.component.ts +++ b/ogWebconsole/src/app/components/ogboot/pxe-images/create-image/create-image/create-image.component.ts @@ -43,10 +43,12 @@ export class CreatePXEImageComponent implements OnInit { next: (response: any) => { this.loading = false; this.downloads = response.message; + this.loading = false; }, error: (error) => { console.error('Error fetching downloads:', error); - this.toastService.error('Error fetching iso files'); + this.loading = false; + this.toastService.error(error.error['hydra:description'] || 'Error fetching downloads'); } }); } diff --git a/ogWebconsole/src/app/components/ogboot/pxe-images/pxe-images.component.html b/ogWebconsole/src/app/components/ogboot/pxe-images/pxe-images.component.html index 6f86ccf..eae69c8 100644 --- a/ogWebconsole/src/app/components/ogboot/pxe-images/pxe-images.component.html +++ b/ogWebconsole/src/app/components/ogboot/pxe-images/pxe-images.component.html @@ -8,7 +8,7 @@
- +
Seleccionar partición + [checked]="selection.isSelected(row)">
+ +
@@ -62,7 +62,7 @@ - {{ image.isGlobal ? 'Sí' : 'No' }} + {{ image.image?.isGlobal ? 'Sí' : 'No' }} diff --git a/ogWebconsole/src/app/components/repositories/show-monolitic-images/show-monolitic-images.component.ts b/ogWebconsole/src/app/components/repositories/show-monolitic-images/show-monolitic-images.component.ts index 1c27c32..64e083c 100644 --- a/ogWebconsole/src/app/components/repositories/show-monolitic-images/show-monolitic-images.component.ts +++ b/ogWebconsole/src/app/components/repositories/show-monolitic-images/show-monolitic-images.component.ts @@ -89,7 +89,6 @@ export class ShowMonoliticImagesComponent implements OnInit { } ngOnInit(): void { - console.error() if (this.data) { this.loadData(); } @@ -105,6 +104,8 @@ export class ShowMonoliticImagesComponent implements OnInit { }, error => { console.error('Error fetching image repositories', error); + this.loading = false; + this.toastService.error(error.error['hydra:description'] || 'Error al cargar las imágenes del repositorio'); } ) } @@ -192,6 +193,7 @@ export class ShowMonoliticImagesComponent implements OnInit { } toggleAction(image: any, action:string): void { + this.loading = true; switch (action) { case 'get-aux': this.http.post(`${this.baseUrl}/image-image-repositories/server/${image.uuid}/create-aux-files`, {}).subscribe({ @@ -353,6 +355,7 @@ export class ShowMonoliticImagesComponent implements OnInit { }); break; case 'rename': + this.loading = true; this.dialog.open(RenameImageComponent, { width: '600px', data: { @@ -403,6 +406,7 @@ export class ShowMonoliticImagesComponent implements OnInit { } openImageInfoDialog() { + this.loading = true; this.loadAlert().subscribe( response => { this.alertMessage = response.output; @@ -411,9 +415,12 @@ export class ShowMonoliticImagesComponent implements OnInit { width: '800px', data: this.alertMessage }); + this.loading = false; }, error => { console.error('Error al cargar la información del alert', error); + this.toastService.error(error.error['hydra:description']); + this.loading = false; } ); } diff --git a/ogWebconsole/src/app/components/software-profile/create-software-profile/create-software-profile.component.html b/ogWebconsole/src/app/components/software-profile/create-software-profile/create-software-profile.component.html index 17ad578..43a4cc7 100644 --- a/ogWebconsole/src/app/components/software-profile/create-software-profile/create-software-profile.component.html +++ b/ogWebconsole/src/app/components/software-profile/create-software-profile/create-software-profile.component.html @@ -48,7 +48,7 @@
- + {{ software.name }} - \ No newline at end of file + diff --git a/ogWebconsole/src/app/components/software-profile/create-software-profile/create-software-profile.component.ts b/ogWebconsole/src/app/components/software-profile/create-software-profile/create-software-profile.component.ts index 24b85f5..bf8937b 100644 --- a/ogWebconsole/src/app/components/software-profile/create-software-profile/create-software-profile.component.ts +++ b/ogWebconsole/src/app/components/software-profile/create-software-profile/create-software-profile.component.ts @@ -74,7 +74,7 @@ export class CreateSoftwareProfileComponent implements OnInit { } loadSoftware() { - this.http.get(`${this.baseUrl}/software?page=1&itemsPerPage=10`).subscribe( + this.http.get(`${this.baseUrl}/software?softwareProfileId=${this.data.id}&page=1&itemsPerPage=10`).subscribe( response => { this.softwareCollection = response['hydra:member']; }, diff --git a/ogWebconsole/src/app/components/software-profile/software-profile.component.ts b/ogWebconsole/src/app/components/software-profile/software-profile.component.ts index 86d94ed..2237669 100644 --- a/ogWebconsole/src/app/components/software-profile/software-profile.component.ts +++ b/ogWebconsole/src/app/components/software-profile/software-profile.component.ts @@ -39,12 +39,12 @@ export class SoftwareProfileComponent { { columnDef: 'description', header: 'Descripción', - cell: (software: any) => `${software.description}` + cell: (software: any) => software.description }, { columnDef: 'operativeSystem', header: 'Sistema Operativo', - cell: (software: any) => `${software.operativeSystem?.name}` + cell: (software: any) => software.operativeSystem?.name }, { columnDef: 'createdAt', @@ -61,7 +61,7 @@ export class SoftwareProfileComponent { private toastService: ToastrService, private joyrideService: JoyrideService, private configService: ConfigService - ) { + ) { this.baseUrl = this.configService.apiUrl; this.apiUrl = `${this.baseUrl}/software-profiles`; } diff --git a/ogWebconsole/src/app/components/software/software.component.ts b/ogWebconsole/src/app/components/software/software.component.ts index 25abbf3..60e0ec8 100644 --- a/ogWebconsole/src/app/components/software/software.component.ts +++ b/ogWebconsole/src/app/components/software/software.component.ts @@ -39,17 +39,12 @@ export class SoftwareComponent { { columnDef: 'name', header: 'Nombre', - cell: (software: any) => `${software.name}` - }, - { - columnDef: 'description', - header: 'Descripción', - cell: (software: any) => `${software.description}` + cell: (software: any) => software.name }, { columnDef: 'type', header: 'Tipo', - cell: (software: any) => `${software.type}` + cell: (software: any) => software.type }, { columnDef: 'createdAt', @@ -108,15 +103,15 @@ export class SoftwareComponent { }); } - deleteSoftware(calendar: any): void { + deleteSoftware(software: any): void { const dialogRef = this.dialog.open(DeleteModalComponent, { width: '400px', - data: { name: calendar.name } + data: { name: software.name } }); dialogRef.afterClosed().subscribe(result => { if (result) { - const apiUrl = `${this.baseUrl}${calendar['@id']}`; + const apiUrl = `${this.baseUrl}${software['@id']}`; this.http.delete(apiUrl).subscribe({ next: () => { diff --git a/ogWebconsole/src/app/components/task-logs/task-logs.component.html b/ogWebconsole/src/app/components/task-logs/task-logs.component.html index b010f4a..eeb2930 100644 --- a/ogWebconsole/src/app/components/task-logs/task-logs.component.html +++ b/ogWebconsole/src/app/components/task-logs/task-logs.component.html @@ -68,6 +68,23 @@ close + + + Desde + + + + + + + Hasta + + + + +
@@ -180,4 +197,4 @@ - \ No newline at end of file + diff --git a/ogWebconsole/src/app/components/task-logs/task-logs.component.ts b/ogWebconsole/src/app/components/task-logs/task-logs.component.ts index 46061fe..18e441b 100644 --- a/ogWebconsole/src/app/components/task-logs/task-logs.component.ts +++ b/ogWebconsole/src/app/components/task-logs/task-logs.component.ts @@ -36,6 +36,7 @@ export class TaskLogsComponent implements OnInit { mode: ProgressBarMode = 'buffer'; progress = 0; bufferValue = 0; + today = new Date(); filteredCommands2 = Object.keys(COMMAND_TYPES).map(key => ({ name: key, @@ -215,10 +216,20 @@ export class TaskLogsComponent implements OnInit { loadTraces(): void { this.loading = true; const url = `${this.baseUrl}/traces?page=${this.page + 1}&itemsPerPage=${this.itemsPerPage}`; - const params = { ...this.filters }; + const params: any = { ...this.filters }; if (params['status'] === undefined) { delete params['status']; } + + if (params['startDate']) { + params['executedAt[after]'] = this.datePipe.transform(params['startDate'], 'yyyy-MM-dd'); + delete params['startDate']; + } + if (params['endDate']) { + params['executedAt[before]'] = this.datePipe.transform(params['endDate'], 'yyyy-MM-dd'); + delete params['endDate']; + } + this.http.get(url, { params }).subscribe( (data) => { this.traces = data['hydra:member']; @@ -288,6 +299,21 @@ export class TaskLogsComponent implements OnInit { })); } + onDateFilterChange(): void { + const start = this.filters['startDate']; + const end = this.filters['endDate']; + + if (!start || !end) { + return; + } + + if (start && end && start > end) { + this.toastService.warning('La fecha de inicio no puede ser mayor que la fecha de fin'); + return; + } + this.loadTraces(); + } + onPageChange(event: any): void { this.page = event.pageIndex; this.itemsPerPage = event.pageSize;
{{ column.header }}