From 83ab784c48b58981bc018ebcec1ee8f9bab57dcf Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Wed, 30 Apr 2025 13:16:18 +0200 Subject: [PATCH] refs #1922. Show new fields in clients table. Fixed wrong details --- .../classroom-view.component.css | 13 +++--- .../classroom-view.component.html | 4 +- .../client-details.component.css | 28 ++++++++++-- .../client-details.component.html | 11 +++-- .../client-details.component.ts | 45 ++++--------------- .../manage-client.component.html | 2 +- .../manage-client/manage-client.component.ts | 8 ++-- .../manage-organizational-unit.component.html | 26 +++++++---- .../manage-organizational-unit.component.ts | 45 ++++++++++++------- 9 files changed, 103 insertions(+), 79 deletions(-) diff --git a/ogWebconsole/src/app/components/groups/shared/classroom-view/classroom-view.component.css b/ogWebconsole/src/app/components/groups/shared/classroom-view/classroom-view.component.css index 4413607..46fede3 100644 --- a/ogWebconsole/src/app/components/groups/shared/classroom-view/classroom-view.component.css +++ b/ogWebconsole/src/app/components/groups/shared/classroom-view/classroom-view.component.css @@ -21,21 +21,24 @@ mat-card { } .client-image { - width: 100%; + display: flex; + justify-content: center; + width: 70%; height: auto; + margin: 0 auto; } .proyector-image { width: auto; - height: 100px; + height: 80px; } .client-info { + display: grid; text-align: center; - margin-top: 5px; - font-size: medium; color: gray; align-items: center; + font-size: small; } .client-name { @@ -131,4 +134,4 @@ mat-dialog-content { .submit-button { margin: 1rem; -} \ No newline at end of file +} diff --git a/ogWebconsole/src/app/components/groups/shared/classroom-view/classroom-view.component.html b/ogWebconsole/src/app/components/groups/shared/classroom-view/classroom-view.component.html index c5b1bbd..fbe9a77 100644 --- a/ogWebconsole/src/app/components/groups/shared/classroom-view/classroom-view.component.html +++ b/ogWebconsole/src/app/components/groups/shared/classroom-view/classroom-view.component.html @@ -12,7 +12,9 @@ {{ 'clientAlt' | translate }}
- {{ client.name }} + {{ client.name }} + {{ client.ip }} + {{ client.mac }}
diff --git a/ogWebconsole/src/app/components/groups/shared/client-details/client-details.component.css b/ogWebconsole/src/app/components/groups/shared/client-details/client-details.component.css index 902cb8f..0aa7a6d 100644 --- a/ogWebconsole/src/app/components/groups/shared/client-details/client-details.component.css +++ b/ogWebconsole/src/app/components/groups/shared/client-details/client-details.component.css @@ -62,7 +62,8 @@ } .table-container { - flex: 1 1 500px; + flex: 5; + display: flex; overflow-x: auto; } @@ -70,7 +71,7 @@ display: flex; flex-wrap: wrap; gap: 24px; - flex: 1 1 300px; + flex: 2; justify-content: flex-start; } @@ -85,6 +86,13 @@ table { box-shadow: none; } +.table-header-container { + display: flex; + align-items: center; + padding: 10px; + gap: 20px; +} + .charts-container.single-disk { justify-content: center; } @@ -107,4 +115,18 @@ table { width: 100%; height: 160px; margin-bottom: 12px; -} \ No newline at end of file +} + +.action-container { + display: flex; + justify-content: flex-end; + gap: 1em; + padding: 1.5em; +} + +.client-container { + display: flex; + flex-direction: column; + gap: 1em; + margin-bottom: 40px; +} diff --git a/ogWebconsole/src/app/components/groups/shared/client-details/client-details.component.html b/ogWebconsole/src/app/components/groups/shared/client-details/client-details.component.html index 9e8edc0..8beb74e 100644 --- a/ogWebconsole/src/app/components/groups/shared/client-details/client-details.component.html +++ b/ogWebconsole/src/app/components/groups/shared/client-details/client-details.component.html @@ -23,10 +23,12 @@ -
-

Discos/Particiones

+
+

Discos/Particiones

