From f66d2fa42ddce5350a19d200ac9fbbb07f45c704 Mon Sep 17 00:00:00 2001 From: insanity Date: Fri, 13 Apr 2018 17:59:48 +0900 Subject: [PATCH] sensor config bug fix --- .../sensor/component/list/list.component.html | 4 ++-- .../sensor/component/list/list.component.ts | 5 +--- .../component/setting/setting.component.html | 2 +- .../component/setting/setting.component.ts | 18 ++++++++++----- .../target-selector.component.ts | 23 ++++++------------- 5 files changed, 23 insertions(+), 29 deletions(-) diff --git a/src/packages/sensor/component/list/list.component.html b/src/packages/sensor/component/list/list.component.html index 7bc6f26..8aa8633 100644 --- a/src/packages/sensor/component/list/list.component.html +++ b/src/packages/sensor/component/list/list.component.html @@ -1,6 +1,6 @@
- - + + diff --git a/src/packages/sensor/component/list/list.component.ts b/src/packages/sensor/component/list/list.component.ts index cf43a2e..0d8d96b 100644 --- a/src/packages/sensor/component/list/list.component.ts +++ b/src/packages/sensor/component/list/list.component.ts @@ -28,7 +28,6 @@ export class ListComponent implements OnInit, AfterContentInit { sensorSettingDisplay = false; target: Target = null; - isAllTarget = false; constructor(private router: Router, private store: Store, @@ -74,12 +73,11 @@ export class ListComponent implements OnInit, AfterContentInit { } onAddSensor() { - this.isAllTarget = true; + this.target = null; this.sensorSettingDisplay = true; } onAddSensorWithTarget() { - this.isAllTarget = false; this.target = { id: 1, createDate: new Date(), @@ -90,7 +88,6 @@ export class ListComponent implements OnInit, AfterContentInit { } onAddSensorWithTarget2() { - this.isAllTarget = false; this.target = { id: 2, createDate: new Date(), diff --git a/src/packages/sensor/component/setting/setting.component.html b/src/packages/sensor/component/setting/setting.component.html index 17e8fe5..51c05eb 100644 --- a/src/packages/sensor/component/setting/setting.component.html +++ b/src/packages/sensor/component/setting/setting.component.html @@ -1,7 +1,7 @@
- +
diff --git a/src/packages/sensor/component/setting/setting.component.ts b/src/packages/sensor/component/setting/setting.component.ts index cd9960c..892f516 100644 --- a/src/packages/sensor/component/setting/setting.component.ts +++ b/src/packages/sensor/component/setting/setting.component.ts @@ -18,19 +18,20 @@ import { TreeNode } from 'primeng/primeng'; }) export class SettingComponent implements OnInit, DoCheck, OnChanges { - @Input() visible: boolean; - - @Input() isAllTarget: boolean; - @Input() selectedTarget: Target; + @Input() preTarget: Target; @Output() close = new EventEmitter(); + nextable = false; - sensorItemKeys$ = this.keyListStore.pipe(select(ReadSensorItemKeySelector.select('list'))); + selectedTarget: Target; selectedCrawler: MetaCrawler; credentialPassed: boolean; selectedSensorDisplayItems: MetaSensorDisplayItem[]; itemNodes: TreeNode[]; step = 1; + sensorItemKeys$ = this.keyListStore.pipe(select(ReadSensorItemKeySelector.select('list'))); + + constructor( private keyListStore: Store, ) { @@ -49,7 +50,8 @@ export class SettingComponent implements OnInit, DoCheck, OnChanges { // ); } - ngOnChanges() { + ngOnChanges(changes) { + } ngDoCheck() { @@ -71,6 +73,10 @@ export class SettingComponent implements OnInit, DoCheck, OnChanges { } onCancel() { + this.selectedTarget = null; + this.selectedCrawler = null; + this.credentialPassed = false; + this.selectedSensorDisplayItems = null; this.close.emit(); } 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 cbc34a8..1e3560b 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 @@ -18,9 +18,7 @@ export class TargetSelectorComponent implements OnInit, OnChanges { targets$ = this.store.pipe(select(ListSelector.select('page'))); - @Input() visible: boolean; - @Input() target: Target = null; - @Input() isAllTarget: boolean; + @Input() preTarget: Target = null; @Output() targetSelected = new EventEmitter(); targets: Target[] = null; @@ -30,13 +28,6 @@ export class TargetSelectorComponent implements OnInit, OnChanges { ) { } ngOnInit() { - this.targets = new Array(); - if (this.target === null) { - this.getTargetList(); - } else { - this.targets.push(this.target); - } - // this.targets$.subscribe( // (page: Page) => { // if (page !== null) { @@ -50,12 +41,12 @@ export class TargetSelectorComponent implements OnInit, OnChanges { } ngOnChanges(changes) { - // this.targets = new Array(); - // if (this.isAllTarget) { - // this.getTargetList(); - // } else { - // this.targets.push(this.target); - // } + this.targets = []; + if (this.preTarget === null) { + this.getTargetList(); + } else { + this.targets.push(this.preTarget); + } } convertInfraToTarget(page: Page) {