diff --git a/src/packages/infra/component/map/map.component.html b/src/packages/infra/component/map/map.component.html index 2607589..c3970d9 100644 --- a/src/packages/infra/component/map/map.component.html +++ b/src/packages/infra/component/map/map.component.html @@ -24,7 +24,7 @@ IP : {{infra.host.ip}} - + @@ -46,7 +46,7 @@
- +
diff --git a/src/packages/infra/component/map/map.component.ts b/src/packages/infra/component/map/map.component.ts index 8654e9e..0757727 100644 --- a/src/packages/infra/component/map/map.component.ts +++ b/src/packages/infra/component/map/map.component.ts @@ -175,8 +175,6 @@ export class MapComponent implements OnInit, AfterContentInit { } addSensor(infra: Infra) { - const targetId = infra.target.id; - const dialogRef = this.dialog.open(SettingComponent, { width: '80%', data: { diff --git a/src/packages/sensor/component/setting/setting.component.html b/src/packages/sensor/component/setting/setting.component.html index 13b4447..fa65809 100644 --- a/src/packages/sensor/component/setting/setting.component.html +++ b/src/packages/sensor/component/setting/setting.component.html @@ -32,6 +32,6 @@ - + \ No newline at end of file diff --git a/src/packages/sensor/component/setting/target-selector/target-selector.component.html b/src/packages/sensor/component/setting/target-selector/target-selector.component.html index 8ebf1bc..2905d56 100644 --- a/src/packages/sensor/component/setting/target-selector/target-selector.component.html +++ b/src/packages/sensor/component/setting/target-selector/target-selector.component.html @@ -9,7 +9,7 @@ - + {{t.displayName}} diff --git a/src/packages/sensor/component/setting/target-selector/target-selector.component.ts b/src/packages/sensor/component/setting/target-selector/target-selector.component.ts index 798dbad..c289ee5 100644 --- a/src/packages/sensor/component/setting/target-selector/target-selector.component.ts +++ b/src/packages/sensor/component/setting/target-selector/target-selector.component.ts @@ -1,8 +1,14 @@ -import { Component, OnInit, Output, EventEmitter, Input } from '@angular/core'; +import { Component, OnInit, Output, EventEmitter, Input, AfterContentInit } from '@angular/core'; import { Router } from '@angular/router'; import { MatRadioButton } from '@angular/material'; import { Target } from 'packages/target/model'; - +import { RPCClientError } from '@loafer/ng-rpc/protocol'; +import { Domain } from 'packages/domain/model'; +import { AuthSelector } from 'packages/member/store'; +import * as ListStore from 'packages/infra/store/list'; +import { ListSelector } from 'packages/infra/store'; +import { Store, select } from '@ngrx/store'; +import { Page, PageParams } from 'app/commons/model'; @Component({ selector: 'of-target-selector', @@ -11,11 +17,16 @@ import { Target } from 'packages/target/model'; }) export class TargetSelectorComponent implements OnInit { + targets$ = this.store.pipe(select(ListSelector.select('page'))); + @Input() target: Target = null; @Output() targetSelectEvent = new EventEmitter(); targets: Target[] = null; - constructor(private router: Router) { } + constructor( + private router: Router, + private store: Store + ) { } ngOnInit() { this.targets = new Array(); @@ -24,10 +35,40 @@ export class TargetSelectorComponent implements OnInit { } else { this.targets.push(this.target); } + + this.targets$.subscribe( + (page: Page) => { + if (page !== null) { + this.convertInfraToTarget(page); + } + }, + (error: RPCClientError) => { + console.log(error.response.message); + } + ); + } + + convertInfraToTarget(page: Page) { + for (const infra of page.content) { + this.targets.push(infra.target); + } } getTargetList() { - console.log('go get infraService.readAllByDomain'); + this.store.select(AuthSelector.select('domain')).subscribe( + (domain: Domain) => { + const pageParams: PageParams = { + pageNo: '0', + countPerPage: '9999', + sortCol: 'id', + sortDirection: 'descending' + }; + this.store.dispatch(new ListStore.ReadAllByDomain({ domain, pageParams })); + }, + (error) => { + console.log(error); + } + ); } targetSelected(t: Target) {