ref 2994. Cambios respecto al hardware profile

pull/97/head
Manuel Aranda Rosales 2026-07-07 17:21:53 +02:00
parent ede9161168
commit 5755b79bc7
5 changed files with 60 additions and 0 deletions

View File

@ -83,4 +83,36 @@ mat-option .unit-path {
display: grid;
grid-template-columns: repeat(3, 1fr);
column-gap: 20px;
}
.hardware-profile-box {
display: flex;
align-items: center;
gap: 10px;
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-link {
margin-left: auto;
background: none;
border: none;
color: #3f51b5;
font-weight: 500;
cursor: pointer;
text-decoration: underline;
padding: 0;
}

View File

@ -139,6 +139,23 @@
</div>
</fieldset>
@if (isEditMode) {
<fieldset class="fieldset-group">
<legend class="fieldset-legend">{{ 'labelHardwareProfile' | translate }}</legend>
<div class="hardware-profile-box">
@if (hardwareProfile) {
<mat-icon class="hardware-profile-icon">memory</mat-icon>
<span class="hardware-profile-value">{{ hardwareProfile.description }}</span>
} @else {
<span class="hardware-profile-empty">{{ 'noHardwareProfileAssigned' | translate }}</span>
}
<button type="button" class="hardware-profile-link" (click)="goToHardwareProfiles()">
{{ 'manageHardwareProfiles' | translate }}
</button>
</div>
</fieldset>
}
<mat-form-field class="form-field full-width">
<mat-label>{{ 'labelNotes' | translate }}</mat-label>
<textarea matInput formControlName="notes" rows="4"

View File

@ -5,6 +5,7 @@ import { Component, Inject, OnInit } from '@angular/core';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { ToastrService } from 'ngx-toastr';
import { Router } from '@angular/router';
import { DataService } from '../../../services/data.service';
import { ConfigService } from '@services/config.service';
@ -24,6 +25,7 @@ export class ManageClientComponent implements OnInit {
templates: any[] = [];
repositories: any[] = [];
bootServers: any[] = [];
hardwareProfile: any = null;
loading: boolean = false;
displayedColumns: string[] = ['name', 'ip'];
dialogTitle: string;
@ -41,6 +43,7 @@ export class ManageClientComponent implements OnInit {
private configService: ConfigService,
private toastService: ToastrService,
private dataService: DataService,
private router: Router,
@Inject(MAT_DIALOG_DATA) public data: any
) {
this.baseUrl = this.configService.apiUrl;
@ -281,6 +284,7 @@ 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({
@ -364,4 +368,9 @@ export class ManageClientComponent implements OnInit {
onNoClick(): void {
this.dialogRef.close({ success: false });
}
goToHardwareProfiles(): void {
this.dialogRef.close({ success: false });
this.router.navigate(['/hardware-profiles']);
}
}

View File

@ -1015,6 +1015,7 @@
"noFilesInDirectory": "There are no files in this directory",
"noGitInfoForPartition": "No Git information found for this partition",
"noHardwareAssociatedToProfile": "There is no hardware associated with this profile",
"noHardwareProfileAssigned": "This client does not have its own hardware profile assigned",
"noInternalElementsMessage": "No internal elements",
"noLogsAvailable": "noLogsAvailable",
"noOgLivesInServer": "There are no OgLives on this server",

View File

@ -1015,6 +1015,7 @@
"noFilesInDirectory": "No hay archivos en este directorio",
"noGitInfoForPartition": "No se encontró información de Git para esta partición",
"noHardwareAssociatedToProfile": "No hay hardware asociado a este perfil",
"noHardwareProfileAssigned": "Este cliente no tiene un perfil de hardware propio asignado",
"noInternalElementsMessage": "No hay elementos internos",
"noLogsAvailable": "noLogsAvailable",
"noOgLivesInServer": "No hay OgLives en este servidor",