adding group by hostId support in dashboard.

fixes #151
pull/262/head
Jason Kulatunga 3 years ago
parent 85fa3b1f8f
commit 83839f7faf

@ -47,10 +47,15 @@
</div>
</div>
<div class="flex flex-wrap w-full">
<app-dashboard-device class="flex gt-sm:w-1/2 min-w-80 p-4" *ngFor="let summary of data.data.summary | keyvalue" [deviceWWN]="summary.key" [deviceSummary]="summary.value"></app-dashboard-device>
<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 wwn of hostId.value" [deviceWWN]="wwn" [deviceSummary]="data.data.summary[wwn]"></app-dashboard-device>
</div>
</div>
<!-- Drive Temperatures -->
<div class="flex flex-auto w-full min-w-80 h-90 p-4">
<div class="flex flex-col flex-auto bg-card shadow-md rounded overflow-hidden">

@ -22,6 +22,7 @@ import {Router} from "@angular/router";
export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy
{
data: any;
hostGroups: { [hostId: string]: string[] } = {}
temperatureOptions: ApexOptions;
tempDurationKey: string = "forever"
config: AppConfig;
@ -86,6 +87,15 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy
// Store the data
this.data = data;
//generate group data.
for(let wwn in this.data.data.summary){
let hostid = this.data.data.summary[wwn].device.host_id
let hostDeviceList = this.hostGroups[hostid] || []
hostDeviceList.push(wwn)
this.hostGroups[hostid] = hostDeviceList
}
console.log(this.hostGroups)
// Prepare the chart data
this._prepareChartData();
});

Loading…
Cancel
Save