From 07b2d08483927d5ef9fb5fa78259a3bfef837352 Mon Sep 17 00:00:00 2001 From: insanity Date: Fri, 23 Mar 2018 15:11:05 +0900 Subject: [PATCH] auth --- .../sub-menubar/sub-menubar.component.html | 2 +- .../crawler-auth/crawler-auth.component.html | 21 ++++++-- .../crawler-auth/crawler-auth.component.ts | 50 +++++++------------ .../component/setting/setting.component.html | 2 +- .../component/setting/setting.component.ts | 7 ++- 5 files changed, 45 insertions(+), 37 deletions(-) diff --git a/src/app/commons/component/layout/sub-menubar/sub-menubar.component.html b/src/app/commons/component/layout/sub-menubar/sub-menubar.component.html index e4a8449..95f6e5b 100644 --- a/src/app/commons/component/layout/sub-menubar/sub-menubar.component.html +++ b/src/app/commons/component/layout/sub-menubar/sub-menubar.component.html @@ -1,6 +1,6 @@ \ No newline at end of file diff --git a/src/packages/sensor/component/setting/crawler-auth/crawler-auth.component.html b/src/packages/sensor/component/setting/crawler-auth/crawler-auth.component.html index 61b5255..2f16bc3 100644 --- a/src/packages/sensor/component/setting/crawler-auth/crawler-auth.component.html +++ b/src/packages/sensor/component/setting/crawler-auth/crawler-auth.component.html @@ -5,15 +5,30 @@ Crawler 인증 + + + - 크롤러 인증해야 됨
- - + + + + + + + + {{option}} +
+
+ +
diff --git a/src/packages/sensor/component/setting/crawler-auth/crawler-auth.component.ts b/src/packages/sensor/component/setting/crawler-auth/crawler-auth.component.ts index ca939e2..46ebae2 100644 --- a/src/packages/sensor/component/setting/crawler-auth/crawler-auth.component.ts +++ b/src/packages/sensor/component/setting/crawler-auth/crawler-auth.component.ts @@ -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(); + @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); } } diff --git a/src/packages/sensor/component/setting/setting.component.html b/src/packages/sensor/component/setting/setting.component.html index 0b5f62e..1bc4f6f 100644 --- a/src/packages/sensor/component/setting/setting.component.html +++ b/src/packages/sensor/component/setting/setting.component.html @@ -7,7 +7,7 @@ - + diff --git a/src/packages/sensor/component/setting/setting.component.ts b/src/packages/sensor/component/setting/setting.component.ts index 705b718..85abc43 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 { selectedTarget: Target = null; selectedCrawler: MetaCrawler = null; + testPassed = false; selectedSensorDisplayItems: Set = 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) { this.selectedSensorDisplayItems = itemSet; } + handleTest(b: boolean) { + this.testPassed = b; + } }