auth
This commit is contained in:
parent
9b70c21822
commit
07b2d08483
|
@ -1,6 +1,6 @@
|
|||
<nav mat-tab-nav-bar>
|
||||
<a mat-tab-link *ngFor="let tab of tabs" [routerLink]="tab.path" routerLinkActive #rla="routerLinkActive" [routerLinkActiveOptions]="{exact: true}"
|
||||
[active]="rla.isActive" l10nTranslate>
|
||||
[active]="rla.isActive" >
|
||||
{{ tab.label }}
|
||||
</a>
|
||||
</nav>
|
|
@ -5,15 +5,30 @@
|
|||
<mat-card-subtitle>Crawler 인증</mat-card-subtitle>
|
||||
</mat-card-header>
|
||||
|
||||
|
||||
|
||||
<!-- case 4: // BOOLEAN_TYPE
|
||||
break;
|
||||
case 5: // SELECT_TYPE
|
||||
-->
|
||||
<mat-card-content>
|
||||
<perfect-scrollbar style="height: 150px">
|
||||
크롤러 인증해야 됨
|
||||
<div *ngFor="let inputItem of inputItems">
|
||||
<mat-form-field>
|
||||
<input *ngIf="inputItem.inputType.id == 1" matInput type="text" placeholder={{inputItem.name}}>
|
||||
<input *ngIf="inputItem.inputType.id == 2" matInput type="password" placeholder={{inputItem.name}}>
|
||||
<input *ngIf="inputItem.inputType.id == 1" matInput type="text" placeholder={{inputItem.name}} required={{inputItem.required}}>
|
||||
<input *ngIf="inputItem.inputType.id == 2" matInput type="password" placeholder={{inputItem.name}} required={{inputItem.required}}>
|
||||
<input *ngIf="inputItem.inputType.id == 3" matInput type="number" placeholder={{inputItem.name}} required={{inputItem.required}}>
|
||||
|
||||
<input *ngIf="inputItem.inputType.id == 4" matInput type="text" placeholder={{inputItem.name}} required={{inputItem.required}}>
|
||||
|
||||
<mat-select *ngIf="inputItem.inputType.id == 5" placeholder={{inputItem.name}}>
|
||||
<mat-option *ngFor="let option of inputItem.keyValue.split('|')" value="option">{{option}}</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div fxLayoutAlign="end">
|
||||
<button mat-raised-button (click)="testConnect()" color="primary">Test</button>
|
||||
</div>
|
||||
</perfect-scrollbar>
|
||||
</mat-card-content>
|
||||
</mat-card>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Component, OnInit, Input, OnChanges } from '@angular/core';
|
||||
import { Component, OnInit, Input, OnChanges, Output, EventEmitter } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { MetaCrawler } from '../../../../meta/crawler/model/MetaCrawler';
|
||||
|
||||
|
@ -6,7 +6,7 @@ import { Store, select } from '@ngrx/store';
|
|||
import { RPCError } from 'packages/core/rpc/error';
|
||||
import * as ListStore from 'packages/meta/crawler-input-item/store/list';
|
||||
import { ReadCrawlerInputItemSelector } from 'packages/meta/crawler-input-item/store';
|
||||
import { MetaCrawlerInputItem } from '../../../../meta/crawler-input-item/model/MetaCrawlerInputItem';
|
||||
import { MetaCrawlerInputItem } from 'packages/meta/crawler-input-item/model/MetaCrawlerInputItem';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -19,6 +19,8 @@ export class CrawlerAuthComponent implements OnInit, OnChanges {
|
|||
inputItems$ = this.listStore.pipe(select(ReadCrawlerInputItemSelector.select('inputs')));
|
||||
inputItems: MetaCrawlerInputItem[];
|
||||
|
||||
@Output() testPassEvent = new EventEmitter<boolean>();
|
||||
|
||||
@Input() selectedCrawler: MetaCrawler;
|
||||
constructor(
|
||||
private router: Router,
|
||||
|
@ -29,8 +31,10 @@ export class CrawlerAuthComponent implements OnInit, OnChanges {
|
|||
this.inputItems$.subscribe(
|
||||
(list: MetaCrawlerInputItem[]) => {
|
||||
if (list !== null) {
|
||||
if (this.inputItems !== list) {
|
||||
this.testPassEvent.emit(false);
|
||||
}
|
||||
this.inputItems = list;
|
||||
this.generateAuthComponent();
|
||||
}
|
||||
},
|
||||
(error: RPCError) => {
|
||||
|
@ -46,35 +50,19 @@ export class CrawlerAuthComponent implements OnInit, OnChanges {
|
|||
|
||||
getCrawlerAuthInputItems() {
|
||||
this.listStore.dispatch(new ListStore.ReadAll(this.selectedCrawler));
|
||||
}
|
||||
}
|
||||
|
||||
generateAuthComponent() {
|
||||
// inputType: MetaInputType;
|
||||
// crawler: MetaCrawler;
|
||||
// description: string;
|
||||
// name: string;
|
||||
// createDate: Date;
|
||||
// required: boolean;
|
||||
// defaultValue: string;
|
||||
// pattern: string;
|
||||
// keyName: string;
|
||||
// keyValue: string;
|
||||
for (const inputItem of this.inputItems) {
|
||||
const typeId = inputItem.inputType.id;
|
||||
switch (typeId) {
|
||||
case 1: // TEXT_TYPE
|
||||
break;
|
||||
case 2: // PASSWORD_TYPE
|
||||
break;
|
||||
case 3: // NUMBER_TYPE
|
||||
break;
|
||||
case 4: // BOOLEAN_TYPE
|
||||
break;
|
||||
case 5: // SELECT_TYPE
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
testConnect() {
|
||||
switch (this.selectedCrawler.id) {
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
this.testPassEvent.emit(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
</mat-grid-tile>
|
||||
|
||||
<mat-grid-tile [colspan]="1" [rowspan]="2" style="background-color: lightcoral">
|
||||
<of-crawler-auth [selectedCrawler]="selectedCrawler"></of-crawler-auth>
|
||||
<of-crawler-auth [selectedCrawler]="selectedCrawler" (testPassEvent)="handleTest($event)"></of-crawler-auth>
|
||||
</mat-grid-tile>
|
||||
|
||||
<mat-grid-tile [colspan]="1" [rowspan]="3" style="background-color: lightgrey">
|
||||
|
|
|
@ -20,6 +20,7 @@ export class SettingComponent implements OnInit, DoCheck {
|
|||
|
||||
selectedTarget: Target = null;
|
||||
selectedCrawler: MetaCrawler = null;
|
||||
testPassed = false;
|
||||
selectedSensorDisplayItems: Set<MetaSensorDisplayItem> = null;
|
||||
step = 1;
|
||||
nextable = false;
|
||||
|
@ -56,7 +57,8 @@ export class SettingComponent implements OnInit, DoCheck {
|
|||
this.selectedTarget === null ||
|
||||
this.selectedCrawler === null ||
|
||||
this.selectedSensorDisplayItems === null ||
|
||||
this.selectedSensorDisplayItems.size === 0
|
||||
this.selectedSensorDisplayItems.size === 0 ||
|
||||
this.testPassed === false
|
||||
) {
|
||||
this.nextable = false;
|
||||
} else {
|
||||
|
@ -97,4 +99,7 @@ export class SettingComponent implements OnInit, DoCheck {
|
|||
handleItemSelection(itemSet: Set<MetaSensorDisplayItem>) {
|
||||
this.selectedSensorDisplayItems = itemSet;
|
||||
}
|
||||
handleTest(b: boolean) {
|
||||
this.testPassed = b;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user