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>
<p-dialog [modal]="true" [width]="800" [(visible)]="sensorSettingDisplay" [showHeader]="false">
<of-sensor-setting [visible]="sensorSettingDisplay" [isAllTarget]="isAllTarget" [selectedTarget]="target" (close)="onSensorSettingClose()"></of-sensor-setting>
<p-dialog [modal]="true" [width]="800" [(visible)]="sensorSettingDisplay" [showHeader]="false" [closeOnEscape]="false">
<of-sensor-setting [preTarget]="target" (close)="onSensorSettingClose()"></of-sensor-setting>
</p-dialog>
<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;
target: Target = null;
isAllTarget = false;
constructor(private router: Router,
private store: Store<ListStore.State>,
@ -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(),

View File

@ -1,7 +1,7 @@
<div [hidden]="step !== 1">
<div class="ui-g">
<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 class="ui-g-6">
<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 {
@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<SensorItemKeyListStore.State>,
) {
@ -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();
}

View File

@ -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<Target>();
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) {