fixed UI issues related to deleting (component is now correctly removed from the dashboard device list).

fixes #69
This commit is contained in:
Jason Kulatunga
2022-05-26 00:16:13 -07:00
parent f51de52ff7
commit da4562d308
4 changed files with 14 additions and 8 deletions
@@ -51,7 +51,7 @@
<div class="flex flex-wrap w-full" *ngFor="let hostId of hostGroups | keyvalue">
<h3 class="ml-4" *ngIf="hostId.key">{{hostId.key}}</h3>
<div class="flex flex-wrap w-full">
<app-dashboard-device class="flex gt-sm:w-1/2 min-w-80 p-4" *ngFor="let deviceSummary of (deviceSummariesForHostGroup(hostId.value) | deviceSort:config.dashboardSort:config.dashboardDisplay )" [deviceWWN]="deviceSummary.device.wwn" [deviceSummary]="deviceSummary"></app-dashboard-device>
<app-dashboard-device (deviceDeleted)="onDeviceDeleted($event)" class="flex gt-sm:w-1/2 min-w-80 p-4" *ngFor="let deviceSummary of (deviceSummariesForHostGroup(hostId.value) | deviceSort:config.dashboardSort:config.dashboardDisplay )" [deviceWWN]="deviceSummary.device.wwn" [deviceSummary]="deviceSummary"></app-dashboard-device>
</div>
</div>
@@ -229,7 +229,9 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy
deviceSummariesForHostGroup(hostGroupWWNs: string[]) {
let deviceSummaries = []
for(let wwn of hostGroupWWNs){
deviceSummaries.push(this.data.data.summary[wwn])
if(this.data.data.summary[wwn]){
deviceSummaries.push(this.data.data.summary[wwn])
}
}
return deviceSummaries
}
@@ -242,6 +244,10 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy
});
}
onDeviceDeleted(wwn: string) {
delete this.data.data.summary[wwn] // remove the device from the summary list.
}
/*
DURATION_KEY_WEEK = "week"