diff --git a/src/packages/sensor/component/setting/setting.component.html b/src/packages/sensor/component/setting/setting.component.html
index 51c05eb..d9b408f 100644
--- a/src/packages/sensor/component/setting/setting.component.html
+++ b/src/packages/sensor/component/setting/setting.component.html
@@ -1,4 +1,24 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/packages/sensor/component/setting/setting.component.ts b/src/packages/sensor/component/setting/setting.component.ts
index 892f516..f555075 100644
--- a/src/packages/sensor/component/setting/setting.component.ts
+++ b/src/packages/sensor/component/setting/setting.component.ts
@@ -20,6 +20,7 @@ export class SettingComponent implements OnInit, DoCheck, OnChanges {
@Input() preTarget: Target;
@Output() close = new EventEmitter();
+ @Input() visible;
nextable = false;
selectedTarget: Target;
@@ -27,7 +28,7 @@ export class SettingComponent implements OnInit, DoCheck, OnChanges {
credentialPassed: boolean;
selectedSensorDisplayItems: MetaSensorDisplayItem[];
itemNodes: TreeNode[];
- step = 1;
+ step = 0;
sensorItemKeys$ = this.keyListStore.pipe(select(ReadSensorItemKeySelector.select('list')));
@@ -38,6 +39,7 @@ export class SettingComponent implements OnInit, DoCheck, OnChanges {
}
ngOnInit() {
+ this.step = this.preTarget ? 1 : 0;
// this.sensorItemKeys$.subscribe(
// (list: MetaSensorItemKey[]) => {
// if (list !== null) {
@@ -51,7 +53,7 @@ export class SettingComponent implements OnInit, DoCheck, OnChanges {
}
ngOnChanges(changes) {
-
+ this.step = this.preTarget ? 1 : 0;
}
ngDoCheck() {
@@ -73,6 +75,9 @@ export class SettingComponent implements OnInit, DoCheck, OnChanges {
}
onCancel() {
+ this.step = 0;
+ this.visible = false;
+ this.nextable = false;
this.selectedTarget = null;
this.selectedCrawler = null;
this.credentialPassed = false;
@@ -100,14 +105,52 @@ export class SettingComponent implements OnInit, DoCheck, OnChanges {
onTargetSelect(t: Target) {
this.selectedTarget = t;
+ this.step = 1;
}
onCrawlerSelect(c: MetaCrawler) {
this.selectedCrawler = c;
+ this.step = 2;
}
onCredentialPass(b: boolean) {
+ if (!b) {
+ return;
+ }
this.credentialPassed = b;
+ this.step = 3;
}
onItemsSelect(nodes: TreeNode[]) {
this.itemNodes = nodes;
}
+
+ onTabOpen(event) {
+ this.step = event.index;
+ }
+
+ getTitle(index) {
+ if (index === 0 && this.preTarget) {
+ return this.preTarget.displayName;
+ }
+ let title = '';
+ switch (index) {
+ case 0:
+ title = this.selectedTarget && this.step !== index ?
+ this.selectedTarget.displayName :
+ 'Choose a Target to monitor.';
+ break;
+ case 1:
+ title = this.selectedCrawler && this.step !== index ?
+ this.selectedCrawler.name :
+ 'Choose a Crawler.';
+ break;
+ case 2:
+ title = this.credentialPassed && this.step !== index ?
+ 'Credentials test succeed.' :
+ 'Credentials';
+ break;
+ case 3:
+ title = 'Choose Sensor Items.';
+ break;
+ }
+ return title;
+ }
}
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 40bfb31..3fe9451 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
@@ -1,9 +1,10 @@
-
-
-
-
-
{{target.displayName}}
-
-
-
\ No newline at end of file
+
+
+
+
+
+
{{target.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 1e3560b..28a7eec 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
@@ -19,6 +19,7 @@ export class TargetSelectorComponent implements OnInit, OnChanges {
targets$ = this.store.pipe(select(ListSelector.select('page')));
@Input() preTarget: Target = null;
+ @Input() visible;
@Output() targetSelected = new EventEmitter
();
targets: Target[] = null;
@@ -46,6 +47,7 @@ export class TargetSelectorComponent implements OnInit, OnChanges {
this.getTargetList();
} else {
this.targets.push(this.preTarget);
+ this.targetSelected.emit(this.preTarget);
}
}