diff --git a/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.css b/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.css index cf0452e..e8e0262 100644 --- a/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.css +++ b/ogWebconsole/src/app/components/groups/shared/clients/manage-client/manage-client.component.css @@ -92,27 +92,13 @@ mat-option .unit-path { padding: 6px 0 12px 0; } -.hardware-profile-icon { - color: #3f51b5; -} - -.hardware-profile-value { - font-weight: 500; - color: #2c3e50; -} - -.hardware-profile-empty { - color: #6c757d; - font-style: italic; +.hardware-profile-box .form-field { + flex: 1; + min-width: 0; + width: auto; } .hardware-profile-link { margin-left: auto; - background: none; - border: none; color: #3f51b5; - font-weight: 500; - cursor: pointer; - text-decoration: underline; - padding: 0; } \ No newline at end of file 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 1ee7a69..40559ff 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 @@ -143,14 +143,17 @@
{{ 'labelHardwareProfile' | translate }}
- @if (hardwareProfile) { - memory - {{ hardwareProfile.description }} - } @else { - {{ 'noHardwareProfileAssigned' | translate }} - } -
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 6600891..6b7ee1f 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 @@ -25,7 +25,7 @@ export class ManageClientComponent implements OnInit { templates: any[] = []; repositories: any[] = []; bootServers: any[] = []; - hardwareProfile: any = null; + hardwareProfiles: any[] = []; loading: boolean = false; displayedColumns: string[] = ['name', 'ip']; dialogTitle: string; @@ -58,7 +58,8 @@ export class ManageClientComponent implements OnInit { this.loadParentUnits(), this.loadBootServers(), this.loadRepositories(), - this.loadMenus() + this.loadMenus(), + this.loadHardwareProfiles() ]; Promise.all(observables).then(() => { @@ -94,6 +95,7 @@ export class ManageClientComponent implements OnInit { ogLive: [null], repository: [null], menu: [null], + hardwareProfile: [null], maintenance: [false], resolution: [null], notes: [''] @@ -225,6 +227,24 @@ export class ManageClientComponent implements OnInit { }); } + loadHardwareProfiles(): Promise { + return new Promise((resolve, reject) => { + const url = `${this.baseUrl}/hardware-profiles?page=1&itemsPerPage=10000`; + + this.http.get(url).subscribe( + response => { + this.hardwareProfiles = response['hydra:member']; + resolve(); + }, + error => { + console.error(this.translate.instant('errorFetchingHardwareProfiles'), error); + this.hardwareProfiles = []; + resolve(); + } + ); + }); + } + loadRepositories(): Promise { return new Promise((resolve, reject) => { const url = `${this.baseUrl}/image-repositories?page=1&itemsPerPage=10000`; @@ -284,7 +304,6 @@ export class ManageClientComponent implements OnInit { const bootServerIri: string | null = data.bootServer ? data.bootServer['@id'] : null; const savedOgLive: string | null = data.ogLive ? data.ogLive['@id'] : null; const savedPxeTemplate: string | null = data.pxeTemplate ? data.pxeTemplate['@id'] : null; - this.hardwareProfile = data.hardwareProfile || null; // Patch fields that don't depend on server first this.clientForm.patchValue({ @@ -298,6 +317,7 @@ export class ManageClientComponent implements OnInit { bootServer: bootServerIri, repository: data.repository ? data.repository['@id'] : null, menu: data.menu ? data.menu['@id'] : null, + hardwareProfile: data.hardwareProfile ? data.hardwareProfile['@id'] : null, maintenance: data.maintenance, resolution: data.resolution, notes: data.notes || '' diff --git a/ogWebconsole/src/app/components/hardware-profile/hardware-profile.component.css b/ogWebconsole/src/app/components/hardware-profile/hardware-profile.component.css index 34edd43..21bcd86 100644 --- a/ogWebconsole/src/app/components/hardware-profile/hardware-profile.component.css +++ b/ogWebconsole/src/app/components/hardware-profile/hardware-profile.component.css @@ -62,11 +62,22 @@ .client-info { display: flex; flex-direction: column; + max-width: 220px; } .client-name { font-weight: 500; color: #333; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.client-more { + font-weight: 400; + font-style: italic; + color: #666; + cursor: default; } .client-details { @@ -74,8 +85,4 @@ flex-direction: column; font-size: 0.75em; color: #666; -} - -.client-ip, .client-mac { - font-family: monospace; } \ No newline at end of file diff --git a/ogWebconsole/src/app/components/hardware-profile/hardware-profile.component.html b/ogWebconsole/src/app/components/hardware-profile/hardware-profile.component.html index cccbbbe..86dd353 100644 --- a/ogWebconsole/src/app/components/hardware-profile/hardware-profile.component.html +++ b/ogWebconsole/src/app/components/hardware-profile/hardware-profile.component.html @@ -47,11 +47,12 @@ - +
-
{{ column.cell(image).name }}
-
- {{ column.cell(image).ip }} +
{{ assignedClient.name }}
+
+ {{ 'andMoreClients' | translate: { count: column.cell(image).length - maxVisibleClients } }}
@@ -60,7 +61,7 @@ + *ngIf="column.columnDef !== 'isDefault' && column.columnDef !== 'installed' && column.columnDef !== 'downloadUrl' && column.columnDef !== 'clients'"> {{ column.cell(image) }} diff --git a/ogWebconsole/src/app/components/hardware-profile/hardware-profile.component.ts b/ogWebconsole/src/app/components/hardware-profile/hardware-profile.component.ts index 3ea2a45..06159d5 100644 --- a/ogWebconsole/src/app/components/hardware-profile/hardware-profile.component.ts +++ b/ogWebconsole/src/app/components/hardware-profile/hardware-profile.component.ts @@ -37,6 +37,7 @@ export class HardwareProfileComponent { filteredClients!: Observable; clientControl = new FormControl(); clients: any[] = []; + maxVisibleClients: number = 3; columns = [ { columnDef: 'id', @@ -49,13 +50,9 @@ export class HardwareProfileComponent { cell: (hardware: any) => hardware.description }, { - columnDef: 'client', - header: 'client', - cell: (hardware: any) => hardware.client ? { - name: hardware.client.name || 'N/A', - ip: hardware.client.ip || 'N/A', - mac: hardware.client.mac || 'N/A' - } : 'N/A' + columnDef: 'clients', + header: 'clients', + cell: (hardware: any) => hardware.clients?.length ? hardware.clients : 'N/A' }, { columnDef: 'createdAt', @@ -104,16 +101,24 @@ export class HardwareProfileComponent { } onOptionClientSelected(selectedClient: any): void { - this.filters['client.id'] = selectedClient.id; + this.filters['clients.id'] = selectedClient.id; this.search(); } clearClientFilter(event: Event, clientSearchClientInput: any): void { clientSearchClientInput.value = ''; - this.filters['client.id'] = ''; + this.filters['clients.id'] = ''; this.search(); } + getVisibleClients(clients: any): any[] { + return (clients || []).slice(0, this.maxVisibleClients); + } + + getHiddenClientNames(clients: any): string { + return (clients || []).slice(this.maxVisibleClients).map((client: any) => client.name).join(', '); + } + private _filterClients(value: string): any[] { const filterValue = value.toLowerCase();