sensor config bug fix

This commit is contained in:
insanity 2018-04-13 17:59:48 +09:00
parent f1f95df754
commit f66d2fa42d
5 changed files with 23 additions and 29 deletions

View File

@ -1,6 +1,6 @@
<div> <div>
<p-dialog [modal]="true" [width]="800" [(visible)]="sensorSettingDisplay" [showHeader]="false"> <p-dialog [modal]="true" [width]="800" [(visible)]="sensorSettingDisplay" [showHeader]="false" [closeOnEscape]="false">
<of-sensor-setting [visible]="sensorSettingDisplay" [isAllTarget]="isAllTarget" [selectedTarget]="target" (close)="onSensorSettingClose()"></of-sensor-setting> <of-sensor-setting [preTarget]="target" (close)="onSensorSettingClose()"></of-sensor-setting>
</p-dialog> </p-dialog>
<button type="button" label="Add Sensor" icon="ui-icon-add" pButton (click)="onAddSensor()"></button> <button type="button" label="Add Sensor" icon="ui-icon-add" pButton (click)="onAddSensor()"></button>

View File

@ -28,7 +28,6 @@ export class ListComponent implements OnInit, AfterContentInit {
sensorSettingDisplay = false; sensorSettingDisplay = false;
target: Target = null; target: Target = null;
isAllTarget = false;
constructor(private router: Router, constructor(private router: Router,
private store: Store<ListStore.State>, private store: Store<ListStore.State>,
@ -74,12 +73,11 @@ export class ListComponent implements OnInit, AfterContentInit {
} }
onAddSensor() { onAddSensor() {
this.isAllTarget = true; this.target = null;
this.sensorSettingDisplay = true; this.sensorSettingDisplay = true;
} }
onAddSensorWithTarget() { onAddSensorWithTarget() {
this.isAllTarget = false;
this.target = { this.target = {
id: 1, id: 1,
createDate: new Date(), createDate: new Date(),
@ -90,7 +88,6 @@ export class ListComponent implements OnInit, AfterContentInit {
} }
onAddSensorWithTarget2() { onAddSensorWithTarget2() {
this.isAllTarget = false;
this.target = { this.target = {
id: 2, id: 2,
createDate: new Date(), createDate: new Date(),

View File

@ -1,7 +1,7 @@
<div [hidden]="step !== 1"> <div [hidden]="step !== 1">
<div class="ui-g"> <div class="ui-g">
<div class="ui-g-6"> <div class="ui-g-6">
<of-target-selector [visible]="visible" [target]="selectedTarget" (targetSelected)="onTargetSelect($event)" [isAllTarget]="isAllTarget"></of-target-selector> <of-target-selector [preTarget]="preTarget" (targetSelected)="onTargetSelect($event)"></of-target-selector>
</div> </div>
<div class="ui-g-6"> <div class="ui-g-6">
<of-crawler-auth [crawler]="selectedCrawler" (credentialPassed)="onCredentialPass($event)"></of-crawler-auth> <of-crawler-auth [crawler]="selectedCrawler" (credentialPassed)="onCredentialPass($event)"></of-crawler-auth>

View File

@ -18,19 +18,20 @@ import { TreeNode } from 'primeng/primeng';
}) })
export class SettingComponent implements OnInit, DoCheck, OnChanges { export class SettingComponent implements OnInit, DoCheck, OnChanges {
@Input() visible: boolean; @Input() preTarget: Target;
@Input() isAllTarget: boolean;
@Input() selectedTarget: Target;
@Output() close = new EventEmitter(); @Output() close = new EventEmitter();
nextable = false; nextable = false;
sensorItemKeys$ = this.keyListStore.pipe(select(ReadSensorItemKeySelector.select('list'))); selectedTarget: Target;
selectedCrawler: MetaCrawler; selectedCrawler: MetaCrawler;
credentialPassed: boolean; credentialPassed: boolean;
selectedSensorDisplayItems: MetaSensorDisplayItem[]; selectedSensorDisplayItems: MetaSensorDisplayItem[];
itemNodes: TreeNode[]; itemNodes: TreeNode[];
step = 1; step = 1;
sensorItemKeys$ = this.keyListStore.pipe(select(ReadSensorItemKeySelector.select('list')));
constructor( constructor(
private keyListStore: Store<SensorItemKeyListStore.State>, private keyListStore: Store<SensorItemKeyListStore.State>,
) { ) {
@ -49,7 +50,8 @@ export class SettingComponent implements OnInit, DoCheck, OnChanges {
// ); // );
} }
ngOnChanges() { ngOnChanges(changes) {
} }
ngDoCheck() { ngDoCheck() {
@ -71,6 +73,10 @@ export class SettingComponent implements OnInit, DoCheck, OnChanges {
} }
onCancel() { onCancel() {
this.selectedTarget = null;
this.selectedCrawler = null;
this.credentialPassed = false;
this.selectedSensorDisplayItems = null;
this.close.emit(); this.close.emit();
} }

View File

@ -18,9 +18,7 @@ export class TargetSelectorComponent implements OnInit, OnChanges {
targets$ = this.store.pipe(select(ListSelector.select('page'))); targets$ = this.store.pipe(select(ListSelector.select('page')));
@Input() visible: boolean; @Input() preTarget: Target = null;
@Input() target: Target = null;
@Input() isAllTarget: boolean;
@Output() targetSelected = new EventEmitter<Target>(); @Output() targetSelected = new EventEmitter<Target>();
targets: Target[] = null; targets: Target[] = null;
@ -30,13 +28,6 @@ export class TargetSelectorComponent implements OnInit, OnChanges {
) { } ) { }
ngOnInit() { ngOnInit() {
this.targets = new Array();
if (this.target === null) {
this.getTargetList();
} else {
this.targets.push(this.target);
}
// this.targets$.subscribe( // this.targets$.subscribe(
// (page: Page) => { // (page: Page) => {
// if (page !== null) { // if (page !== null) {
@ -50,12 +41,12 @@ export class TargetSelectorComponent implements OnInit, OnChanges {
} }
ngOnChanges(changes) { ngOnChanges(changes) {
// this.targets = new Array(); this.targets = [];
// if (this.isAllTarget) { if (this.preTarget === null) {
// this.getTargetList(); this.getTargetList();
// } else { } else {
// this.targets.push(this.target); this.targets.push(this.preTarget);
// } }
} }
convertInfraToTarget(page: Page) { convertInfraToTarget(page: Page) {