fix(inventory): add disk type badge to client details and partition selector views
parent
41b0974608
commit
4154e18ab6
|
|
@ -191,6 +191,17 @@ table {
|
|||
color: #3f51b5;
|
||||
font-weight: bold;
|
||||
}
|
||||
.badge-disk-type {
|
||||
display: inline-block;
|
||||
padding: 2px 6px;
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
background-color: #607d8b;
|
||||
border-radius: 4px;
|
||||
margin-left: 8px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.disk-card-metrics-wrapper {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
|
|
|||
|
|
@ -46,7 +46,11 @@
|
|||
<div class="disk-card-wrapper">
|
||||
<mat-card class="disk-mat-card mat-elevation-z4">
|
||||
<div class="disk-card-header">
|
||||
<h3 class="disk-card-title">Disco {{ disk.diskNumber }}</h3>
|
||||
<h3 class="disk-card-title">Disco {{ disk.diskNumber }}
|
||||
@if (disk.diskType) {
|
||||
<span class="badge-disk-type">{{ disk.diskType }}</span>
|
||||
}
|
||||
</h3>
|
||||
<div class="disk-card-metrics-wrapper">
|
||||
<mat-chip class="disk-card-metrics-chip">
|
||||
Total: {{ disk.total.toFixed(2) }} GB | Usado: {{ (disk.used).toFixed(2) }} GB ({{
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ export class ClientDetailsComponent {
|
|||
}
|
||||
|
||||
calculateDiskUsage() {
|
||||
const diskUsageMap = new Map<number, { total: number, used: number, partitions: any[] }>();
|
||||
const diskUsageMap = new Map<number, { total: number, used: number, partitions: any[], diskType?: string }>();
|
||||
|
||||
this.partitions.forEach((partition: any) => {
|
||||
const diskNumber = partition.diskNumber;
|
||||
|
|
@ -146,13 +146,14 @@ export class ClientDetailsComponent {
|
|||
|
||||
if (partition.partitionNumber === 0) {
|
||||
diskData!.total = Number((partition.size / 1024).toFixed(2));
|
||||
diskData!.diskType = partition.diskType;
|
||||
} else {
|
||||
diskData!.used += Number((partition.size / 1024).toFixed(2));
|
||||
diskData!.partitions.push(partition);
|
||||
}
|
||||
});
|
||||
|
||||
this.chartDisk = Array.from(diskUsageMap.entries()).map(([diskNumber, { total, used, partitions }]) => {
|
||||
this.chartDisk = Array.from(diskUsageMap.entries()).map(([diskNumber, { total, used, partitions, diskType }]) => {
|
||||
const partitionData = partitions.map(partition => ({
|
||||
name: `${this.translate.instant('labelPartition')} ${partition.partitionNumber}`,
|
||||
value: Number((partition.size / 1024).toFixed(2))
|
||||
|
|
@ -172,7 +173,8 @@ export class ClientDetailsComponent {
|
|||
total,
|
||||
used,
|
||||
percentage: total > 0 ? Math.round((used / total) * 100) : 0,
|
||||
partitions
|
||||
partitions,
|
||||
diskType
|
||||
};
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,18 @@
|
|||
font-weight: bold;
|
||||
}
|
||||
|
||||
.badge-disk-type {
|
||||
display: inline-block;
|
||||
padding: 2px 6px;
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
background-color: #607d8b;
|
||||
border-radius: 4px;
|
||||
margin-left: 8px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.disk-card-layout {
|
||||
display: flex;
|
||||
align-items: stretch;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,11 @@
|
|||
<div class="disk-card-wrapper">
|
||||
<mat-card class="disk-mat-card mat-elevation-z4">
|
||||
<div class="disk-card-header">
|
||||
<h3 class="disk-card-title">Disco {{ disk.diskNumber }}</h3>
|
||||
<h3 class="disk-card-title">Disco {{ disk.diskNumber }}
|
||||
@if (disk.diskType) {
|
||||
<span class="badge-disk-type">{{ disk.diskType }}</span>
|
||||
}
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="disk-card-layout">
|
||||
|
|
|
|||
|
|
@ -43,9 +43,12 @@ export class DiskPartitionSelectorComponent implements OnChanges {
|
|||
|
||||
for (const diskNum in grouped) {
|
||||
if (grouped.hasOwnProperty(diskNum)) {
|
||||
const diskPartitions = grouped[diskNum];
|
||||
const partitionZero = diskPartitions.find((p: any) => p.partitionNumber === 0);
|
||||
this.diskUsageData.push({
|
||||
diskNumber: diskNum,
|
||||
partitions: grouped[diskNum]
|
||||
partitions: diskPartitions,
|
||||
diskType: partitionZero ? partitionZero.diskType : undefined
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue