From 47428f8ec552884d062fb713197a0f6e0b287822 Mon Sep 17 00:00:00 2001 From: insanity Date: Wed, 7 Mar 2018 17:49:39 +0900 Subject: [PATCH] probe.. --- .../component/detail/detail.component.html | 4 +-- .../component/detail/detail.component.ts | 13 +++++++++- .../remove-warning-dialog.component.html | 5 ++++ .../remove-warning-dialog.component.scss | 0 .../remove-warning-dialog.component.spec.ts | 25 +++++++++++++++++++ .../remove-warning-dialog.component.ts | 21 ++++++++++++++++ src/packages/probe/component/index.ts | 2 ++ .../probe/component/list/list.component.ts | 20 +++++++++------ src/packages/probe/probe.module.ts | 4 +++ 9 files changed, 84 insertions(+), 10 deletions(-) create mode 100644 src/packages/probe/component/detail/remove-warning-dialog/remove-warning-dialog.component.html create mode 100644 src/packages/probe/component/detail/remove-warning-dialog/remove-warning-dialog.component.scss create mode 100644 src/packages/probe/component/detail/remove-warning-dialog/remove-warning-dialog.component.spec.ts create mode 100644 src/packages/probe/component/detail/remove-warning-dialog/remove-warning-dialog.component.ts diff --git a/src/packages/probe/component/detail/detail.component.html b/src/packages/probe/component/detail/detail.component.html index cd2fb84..7992ad1 100644 --- a/src/packages/probe/component/detail/detail.component.html +++ b/src/packages/probe/component/detail/detail.component.html @@ -1,4 +1,4 @@ -
{{probeId}}
+

{{probeAlias}}

