refs #1931 Refactor ClientDetailsComponent to enhance layout and improve data handling in client details view
testing/ogGui-multibranch/pipeline/head This commit looks good Details

develop
Lucas Lara García 2025-04-23 13:51:45 +02:00
parent a40be684b5
commit 70e21c6ca2
3 changed files with 101 additions and 342 deletions

View File

@ -1,326 +1,88 @@
.header-container { .modal-content {
display: flex; max-height: 80vh;
justify-content: space-between; overflow-y: auto;
align-items: center; background-color: #fff;
padding: 10px;
}
.client-container {
flex-grow: 1;
box-sizing: border-box;
overflow: hidden;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
padding: 0rem 1rem 0rem 0.5rem;
} }
.client-icon { .section-header {
flex-shrink: 0; margin-bottom: 8px;
margin-right: 20px;
display: flex;
align-items: center;
justify-content: center;
min-width: 120px;
min-height: 120px;
} }
.row-container { .client-info-card {
justify-content: space-between; background-color: #e4e4e4;
width: 100%; padding: 24px;
}
.table-container {
padding-right: 10px;
}
.charts-wrapper {
width: 100%;
margin-top: 20px;
}
.charts-row {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
gap: 20px;
}
.disk-usage {
text-align: center;
flex: 1;
min-width: 200px;
}
.circular-chart {
max-width: 150px;
max-height: 150px;
margin: 0 auto;
}
.chart {
display: flex;
justify-content: center;
}
.icon-pc {
font-size: 25px;
color: #3b82f6;
}
.client-title h1 {
font-size: 2rem;
margin-bottom: 10px;
}
.client-title p {
margin: 2px 0;
font-size: 1rem;
color: #666;
}
.client-info {
margin: 20px 0;
border-radius: 12px; border-radius: 12px;
background-color: #f5f7fa; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
padding: 20px; margin-bottom: 2em;
border: 2px solid #d1d9e6; margin-top: 1.5em;
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
} }
.info-section { .info-columns {
background-color: #fff;
border-radius: 12px;
}
.two-column-table {
display: grid; display: grid;
grid-template-columns: 1fr 1fr; grid-template-columns: 1fr 1fr;
gap: 10px; gap: 24px;
margin-top: 15px;
} }
.mat-elevation-z8 { .info-column {
box-shadow: 0px 0px 0px rgba(0, 0, 0, 0.2);
}
.table-row {
display: flex;
justify-content: space-between;
padding: 10px;
border-bottom: 1px solid #e0e0e0;
}
.column.property {
font-weight: bold;
text-align: left;
width: 45%;
}
.column.value {
text-align: right;
width: 45%;
}
.mat-tab-group {
min-height: 400px;
}
.mat-tab-body-wrapper {
min-height: inherit;
}
.info-section h2 {
font-size: 1.4rem;
margin-bottom: 10px;
color: #0056b3;
}
.info-section p {
font-size: 1rem;
margin: 5px 0;
}
.second-section {
display: grid;
gap: 20px;
}
.client-button-row {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
gap: 20px;
}
.buttons-row {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
background-color: #fff; gap: 16px;
padding: 20px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
justify-content: flex-start;
} }
.buttons-row button { .info-pair {
margin-bottom: 10px; display: flex;
width: 100%; flex-direction: column;
} }
.circular-chart { .label {
display: block; font-size: 0.9rem;
margin: 0 auto; font-weight: 550;
max-width: 100%; color: #3f51b5;
max-height: 150px;
} }
.circle-bg { .value {
fill: none; font-size: 1rem;
stroke: #f0f0f0; color: #222;
stroke-width: 3.8; word-break: break-word;
}
.circle {
fill: none;
stroke-width: 3.8;
stroke: #00bfa5;
stroke-linecap: round;
animation: progress 1s ease-out forwards;
}
.percentage {
fill: #333;
font-size: 0.7rem;
text-anchor: middle;
}
.disk-usage h3 {
margin: 0 0 10px 0;
font-size: 1.2rem;
color: #333;
}
@keyframes progress {
0% {
stroke-dasharray: 0, 100;
}
}
.assistants-container {
background-color: #fff;
margin-top: 10px;
padding: 20px;
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.circular-chart {
display: block;
margin: 0 auto;
max-width: 100%;
max-height: 150px;
}
.circle-bg {
fill: none;
stroke: #f0f0f0;
stroke-width: 3.8;
}
.circle {
fill: none;
stroke-width: 3.8;
stroke-linecap: round;
animation: progress 1s ease-out forwards;
}
.partition-0 {
stroke: #00bfa5;
}
.partition-1 {
stroke: #ff6f61;
}
.partition-2 {
stroke: #ffb400;
}
.partition-3 {
stroke: #3498db;
}
.percentage {
fill: #333;
font-size: 0.7rem;
text-anchor: middle;
} }
.disk-container { .disk-container {
display: flex; display: flex;
flex-direction: row; flex-direction: column;
gap: 20px; gap: 32px;
background-color: #f5f7fa;
border: 2px solid #d1d9e6;
border-radius: 10px;
padding: 20px;
margin-top: 20px;
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
flex-wrap: wrap;
justify-content: center;
align-items: stretch;
margin-bottom: 20px;
} }
.table-container { .table-container {
flex: 3; overflow-x: auto;
display: flex;
justify-content: center;
align-items: center;
}
table.mat-elevation-z8 {
width: 100%;
max-width: 800px;
background-color: white;
border-radius: 8px; border-radius: 8px;
overflow: hidden; background: #fff;
padding: 16px;
box-shadow: 0 2px 6px rgba(0,0,0,0.05);
} }
.mat-header-cell { .mat-elevation-z8 {
background-color: #d1d9e6 !important; width: 100%;
color: #333; border-radius: 8px;
font-weight: bold;
text-align: center;
}
.mat-cell {
text-align: center;
}
.mat-chip {
font-weight: bold;
color: white;
} }
.charts-container { .charts-container {
flex: 2;
display: flex; display: flex;
flex-direction: column; flex-wrap: wrap;
align-items: center; gap: 24px;
justify-content: center;
} }
.disk-usage { .disk-usage {
background-color: white; flex: 1 1 300px;
padding: 15px; padding: 16px;
border-radius: 8px; background: #f9f9f9;
justify-self: center; border-radius: 12px;
box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1); box-shadow: 0 2px 6px rgba(0,0,0,0.05);
text-align: center;
} }
.chart { .chart {
display: flex; width: 100%;
justify-content: center; height: 200px;
margin-bottom: 12px;
} }

