diff --git a/projects/account/src/app/device/device-remove/device-remove.component.html b/projects/account/src/app/device/device-remove/device-remove.component.html new file mode 100644 index 0000000..8bdcca8 --- /dev/null +++ b/projects/account/src/app/device/device-remove/device-remove.component.html @@ -0,0 +1,12 @@ +
Remove Device
+ +
+
+ Just double checking. Device removal cannot be undone. +
+
+ +
+ + +
diff --git a/projects/account/src/app/device/device-remove/device-remove.component.scss b/projects/account/src/app/device/device-remove/device-remove.component.scss new file mode 100644 index 0000000..a2b052e --- /dev/null +++ b/projects/account/src/app/device/device-remove/device-remove.component.scss @@ -0,0 +1,5 @@ +.mat-body{ + margin-bottom: 16px; + width: 250px; +} + diff --git a/projects/account/src/app/device/device-remove/device-remove.component.ts b/projects/account/src/app/device/device-remove/device-remove.component.ts new file mode 100644 index 0000000..5e11372 --- /dev/null +++ b/projects/account/src/app/device/device-remove/device-remove.component.ts @@ -0,0 +1,22 @@ +import {Component, Inject, OnInit} from '@angular/core'; +import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; + +@Component({ + selector: 'account-device-remove', + templateUrl: './device-remove.component.html', + styleUrls: ['./device-remove.component.scss'] +}) +export class DeviceRemoveComponent implements OnInit { + + constructor( + public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data: boolean) { + } + + ngOnInit() { + } + + onCancelClick(): void { + this.dialogRef.close(); + } +} diff --git a/projects/account/src/app/device/device.component.html b/projects/account/src/app/device/device.component.html index 7f22db6..283d80c 100644 --- a/projects/account/src/app/device/device.component.html +++ b/projects/account/src/app/device/device.component.html @@ -94,7 +94,7 @@ Enclosure Version:   1.2.3 - diff --git a/projects/account/src/app/device/device.component.ts b/projects/account/src/app/device/device.component.ts index 4987674..bb5b630 100644 --- a/projects/account/src/app/device/device.component.ts +++ b/projects/account/src/app/device/device.component.ts @@ -1,11 +1,12 @@ import { Component, OnInit } from '@angular/core'; -import {MatDialog} from '@angular/material'; +import { MatDialog } from '@angular/material'; import { faCogs, faPlusCircle, faCaretRight, faTrash } from '@fortawesome/free-solid-svg-icons'; import { DeviceGroupComponent } from './device-group/device-group.component'; -import {DeviceService, Device, DevicePlacement} from './device.service'; -import {DevicePlacementComponent} from './device-placement/device-placement.component'; +import { DeviceService, Device } from './device.service'; +import { DevicePlacementComponent } from './device-placement/device-placement.component'; +import { DeviceRemoveComponent } from './device-remove/device-remove.component'; @Component({ selector: 'account-device', @@ -71,4 +72,14 @@ export class DeviceComponent implements OnInit { } ); } + + onRemovalClick (device: Device) { + const removalDialogRef = this.dialog.open(DeviceRemoveComponent, {data: false}); + this.selectedDevice = device; + removalDialogRef.afterClosed().subscribe( + (result) => { + if (result) { this.deviceService.deleteDevice(device); } + } + ); + } } diff --git a/projects/account/src/app/device/device.module.ts b/projects/account/src/app/device/device.module.ts index 0f23c86..3dd6c4d 100644 --- a/projects/account/src/app/device/device.module.ts +++ b/projects/account/src/app/device/device.module.ts @@ -20,16 +20,19 @@ import { DeviceComponent } from './device.component'; import { DeviceGroupComponent } from './device-group/device-group.component'; import { DevicePlacementComponent } from './device-placement/device-placement.component'; import { DeviceService } from './device.service'; +import { DeviceRemoveComponent } from './device-remove/device-remove.component'; @NgModule({ declarations: [ DeviceComponent, DeviceGroupComponent, - DevicePlacementComponent + DevicePlacementComponent, + DeviceRemoveComponent ], entryComponents: [ DeviceGroupComponent, - DevicePlacementComponent + DevicePlacementComponent, + DeviceRemoveComponent ], imports: [ CommonModule, diff --git a/projects/account/src/app/device/device.service.ts b/projects/account/src/app/device/device.service.ts index 7d895cf..c48572e 100644 --- a/projects/account/src/app/device/device.service.ts +++ b/projects/account/src/app/device/device.service.ts @@ -89,5 +89,9 @@ export class DeviceService { { id: '2', name: 'Living Room', userDefined: true} ]; - constructor() { } + constructor() { } + + deleteDevice(device: Device): void { + console.log('deleting device... '); + } }