fixed UI issues related to deleting (component is now correctly removed from the dashboard device list).
fixes #69
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
<div *ngIf="!deleted" [ngClass]="{ 'border-green': deviceSummary.device.device_status == 0 && deviceSummary.smart,
|
<div [ngClass]="{ 'border-green': deviceSummary.device.device_status == 0 && deviceSummary.smart,
|
||||||
'border-red': deviceSummary.device.device_status != 0 }"
|
'border-red': deviceSummary.device.device_status != 0 }"
|
||||||
class="relative flex flex-col flex-auto p-6 pr-3 pb-3 bg-card rounded border-l-4 shadow-md overflow-hidden">
|
class="relative flex flex-col flex-auto p-6 pr-3 pb-3 bg-card rounded border-l-4 shadow-md overflow-hidden">
|
||||||
<div class="absolute bottom-0 right-0 w-24 h-24 -m-6">
|
<div class="absolute bottom-0 right-0 w-24 h-24 -m-6">
|
||||||
|
|||||||
+5
-5
@@ -1,4 +1,4 @@
|
|||||||
import {ChangeDetectorRef, Component, Input, OnInit} from '@angular/core';
|
import { Component, Input, Output, OnInit, EventEmitter} from '@angular/core';
|
||||||
import * as moment from "moment";
|
import * as moment from "moment";
|
||||||
import {takeUntil} from "rxjs/operators";
|
import {takeUntil} from "rxjs/operators";
|
||||||
import {AppConfig} from "app/core/config/app.config";
|
import {AppConfig} from "app/core/config/app.config";
|
||||||
@@ -16,7 +16,7 @@ import {DashboardDeviceDeleteDialogComponent} from "app/layout/common/dashboard-
|
|||||||
export class DashboardDeviceComponent implements OnInit {
|
export class DashboardDeviceComponent implements OnInit {
|
||||||
@Input() deviceSummary: any;
|
@Input() deviceSummary: any;
|
||||||
@Input() deviceWWN: string;
|
@Input() deviceWWN: string;
|
||||||
deleted = false;
|
@Output() deviceDeleted = new EventEmitter<string>();
|
||||||
|
|
||||||
config: AppConfig;
|
config: AppConfig;
|
||||||
|
|
||||||
@@ -25,7 +25,6 @@ export class DashboardDeviceComponent implements OnInit {
|
|||||||
constructor(
|
constructor(
|
||||||
private _configService: TreoConfigService,
|
private _configService: TreoConfigService,
|
||||||
public dialog: MatDialog,
|
public dialog: MatDialog,
|
||||||
private cdRef: ChangeDetectorRef,
|
|
||||||
) {
|
) {
|
||||||
// Set the private defaults
|
// Set the private defaults
|
||||||
this._unsubscribeAll = new Subject();
|
this._unsubscribeAll = new Subject();
|
||||||
@@ -97,8 +96,9 @@ export class DashboardDeviceComponent implements OnInit {
|
|||||||
|
|
||||||
dialogRef.afterClosed().subscribe(result => {
|
dialogRef.afterClosed().subscribe(result => {
|
||||||
console.log('The dialog was closed', result);
|
console.log('The dialog was closed', result);
|
||||||
this.deleted = result.success
|
if(result.success){
|
||||||
this.cdRef.detectChanges()
|
this.deviceDeleted.emit(this.deviceWWN)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@
|
|||||||
<div class="flex flex-wrap w-full" *ngFor="let hostId of hostGroups | keyvalue">
|
<div class="flex flex-wrap w-full" *ngFor="let hostId of hostGroups | keyvalue">
|
||||||
<h3 class="ml-4" *ngIf="hostId.key">{{hostId.key}}</h3>
|
<h3 class="ml-4" *ngIf="hostId.key">{{hostId.key}}</h3>
|
||||||
<div class="flex flex-wrap w-full">
|
<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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -229,8 +229,10 @@ export class DashboardComponent implements OnInit, AfterViewInit, OnDestroy
|
|||||||
deviceSummariesForHostGroup(hostGroupWWNs: string[]) {
|
deviceSummariesForHostGroup(hostGroupWWNs: string[]) {
|
||||||
let deviceSummaries = []
|
let deviceSummaries = []
|
||||||
for(let wwn of hostGroupWWNs){
|
for(let wwn of hostGroupWWNs){
|
||||||
|
if(this.data.data.summary[wwn]){
|
||||||
deviceSummaries.push(this.data.data.summary[wwn])
|
deviceSummaries.push(this.data.data.summary[wwn])
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return deviceSummaries
|
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"
|
DURATION_KEY_WEEK = "week"
|
||||||
|
|||||||
Reference in New Issue
Block a user