Status: UP @@ -10,7 +10,7 @@
-
+
diff --git a/src/packages/probe/component/detail/detail.component.ts b/src/packages/probe/component/detail/detail.component.ts index d3f017e..6070e20 100644 --- a/src/packages/probe/component/detail/detail.component.ts +++ b/src/packages/probe/component/detail/detail.component.ts @@ -1,6 +1,7 @@ import { Component, OnInit, Inject } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; +import { RemoveWarningComponent } from './remove-warning-dialog/remove-warning-dialog.component'; @Component({ selector: 'of-probe-detail', @@ -9,6 +10,7 @@ import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; }) export class DetailComponent implements OnInit { + probeAlias = ''; probeId = undefined; isUpState = false; @@ -38,6 +40,7 @@ export class DetailComponent implements OnInit { ngOnInit() { this.probeId = this.route.snapshot.paramMap.get('id'); + this.probeAlias = 'Probe Alias 블라블라'; } handleStartStop() { @@ -45,7 +48,15 @@ export class DetailComponent implements OnInit { } handleRemove() { - console.log('remove'); + const dialogRef = this.dialog.open(RemoveWarningComponent, { + width: '250px', + data: { } + }); + + dialogRef.afterClosed().subscribe(result => { + console.log(result); + // 삭제 후 list로 back + }); } } diff --git a/src/packages/probe/component/detail/remove-warning-dialog/remove-warning-dialog.component.html b/src/packages/probe/component/detail/remove-warning-dialog/remove-warning-dialog.component.html new file mode 100644 index 0000000..3c72353 --- /dev/null +++ b/src/packages/probe/component/detail/remove-warning-dialog/remove-warning-dialog.component.html @@ -0,0 +1,5 @@ +
레알루다가? 다 지워질건데?
+
+ + +
\ No newline at end of file diff --git a/src/packages/probe/component/detail/remove-warning-dialog/remove-warning-dialog.component.scss b/src/packages/probe/component/detail/remove-warning-dialog/remove-warning-dialog.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/packages/probe/component/detail/remove-warning-dialog/remove-warning-dialog.component.spec.ts b/src/packages/probe/component/detail/remove-warning-dialog/remove-warning-dialog.component.spec.ts new file mode 100644 index 0000000..4a6e131 --- /dev/null +++ b/src/packages/probe/component/detail/remove-warning-dialog/remove-warning-dialog.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { RemoveWarningComponent } from './remove-warning-dialog.component'; + +describe('RemoveWarningComponent', () => { + let component: RemoveWarningComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ RemoveWarningComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(RemoveWarningComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/packages/probe/component/detail/remove-warning-dialog/remove-warning-dialog.component.ts b/src/packages/probe/component/detail/remove-warning-dialog/remove-warning-dialog.component.ts new file mode 100644 index 0000000..6f64d9f --- /dev/null +++ b/src/packages/probe/component/detail/remove-warning-dialog/remove-warning-dialog.component.ts @@ -0,0 +1,21 @@ +import { Component, OnInit, Input } from '@angular/core'; +import { MatDialogRef } from '@angular/material'; + +@Component({ + selector: 'of-remove-warning-dialog', + templateUrl: './remove-warning-dialog.component.html', + styleUrls: ['./remove-warning-dialog.component.scss'] +}) +export class RemoveWarningComponent implements OnInit { + + constructor( + public dialogRef: MatDialogRef + ) { } + + ngOnInit() { + } + + onClick(res: boolean) { + this.dialogRef.close(res); + } +} diff --git a/src/packages/probe/component/index.ts b/src/packages/probe/component/index.ts index 4efee54..1342a95 100644 --- a/src/packages/probe/component/index.ts +++ b/src/packages/probe/component/index.ts @@ -1,9 +1,11 @@ import { DetailComponent } from './detail/detail.component'; import { ListComponent } from './list/list.component'; import { DownloadComponent } from './download/download.component'; +import { RemoveWarningComponent } from './detail/remove-warning-dialog/remove-warning-dialog.component'; export const COMPONENTS = [ ListComponent, DetailComponent, DownloadComponent, + RemoveWarningComponent ]; diff --git a/src/packages/probe/component/list/list.component.ts b/src/packages/probe/component/list/list.component.ts index 6cdbdc2..c994fb2 100644 --- a/src/packages/probe/component/list/list.component.ts +++ b/src/packages/probe/component/list/list.component.ts @@ -3,7 +3,9 @@ import { MatTableDataSource, MatSort } from '@angular/material'; import { AfterContentInit } from '@angular/core/src/metadata/lifecycle_hooks'; import { Router } from '@angular/router'; import { Probe } from '../../model'; - +import { Store } from '@ngrx/store'; +import * as ListStore from '../../store/list'; +import { Domain } from '../../../domain/model'; @Component({ selector: 'of-probe-list', @@ -16,11 +18,17 @@ export class ListComponent implements OnInit, AfterContentInit { dataSource: MatTableDataSource; @ViewChild(MatSort) sort: MatSort; - /** - * Set the sort after the view init since this component will - * be able to query its view for the initialized sort. - */ + constructor( + private router: Router, + private store: Store + ) { } + ngAfterContentInit() { + // const domain: Domain = { + // id: 1, + // }; + // this.store.dispatch(new ListStore.ReadAllByDomain(domain)); + // temporary data const data: Probe[] = new Array(); for (let i = 0; i < 10; i++) { @@ -51,8 +59,6 @@ export class ListComponent implements OnInit, AfterContentInit { this.dataSource.sort = this.sort; } - constructor(private router: Router) { } - ngOnInit() { } diff --git a/src/packages/probe/probe.module.ts b/src/packages/probe/probe.module.ts index 0acbb83..f819d07 100644 --- a/src/packages/probe/probe.module.ts +++ b/src/packages/probe/probe.module.ts @@ -6,6 +6,7 @@ import { InfoTableModule } from 'app/commons/component/info-table/info-table.mod import { COMPONENTS } from './component'; import { ProbeStoreModule } from './probe-store.module'; import { SERVICES } from './service'; +import { RemoveWarningComponent } from './component/detail/remove-warning-dialog/remove-warning-dialog.component'; @NgModule({ imports: [ @@ -23,5 +24,8 @@ import { SERVICES } from './service'; providers: [ SERVICES, ], + entryComponents: [ + RemoveWarningComponent, + ] }) export class ProbeModule { }