This commit is contained in:
insanity 2018-03-23 15:11:05 +09:00
parent 9b70c21822
commit 07b2d08483
5 changed files with 45 additions and 37 deletions

View File

@ -1,6 +1,6 @@
<nav mat-tab-nav-bar> <nav mat-tab-nav-bar>
<a mat-tab-link *ngFor="let tab of tabs" [routerLink]="tab.path" routerLinkActive #rla="routerLinkActive" [routerLinkActiveOptions]="{exact: true}" <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 }} {{ tab.label }}
</a> </a>
</nav> </nav>

View File

@ -5,15 +5,30 @@
<mat-card-subtitle>Crawler 인증</mat-card-subtitle> <mat-card-subtitle>Crawler 인증</mat-card-subtitle>
</mat-card-header> </mat-card-header>
<!-- case 4: // BOOLEAN_TYPE
break;
case 5: // SELECT_TYPE
-->
<mat-card-content> <mat-card-content>
<perfect-scrollbar style="height: 150px"> <perfect-scrollbar style="height: 150px">
크롤러 인증해야 됨
<div *ngFor="let inputItem of inputItems"> <div *ngFor="let inputItem of inputItems">
<mat-form-field> <mat-form-field>
<input *ngIf="inputItem.inputType.id == 1" matInput type="text" 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}}> <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> </mat-form-field>
</div> </div>
<div fxLayoutAlign="end">
<button mat-raised-button (click)="testConnect()" color="primary">Test</button>
</div>
</perfect-scrollbar> </perfect-scrollbar>
</mat-card-content> </mat-card-content>
</mat-card> </mat-card>

View File

@ -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 { Router } from '@angular/router';
import { MetaCrawler } from '../../../../meta/crawler/model/MetaCrawler'; 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 { RPCError } from 'packages/core/rpc/error';
import * as ListStore from 'packages/meta/crawler-input-item/store/list'; import * as ListStore from 'packages/meta/crawler-input-item/store/list';
import { ReadCrawlerInputItemSelector } from 'packages/meta/crawler-input-item/store'; 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({ @Component({
@ -19,6 +19,8 @@ export class CrawlerAuthComponent implements OnInit, OnChanges {
inputItems$ = this.listStore.pipe(select(ReadCrawlerInputItemSelector.select('inputs'))); inputItems$ = this.listStore.pipe(select(ReadCrawlerInputItemSelector.select('inputs')));
inputItems: MetaCrawlerInputItem[]; inputItems: MetaCrawlerInputItem[];
@Output() testPassEvent = new EventEmitter<boolean>();
@Input() selectedCrawler: MetaCrawler; @Input() selectedCrawler: MetaCrawler;
constructor( constructor(
private router: Router, private router: Router,
@ -29,8 +31,10 @@ export class CrawlerAuthComponent implements OnInit, OnChanges {
this.inputItems$.subscribe( this.inputItems$.subscribe(
(list: MetaCrawlerInputItem[]) => { (list: MetaCrawlerInputItem[]) => {
if (list !== null) { if (list !== null) {
if (this.inputItems !== list) {
this.testPassEvent.emit(false);
}
this.inputItems = list; this.inputItems = list;
this.generateAuthComponent();
} }
}, },
(error: RPCError) => { (error: RPCError) => {
@ -48,33 +52,17 @@ export class CrawlerAuthComponent implements OnInit, OnChanges {
this.listStore.dispatch(new ListStore.ReadAll(this.selectedCrawler)); this.listStore.dispatch(new ListStore.ReadAll(this.selectedCrawler));
} }
generateAuthComponent() { testConnect() {
// inputType: MetaInputType; switch (this.selectedCrawler.id) {
// crawler: MetaCrawler; case 1:
// 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; break;
case 2: // PASSWORD_TYPE case 2:
break; break;
case 3: // NUMBER_TYPE case 3:
break;
case 4: // BOOLEAN_TYPE
break;
case 5: // SELECT_TYPE
break; break;
default : default :
break; break;
} }
} this.testPassEvent.emit(true);
} }
} }

View File

@ -7,7 +7,7 @@
</mat-grid-tile> </mat-grid-tile>
<mat-grid-tile [colspan]="1" [rowspan]="2" style="background-color: lightcoral"> <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>
<mat-grid-tile [colspan]="1" [rowspan]="3" style="background-color: lightgrey"> <mat-grid-tile [colspan]="1" [rowspan]="3" style="background-color: lightgrey">

View File

@ -20,6 +20,7 @@ export class SettingComponent implements OnInit, DoCheck {
selectedTarget: Target = null; selectedTarget: Target = null;
selectedCrawler: MetaCrawler = null; selectedCrawler: MetaCrawler = null;
testPassed = false;
selectedSensorDisplayItems: Set<MetaSensorDisplayItem> = null; selectedSensorDisplayItems: Set<MetaSensorDisplayItem> = null;
step = 1; step = 1;
nextable = false; nextable = false;
@ -56,7 +57,8 @@ export class SettingComponent implements OnInit, DoCheck {
this.selectedTarget === null || this.selectedTarget === null ||
this.selectedCrawler === null || this.selectedCrawler === null ||
this.selectedSensorDisplayItems === null || this.selectedSensorDisplayItems === null ||
this.selectedSensorDisplayItems.size === 0 this.selectedSensorDisplayItems.size === 0 ||
this.testPassed === false
) { ) {
this.nextable = false; this.nextable = false;
} else { } else {
@ -97,4 +99,7 @@ export class SettingComponent implements OnInit, DoCheck {
handleItemSelection(itemSet: Set<MetaSensorDisplayItem>) { handleItemSelection(itemSet: Set<MetaSensorDisplayItem>) {
this.selectedSensorDisplayItems = itemSet; this.selectedSensorDisplayItems = itemSet;
} }
handleTest(b: boolean) {
this.testPassed = b;
}
} }