View File

@ -1,29 +1,29 @@
<mat-dialog-content class="modal-content">
<app-loading [isLoading]="loading"></app-loading> <app-loading [isLoading]="loading"></app-loading>
<div class="client-container"> <div class="client-container" *ngIf="!loading">
<div class="header-container"> <div class="header-container">
<h2 class="title">{{ 'clientDetailsTitle' | translate }} {{ clientData.name }}</h2> <h2 class="title">{{ 'clientDetailsTitle' | translate }} {{ clientData.name }}</h2>
</div> </div>
<mat-divider></mat-divider> <div class="client-info-card">
<div class="info-columns">
<div class="info-column">
<div class="info-pair" *ngFor="let data of generalData">
<div class="label">{{ data?.property }}</div>
<div class="value">{{ data?.value || '--' }}</div>
</div>
</div>
<div class="info-column">
<div class="info-pair" *ngFor="let data of networkData">
<div class="label">{{ data?.property }}</div>
<div class="value">{{ data?.value || '--' }}</div>
</div>
</div>
</div>
</div>
<div *ngIf="!loading" class="client-info"> <div class="section-header">
<div class="info-section">
<div class="two-column-table">
<div class="table-row" *ngFor="let clientData of generalData">
<div class="column property">{{ clientData?.property }}</div>
<div class="column value">{{ clientData?.value }}</div>
</div>
</div>
<div class="two-column-table">
<div class="table-row" *ngFor="let clientData of networkData">
<div class="column property">{{ clientData?.property }}</div>
<div class="column value">{{ clientData?.value }}</div>
</div>
</div>
</div>
</div>
<div class="header-container">
<h2 class="title" i18n="@@adminImagesTitle">Discos/Particiones</h2> <h2 class="title" i18n="@@adminImagesTitle">Discos/Particiones</h2>
</div> </div>
@ -53,7 +53,6 @@
<div *ngFor="let disk of chartDisk" class="disk-usage"> <div *ngFor="let disk of chartDisk" class="disk-usage">
<ngx-charts-pie-chart class="chart" [view]="view" [results]="disk.chartData" [doughnut]="true"> <ngx-charts-pie-chart class="chart" [view]="view" [results]="disk.chartData" [doughnut]="true">
</ngx-charts-pie-chart> </ngx-charts-pie-chart>
<h3>Disco {{ disk.diskNumber }}</h3> <h3>Disco {{ disk.diskNumber }}</h3>
<p>Usado: {{ (disk.used).toFixed(2) }} GB ({{ disk.percentage }}%)</p> <p>Usado: {{ (disk.used).toFixed(2) }} GB ({{ disk.percentage }}%)</p>
<p>Total: {{ disk.total }} GB</p> <p>Total: {{ disk.total }} GB</p>
@ -62,3 +61,4 @@
</div> </div>
</div> </div>
</div> </div>
</mat-dialog-content>

View File

@ -198,7 +198,6 @@ export class ClientDetailsComponent {
}); });
this.diskUsageData = this.chartDisk; this.diskUsageData = this.chartDisk;
console.log(this.chartDisk)
this.isDiskUsageEmpty = this.diskUsageData.length === 0; this.isDiskUsageEmpty = this.diskUsageData.length === 0;
} }
@ -216,11 +215,9 @@ export class ClientDetailsComponent {
this.http.get<any>(`${this.baseUrl}/partitions?client.id=${this.clientData.id}&order[diskNumber, partitionNumber]=ASC`).subscribe({ this.http.get<any>(`${this.baseUrl}/partitions?client.id=${this.clientData.id}&order[diskNumber, partitionNumber]=ASC`).subscribe({
next: data => { next: data => {
console.log(data)
const filteredPartitions = data['hydra:member'].filter((partition: any) => partition.partitionNumber !== 0); const filteredPartitions = data['hydra:member'].filter((partition: any) => partition.partitionNumber !== 0);
this.dataSource = filteredPartitions; this.dataSource = filteredPartitions;
this.partitions = filteredPartitions; this.partitions = filteredPartitions;
console.log(this.partitions)
this.calculateDiskUsage(); this.calculateDiskUsage();
}, },
error: error => { error: error => {