Skip to content

Commit

Permalink
hide device dashboard component if deletion finishes successfully.
Browse files Browse the repository at this point in the history
  • Loading branch information
AnalogJ committed May 26, 2022
1 parent 987632d commit f51de52
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ export class DashboardDeviceDeleteDialogComponent implements OnInit {
onDeleteClick(): void {
this._deleteService.deleteDevice(this.data.wwn)
.subscribe((data) => {

console.log("Delete status:", data)
this.dialogRef.close(data);
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div [ngClass]="{ 'border-green': deviceSummary.device.device_status == 0 && deviceSummary.smart,
<div *ngIf="!deleted" [ngClass]="{ 'border-green': deviceSummary.device.device_status == 0 && deviceSummary.smart,
'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">
<div class="absolute bottom-0 right-0 w-24 h-24 -m-6">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Component, Input, OnInit} from '@angular/core';
import {ChangeDetectorRef, Component, Input, OnInit} from '@angular/core';
import * as moment from "moment";
import {takeUntil} from "rxjs/operators";
import {AppConfig} from "app/core/config/app.config";
Expand All @@ -16,14 +16,16 @@ import {DashboardDeviceDeleteDialogComponent} from "app/layout/common/dashboard-
export class DashboardDeviceComponent implements OnInit {
@Input() deviceSummary: any;
@Input() deviceWWN: string;
deleted = false;

config: AppConfig;

private _unsubscribeAll: Subject<any>;

constructor(
private _configService: TreoConfigService,
public dialog: MatDialog
public dialog: MatDialog,
private cdRef: ChangeDetectorRef,
) {
// Set the private defaults
this._unsubscribeAll = new Subject();
Expand Down Expand Up @@ -94,7 +96,9 @@ export class DashboardDeviceComponent implements OnInit {
});

dialogRef.afterClosed().subscribe(result => {
console.log('The dialog was closed');
console.log('The dialog was closed', result);
this.deleted = result.success
this.cdRef.detectChanges()
});
}
}
Expand Down

0 comments on commit f51de52

Please sign in to comment.