+ {{ clientData.firmwareType }}
+
@@ -63,4 +65,7 @@
- \ No newline at end of file + + + + diff --git a/ogWebconsole/src/app/components/groups/shared/client-details/client-details.component.ts b/ogWebconsole/src/app/components/groups/shared/client-details/client-details.component.ts index 919e84e..788cb42 100644 --- a/ogWebconsole/src/app/components/groups/shared/client-details/client-details.component.ts +++ b/ogWebconsole/src/app/components/groups/shared/client-details/client-details.component.ts @@ -64,6 +64,11 @@ export class ClientDetailsComponent { header: 'Particion', cell: (partition: any) => `${partition.partitionNumber}` }, + { + columnDef: 'partitionCode', + header: 'Tipo de partición', + cell: (partition: any) => `${partition.partitionCode}` + }, { columnDef: 'description', header: 'Sistema de ficheros', @@ -115,7 +120,7 @@ export class ClientDetailsComponent { console.error('No se recibieron datos del cliente.'); } } - + loadClient = (uuid: string) => { this.http.get(`${this.baseUrl}${uuid}`).subscribe({ next: data => { @@ -225,42 +230,8 @@ export class ClientDetailsComponent { }); } - - loadCommands(): void { - this.http.get(`${this.baseUrl}/commands?`).subscribe({ - next: data => { - this.commands = data['hydra:member']; - }, - error: error => { - console.error('Error al obtener las particiones:', error); - } - }); - } - - onCommandSelect(action: any): void { - if (action === 'partition') { - this.openPartitionAssistant(); - } - - if (action === 'create-image') { - this.openCreateImageAssistant(); - } - - if (action === 'deploy-image') { - this.openDeployImageAssistant(); - } - - if (action === 'reboot') { - this.rebootClient(); - } - - if (action === 'power-off') { - this.powerOffClient(); - } - - if (action === 'power-on') { - this.powerOnClient(); - } + onNoClick(): void { + this.dialog.closeAll(); } rebootClient(): void { diff --git a/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.html b/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.html index 1a4d246..69f2a51 100644 --- a/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.html +++ b/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.html @@ -67,7 +67,7 @@ {{ 'templateLabel' | translate }} - + {{ template.name }} diff --git a/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.ts b/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.ts index 163fbcb..d38075c 100644 --- a/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.ts +++ b/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.ts @@ -86,7 +86,7 @@ export class ManageClientComponent implements OnInit { netDriver: null, mac: ['', Validators.pattern(/^([0-9A-Fa-f]{2}:){5}[0-9A-Fa-f]{2}$/)], ip: ['', Validators.required], - template: [null], + pxeTemplate: [null], hardwareProfile: [null], ogLive: [null], repository: [null], @@ -110,7 +110,8 @@ export class ManageClientComponent implements OnInit { repository: unit.networkSettings?.repository?.['@id'], hardwareProfile: unit.networkSettings?.hardwareProfile?.['@id'], ogLive: unit.networkSettings?.ogLive?.['@id'], - menu: unit.networkSettings?.menu?.['@id'] + menu: unit.networkSettings?.menu?.['@id'], + pxeTemplate: unit.networkSettings?.pxeTemplate?.['@id'], })); const initialUnitId = this.clientForm.get('organizationalUnit')?.value; @@ -229,6 +230,7 @@ export class ManageClientComponent implements OnInit { ogLive: selectedUnit.ogLive || null, menu: selectedUnit.menu || null, netiface: selectedUnit.netiface || null, + pxeTemplate: selectedUnit.pxeTemplate || null }); } } @@ -250,7 +252,7 @@ export class ManageClientComponent implements OnInit { organizationalUnit: data.organizationalUnit ? data.organizationalUnit['@id'] : null, repository: data.repository ? data.repository['@id'] : null, ogLive: data.ogLive ? data.ogLive['@id'] : null, - template: data.template ? data.template['@id'] : null, + pxeTemplate: data.pxeTemplate ? data.pxeTemplate['@id'] : null, menu: data.menu ? data.menu['@id'] : null, maintenance: data.maintenance }); diff --git a/ogWebconsole/src/app/components/groups/shared/organizational-units/manage-organizational-unit/manage-organizational-unit.component.html b/ogWebconsole/src/app/components/groups/shared/organizational-units/manage-organizational-unit/manage-organizational-unit.component.html index dc980dd..a72d549 100644 --- a/ogWebconsole/src/app/components/groups/shared/organizational-units/manage-organizational-unit/manage-organizational-unit.component.html +++ b/ogWebconsole/src/app/components/groups/shared/organizational-units/manage-organizational-unit/manage-organizational-unit.component.html @@ -18,7 +18,7 @@ - Padre + Unidad organizativa superior {{ getSelectedParentName() }} @@ -72,14 +72,22 @@ Configuración de Red
- - OgLive - - - {{ oglive.name }} - - - + + OgLive + + + {{ oglive.name }} + + + + + Plantilla PXE + + + {{ template.name }} + + + Repositorio diff --git a/ogWebconsole/src/app/components/groups/shared/organizational-units/manage-organizational-unit/manage-organizational-unit.component.ts b/ogWebconsole/src/app/components/groups/shared/organizational-units/manage-organizational-unit/manage-organizational-unit.component.ts index 87c49df..1ae3a86 100644 --- a/ogWebconsole/src/app/components/groups/shared/organizational-units/manage-organizational-unit/manage-organizational-unit.component.ts +++ b/ogWebconsole/src/app/components/groups/shared/organizational-units/manage-organizational-unit/manage-organizational-unit.component.ts @@ -30,6 +30,7 @@ export class ManageOrganizationalUnitComponent implements OnInit { isEditMode: boolean; currentCalendar: any = []; ogLives: any[] = []; + pxeTemplates: any[] = []; menus: any[] = []; repositories: any[] = []; parentUnitsWithPaths: { id: string, name: string, path: string }[] = []; @@ -77,6 +78,7 @@ export class ManageOrganizationalUnitComponent implements OnInit { this.networkSettingsFormGroup = this._formBuilder.group({ ogLive: [null], repository: [null], + pxeTemplate: [null], proxy: [null], dns: [null], netmask: [null], @@ -111,6 +113,7 @@ export class ManageOrganizationalUnitComponent implements OnInit { this.loadOgLives(), this.loadRepositories(), this.loadMenus(), + this.loadPxeTemplates() ]; Promise.all(observables).then(() => { @@ -144,6 +147,7 @@ export class ManageOrganizationalUnitComponent implements OnInit { repository: unit.networkSettings?.repository?.['@id'], hardwareProfile: unit.networkSettings?.hardwareProfile?.['@id'], ogLive: unit.networkSettings?.ogLive?.['@id'], + pxeTemplate: unit.networkSettings?.pxeTemplate?.['@id'], menu: unit.networkSettings?.menu?.['@id'], mcastIp: unit.networkSettings?.mcastIp, mcastSpeed: unit.networkSettings?.mcastSpeed, @@ -183,6 +187,7 @@ export class ManageOrganizationalUnitComponent implements OnInit { repository: selectedUnit.repository || null, hardwareProfile: selectedUnit.hardwareProfile || null, ogLive: selectedUnit.ogLive || null, + pxeTemplate: selectedUnit.pxeTemplate || null, menu: selectedUnit.menu || null, mcastIp: selectedUnit.mcastIp || null, mcastSpeed: selectedUnit.mcastSpeed || null, @@ -219,6 +224,23 @@ export class ManageOrganizationalUnitComponent implements OnInit { }); } + loadPxeTemplates(): Promise { + return new Promise((resolve, reject) => { + const url = `${this.baseUrl}/pxe-templates?page=1&itemsPerPage=10000`; + + this.http.get(url).subscribe( + response => { + this.pxeTemplates = response['hydra:member']; + resolve(); + }, + error => { + console.error('Error fetching pxe templates:', error); + reject(error); + } + ); + }); + } + loadOgLives(): Promise { return new Promise((resolve, reject) => { const url = `${this.baseUrl}/og-lives?page=1&itemsPerPage=30`; @@ -287,22 +309,6 @@ export class ManageOrganizationalUnitComponent implements OnInit { }); } - loadCurrentCalendar(uuid: string): void { - this.loading = true; - const apiUrl = `${this.baseUrl}/remote-calendars/${uuid}`; - this.http.get(apiUrl).subscribe( - response => { - this.currentCalendar = response; - this.loading = false; - }, - error => { - console.error('Error loading current calendar', error); - this.toastService.error('Error loading current calendar'); - this.loading = false; - } - ); - } - onCalendarChange(event: any) { this.generalFormGroup.value.remoteCalendar = event.value; } @@ -315,6 +321,10 @@ export class ManageOrganizationalUnitComponent implements OnInit { this.networkSettingsFormGroup.value.repository = event.value; } + onPxeTemplateChange(event: any) { + this.networkSettingsFormGroup.value.pxeTemplate = event.value; + } + loadData(uuid: string): Promise { return new Promise((resolve, reject) => { const url = `${this.baseUrl}/organizational-units/${uuid}`; @@ -347,7 +357,8 @@ export class ManageOrganizationalUnitComponent implements OnInit { menu: data.networkSettings?.menu ? data.networkSettings.menu['@id'] : null, hardwareProfile: data.networkSettings?.hardwareProfile ? data.networkSettings.hardwareProfile['@id'] : null, ogLive: data.networkSettings?.ogLive ? data.networkSettings.ogLive['@id'] : null, - repository: data.networkSettings?.repository ? data.networkSettings.repository['@id'] : null + repository: data.networkSettings?.repository ? data.networkSettings.repository['@id'] : null, + pxeTemplate: data.networkSettings?.pxeTemplate ? data.networkSettings.pxeTemplate['@id'] : null }); this.classroomInfoFormGroup.patchValue({ location: data.location,