From b52cdaa384e8ff09d01311267ff632e130623747 Mon Sep 17 00:00:00 2001 From: insanity Date: Wed, 11 Apr 2018 21:54:05 +0900 Subject: [PATCH] sensor senting popup is in progress --- package.json | 1 - src/packages/infra/infra.module.ts | 4 +- .../model/MetaSensorItemType.ts | 6 +- src/packages/sensor/component/index.ts | 19 ++- .../crawler-auth/crawler-auth.component.html | 68 +++++++- .../crawler-auth/crawler-auth.component.scss | 0 .../crawler-auth/crawler-auth.component.ts | 1 - .../crawler-selector.component.html | 14 +- .../crawler-selector.component.ts | 31 ++-- .../sensor-item-selector.component.html | 6 +- .../sensor-item-selector.component.ts | 113 +++++-------- .../component/setting/setting.component.html | 43 ++--- .../component/setting/setting.component.scss | 47 +++--- .../component/setting/setting.component.ts | 156 ++++++------------ .../target-selector.component.html | 13 +- .../target-selector.component.scss | 8 - .../target-selector.component.ts | 147 +++++++++-------- src/packages/sensor/sensor.module.ts | 15 +- 18 files changed, 342 insertions(+), 350 deletions(-) delete mode 100644 src/packages/sensor/component/setting/crawler-auth/crawler-auth.component.scss delete mode 100644 src/packages/sensor/component/setting/target-selector/target-selector.component.scss diff --git a/package.json b/package.json index dbd48bb..b366adc 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,6 @@ "@ngrx/store": "^5.2.0", "@ngrx/store-devtools": "^5.2.0", "angular-l10n": "^4.1.5", - "angular-tree-component": "^7.1.0", "angularx-qrcode": "^1.1.0", "ip-cidr": "^1.1.2", "reflect-metadata": "^0.1.12", diff --git a/src/packages/infra/infra.module.ts b/src/packages/infra/infra.module.ts index 6fbe48f..c9e458b 100644 --- a/src/packages/infra/infra.module.ts +++ b/src/packages/infra/infra.module.ts @@ -6,6 +6,7 @@ import { SERVICES } from './service'; import { FormsModule } from '@angular/forms'; import { PrimeNGModules } from '../commons/prime-ng/prime-ng.module'; import { DiscoveryModule } from 'packages/discovery/discovery.module'; +import { SensorModule } from '../sensor/sensor.module'; @NgModule({ @@ -14,7 +15,8 @@ import { DiscoveryModule } from 'packages/discovery/discovery.module'; InfraStoreModule, FormsModule, PrimeNGModules, - DiscoveryModule + DiscoveryModule, + SensorModule ], declarations: [ COMPONENTS, diff --git a/src/packages/meta/sensor-item-type/model/MetaSensorItemType.ts b/src/packages/meta/sensor-item-type/model/MetaSensorItemType.ts index 5a45c8b..648d7db 100644 --- a/src/packages/meta/sensor-item-type/model/MetaSensorItemType.ts +++ b/src/packages/meta/sensor-item-type/model/MetaSensorItemType.ts @@ -1,6 +1,6 @@ export interface MetaSensorItemType { id?: number; - name: string; - description: string; - createDate: Date; + name?: string; + description?: string; + createDate?: Date; } diff --git a/src/packages/sensor/component/index.ts b/src/packages/sensor/component/index.ts index 245605b..03151de 100644 --- a/src/packages/sensor/component/index.ts +++ b/src/packages/sensor/component/index.ts @@ -1,27 +1,28 @@ import { ListComponent } from './list/list.component'; -// import { SettingComponent } from './setting/setting.component'; +import { SettingComponent } from './setting/setting.component'; +import { TargetSelectorComponent } from './setting/target-selector/target-selector.component'; +import { CrawlerSelectorComponent } from './setting/crawler-selector/crawler-selector.component'; +import { CrawlerAuthComponent } from './setting/crawler-auth/crawler-auth.component'; +import { SensorItemSelectorComponent } from './setting/sensor-item-selector/sensor-item-selector.component'; // import { SettingResultComponent } from './setting-result/setting-result.component'; // import { FilterComponent } from './list/filter/filter.component'; // import { ListComponent } from './list/list.component'; // import { DetailComponent } from './detail/detail.component'; // import { TargetSelectorComponent } from './setting/target-selector/target-selector.component'; -// import { CrawlerSelectorComponent } from './setting/crawler-selector/crawler-selector.component'; -// import { CrawlerAuthComponent } from './setting/crawler-auth/crawler-auth.component'; -// import { SensorItemSelectorComponent } from './setting/sensor-item-selector/sensor-item-selector.component'; // import { SettingETCComponent } from './setting/setting-etc/setting-etc.component'; // import { NameTagComponent } from './name-tag/name-tag.component'; export const COMPONENTS = [ -// SettingComponent, + SettingComponent, + TargetSelectorComponent, + CrawlerSelectorComponent, + CrawlerAuthComponent, + SensorItemSelectorComponent, // SettingResultComponent, ListComponent, // FilterComponent, // DetailComponent, -// TargetSelectorComponent, -// CrawlerSelectorComponent, -// CrawlerAuthComponent, -// SensorItemSelectorComponent, // SettingETCComponent, // NameTagComponent, ]; 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 3dd9c6c..6dfe07b 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 @@ -1,4 +1,68 @@ -
+
+

3. Credential for

+ +
+
+ +
+
+ + + + +
+
+ +
+
+ +
+
+ + + + +
+
+ +
+
+ +
+
+ + + + +
+
+ +
+
+ +
+
+ + + + +
+
+ +
+
+ +
+
+ + + + +
+
+ +
+ \ No newline at end of file diff --git a/src/packages/sensor/component/setting/crawler-auth/crawler-auth.component.scss b/src/packages/sensor/component/setting/crawler-auth/crawler-auth.component.scss deleted file mode 100644 index e69de29..0000000 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 9be683e..07a5632 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 @@ -12,7 +12,6 @@ import { MetaCrawlerInputItem } from 'packages/meta/crawler-input-item/model/Met @Component({ selector: 'of-crawler-auth', templateUrl: './crawler-auth.component.html', - styleUrls: ['./crawler-auth.component.scss'] }) export class CrawlerAuthComponent implements OnInit, OnChanges { diff --git a/src/packages/sensor/component/setting/crawler-selector/crawler-selector.component.html b/src/packages/sensor/component/setting/crawler-selector/crawler-selector.component.html index 89857f1..342d992 100644 --- a/src/packages/sensor/component/setting/crawler-selector/crawler-selector.component.html +++ b/src/packages/sensor/component/setting/crawler-selector/crawler-selector.component.html @@ -1,4 +1,14 @@ -
+ + +
+ +
{{crawler.name}}
+
+
+
+ + + \ No newline at end of file diff --git a/src/packages/sensor/component/setting/crawler-selector/crawler-selector.component.ts b/src/packages/sensor/component/setting/crawler-selector/crawler-selector.component.ts index 1c43caa..fb355de 100644 --- a/src/packages/sensor/component/setting/crawler-selector/crawler-selector.component.ts +++ b/src/packages/sensor/component/setting/crawler-selector/crawler-selector.component.ts @@ -27,16 +27,27 @@ export class CrawlerSelectorComponent implements OnInit, OnChanges, AfterContent ) {} ngOnInit() { - this.crawlers$.subscribe( - (list: MetaCrawler[]) => { - if (list !== null) { - this.crawlers = list; - } - }, - (error: RPCClientError) => { - console.log(error.response.message); - } - ); + // this.crawlers$.subscribe( + // (list: MetaCrawler[]) => { + // if (list !== null) { + // this.crawlers = list; + // } + // }, + // (error: RPCClientError) => { + // console.log(error.response.message); + // } + // ); + + // Temporary Data + this.crawlers = []; + for (let i = 0; i < 10; i++) { + const c: MetaCrawler = { + id: i, + name: 'CrawlerName' + i, + description: 'Description' + i, + }; + this.crawlers.push(c); + } } ngAfterContentInit() { diff --git a/src/packages/sensor/component/setting/sensor-item-selector/sensor-item-selector.component.html b/src/packages/sensor/component/setting/sensor-item-selector/sensor-item-selector.component.html index de90f1c..31280b5 100644 --- a/src/packages/sensor/component/setting/sensor-item-selector/sensor-item-selector.component.html +++ b/src/packages/sensor/component/setting/sensor-item-selector/sensor-item-selector.component.html @@ -1,4 +1,6 @@ -
+ + + \ No newline at end of file diff --git a/src/packages/sensor/component/setting/sensor-item-selector/sensor-item-selector.component.ts b/src/packages/sensor/component/setting/sensor-item-selector/sensor-item-selector.component.ts index 380307c..d82fe6b 100644 --- a/src/packages/sensor/component/setting/sensor-item-selector/sensor-item-selector.component.ts +++ b/src/packages/sensor/component/setting/sensor-item-selector/sensor-item-selector.component.ts @@ -2,12 +2,12 @@ import { Component, OnInit, OnChanges, Input, Output, EventEmitter, ViewChild, A import { Router } from '@angular/router'; import { Store, select } from '@ngrx/store'; import { RPCClientError } from '@loafer/ng-rpc/protocol'; - import * as ListStore from 'packages/meta/sensor-display-item/store/list'; import { ReadAllSensorDisplayItemByCrawlerSelector } from 'packages/meta/sensor-display-item/store'; import { MetaSensorDisplayItem } from 'packages/meta/sensor-display-item/model/MetaSensorDisplayItem'; import { MetaCrawler } from '../../../../meta/crawler/model/MetaCrawler'; -import { ITreeOptions } from 'angular-tree-component'; +import { MetaSensorItemType } from '../../../../meta/sensor-item-type/model/MetaSensorItemType'; +import { TreeNode } from 'primeng/primeng'; @Component({ selector: 'of-sensor-item-selector', @@ -19,8 +19,9 @@ export class SensorItemSelectorComponent implements OnInit, OnChanges { @Input() selectedCrawler: MetaCrawler; @Output() itemSelectEvent = new EventEmitter>(); items$ = this.listStore.pipe(select(ReadAllSensorDisplayItemByCrawlerSelector.select('list'))); - nodes; - checkedSet: Set = new Set(); + + selectedItems: MetaSensorDisplayItem[]; + treeNode: TreeNode[]; constructor( private router: Router, @@ -28,77 +29,49 @@ export class SensorItemSelectorComponent implements OnInit, OnChanges { ) { } ngOnInit() { - this.items$.subscribe( - (list: MetaSensorDisplayItem[]) => { - if (list !== null) { - this.generateTreeNode(list); - } - }, - (error: RPCClientError) => { - console.log(error.response.message); + // this.items$.subscribe( + // (list: MetaSensorDisplayItem[]) => { + // if (list !== null) { + // } + // }, + // (error: RPCClientError) => { + // console.log(error.response.message); + // } + // ); + + // Temporary data + const displayItems = []; + for (let i = 0; i < 10; i++) { + let isDefault = false; + const t: MetaSensorItemType = { + name: 'CPU' + }; + if (i % 2) { + isDefault = true; + t.name = 'Memory'; } - ); + const si: MetaSensorDisplayItem = { + id: i, + key: 'SensorDisplayItemKey' + i, + displayName: 'DisplayName' + i, + description: 'Description' + i, + default: isDefault, + itemType: t + }; + displayItems.push(si); + } + + this.generateTreeData(displayItems); } + generateTreeData(items) { + + } + + ngOnChanges() { - this.checkedSet.clear(); + // this.checkedSet.clear(); this.listStore.dispatch(new ListStore.ReadAllByCrawler(this.selectedCrawler)); } - generateTreeNode(list: MetaSensorDisplayItem[]) { - this.nodes = new Array(); - for (const item of list) { - const categoryNode = this.existCategory(item); - if (categoryNode === null) { - const childrenNode = new Array(); - childrenNode.push(this.getChildNode(item)); - const node = { - title: item.itemType.name, - children: childrenNode, - }; - this.nodes.push(node); - } else { - categoryNode.children.push(this.getChildNode(item)); - } - } - this.itemSelectEvent.emit(this.checkedSet); - } - - getChildNode(item) { - const childNode = { - title: item.displayName, - key: ' - ' + item.key, - default: item.default, - displayItem: item - }; - return childNode; - } - - existCategory(item: MetaSensorDisplayItem) { - let categoryNode = null; - for (const node of this.nodes) { - if (node.title === item.itemType.name) { - categoryNode = node; - } - } - return categoryNode; - } - - checkItem(node) { - node.toggleActivated(true); - if (node.isActive) { - if (this.checkedSet.has(node.data.displayItem) === false) { - this.checkedSet.add(node.data.displayItem); - } - } else { - if (this.checkedSet.has(node.data.displayItem)) { - this.checkedSet.delete(node.data.displayItem); - } - } - this.itemSelectEvent.emit(this.checkedSet); - } - - onTreeDataLoad(tree) { - tree.treeModel.expandAll(); - } } diff --git a/src/packages/sensor/component/setting/setting.component.html b/src/packages/sensor/component/setting/setting.component.html index 6f9fbe8..7905713 100644 --- a/src/packages/sensor/component/setting/setting.component.html +++ b/src/packages/sensor/component/setting/setting.component.html @@ -1,37 +1,16 @@ -
-
- - - - - + - - - - - - - - - - - - - +
+
+
- -
- +
+
- -
- - - - - +
+ +
+
+
\ No newline at end of file diff --git a/src/packages/sensor/component/setting/setting.component.scss b/src/packages/sensor/component/setting/setting.component.scss index a0bf0ee..3f63c9b 100644 --- a/src/packages/sensor/component/setting/setting.component.scss +++ b/src/packages/sensor/component/setting/setting.component.scss @@ -1,31 +1,26 @@ -.example-card { - width: 400px; +.ui-steps .ui-steps-item { + width: 25%; } -.example-header-image { - background-image: url('https://material.angular.io/assets/img/examples/shiba1.jpg'); - background-size: cover; +.ui-steps.steps-custom { + margin-bottom: 30px; +} + +.ui-steps.steps-custom .ui-steps-item .ui-menuitem-link { + height: 10px; + padding: 0 1em; +} + +.ui-steps.steps-custom .ui-steps-item .ui-steps-number { + background-color: #0081c2; + color: #FFFFFF; + display: inline-block; + width: 36px; + border-radius: 50%; + margin-top: -14px; + margin-bottom: 10px; } -.example-radio-group { - display: inline-flex; - flex-direction: column; -} - -.example-radio-button { - margin: 5px; -} - -.example-selected-value { - margin: 15px 0; -} - -.example-form { - min-width: 150px; - max-width: 500px; - width: 100%; -} - -.example-full-width { - width: 100%; +.ui-steps.steps-custom .ui-steps-item .ui-steps-title { + color: #555555; } \ 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 9ca5741..3ef0b56 100644 --- a/src/packages/sensor/component/setting/setting.component.ts +++ b/src/packages/sensor/component/setting/setting.component.ts @@ -1,111 +1,57 @@ -// import { Component, OnInit, Input, Inject, DoCheck } from '@angular/core'; -// import { Target } from '../../../target/model'; -// import { MAT_DIALOG_DATA, MatSnackBar } from '@angular/material'; -// import { Infra } from '../../../infra/model'; -// import { MetaCrawler } from '../../../meta/crawler/model/MetaCrawler'; -// import { MetaSensorDisplayItem } from '../../../meta/sensor-display-item/model/MetaSensorDisplayItem'; +import { Component, OnInit, Input, Inject, DoCheck, ViewEncapsulation } from '@angular/core'; +import { Target } from 'packages/target/model'; +import { Infra } from 'packages/infra/model'; +import { MetaCrawler } from 'packages/meta/crawler/model/MetaCrawler'; +import { MetaSensorDisplayItem } from 'packages/meta/sensor-display-item/model/MetaSensorDisplayItem'; -// import { Store, select } from '@ngrx/store'; -// import { RPCClientError } from '@loafer/ng-rpc/protocol'; -// import * as SensorItemKeyListStore from 'packages/sensor-item/store/key-list'; -// import { ReadSensorItemKeySelector } from 'packages/sensor-item/store'; -// import { MetaSensorItemKey } from '../../../meta/sensor-item-key/model/MetaSensorItemKey'; +import { Store, select } from '@ngrx/store'; +import { RPCClientError } from '@loafer/ng-rpc/protocol'; +import * as SensorItemKeyListStore from 'packages/sensor-item/store/key-list'; +import { ReadSensorItemKeySelector } from 'packages/sensor-item/store'; +import { MetaSensorItemKey } from 'packages/meta/sensor-item-key/model/MetaSensorItemKey'; -// @Component({ -// selector: 'of-sensor-setting', -// templateUrl: './setting.component.html', -// styleUrls: ['./setting.component.scss'] -// }) -// export class SettingComponent implements OnInit, DoCheck { +@Component({ + selector: 'of-sensor-setting', + templateUrl: './setting.component.html', + encapsulation: ViewEncapsulation.None +}) +export class SettingComponent implements OnInit, DoCheck { -// selectedTarget: Target = null; -// selectedCrawler: MetaCrawler = null; -// testPassed = false; -// selectedSensorDisplayItems: Set = null; -// step = 1; -// nextable = false; -// focus = 0; -// isAllSelectable = true; + sensorItemKeys$ = this.keyListStore.pipe(select(ReadSensorItemKeySelector.select('list'))); + stepsItems = [ + { + label: 'Target' + }, + { + label: 'Crawler' + }, + { + label: 'Credentials' + }, + { + label: 'Sensor Items' + } + ]; + activeIndex = 1; -// sensorItemKeys$ = this.keyListStore.pipe(select(ReadSensorItemKeySelector.select('list'))); + constructor( + private keyListStore: Store, + ) { + } -// constructor( -// @Inject(MAT_DIALOG_DATA) public data: any, -// public snackBar: MatSnackBar, -// private keyListStore: Store, -// ) { -// if (data !== null) { -// this.isAllSelectable = false; -// this.selectedTarget = data.infra.target; -// } -// } + ngOnInit() { + this.sensorItemKeys$.subscribe( + (list: MetaSensorItemKey[]) => { + if (list !== null) { + console.log(list); + } + }, + (error: RPCClientError) => { + console.log(error.response.message); + } + ); + } -// ngOnInit() { -// this.sensorItemKeys$.subscribe( -// (list: MetaSensorItemKey[]) => { -// if (list !== null) { -// console.log('#############################'); -// console.log(list); -// console.log('#############################'); -// } -// }, -// (error: RPCClientError) => { -// console.log(error.response.message); -// } -// ); -// } - -// ngDoCheck() { -// if ( -// this.selectedTarget === null || -// this.selectedCrawler === null || -// this.selectedSensorDisplayItems === null || -// this.selectedSensorDisplayItems.size === 0 || -// this.testPassed === false -// ) { -// this.nextable = false; -// } else { -// this.nextable = true; -// } -// } - -// onNext() { -// this.step += 1; -// } - -// onPrev() { -// this.step -= 1; -// } - -// onDone() { -// this.openSnackBar('센서 등록해야되는데 아직 못함'); -// // List SensorItemDependencyService.readAllByDisplayItem(MetaSensorDisplayItem displayItem) -// for (const displayItem of Array.from(this.selectedSensorDisplayItems)) { -// this.keyListStore.dispatch(new SensorItemKeyListStore.ReadAllByDisplayItem(displayItem)); -// } -// // Sensor SensorService.registSensorConfig(Sensor sensor, List sensorItemList, String etcJson) -// } - -// openSnackBar(message: string) { -// this.snackBar.open(message, 'OK', { -// duration: 2000, -// }); -// } - -// handleTargetSelection(t: Target) { -// this.selectedTarget = t; -// } -// handleCrawlerSelection(c: MetaCrawler) { -// this.selectedCrawler = c; -// } -// handleItemSelection(itemSet: Set) { -// this.selectedSensorDisplayItems = itemSet; -// } -// handleTest(b: boolean) { -// this.testPassed = b; -// } - -// onAreaClick(no: number) { -// this.focus = no; -// } -// } + ngDoCheck() { + } +} 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 21e11ad..dfdab6f 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,4 +1,13 @@ -
+ + +
+ +
{{target.displayName}}
+
+
+
+ + \ No newline at end of file diff --git a/src/packages/sensor/component/setting/target-selector/target-selector.component.scss b/src/packages/sensor/component/setting/target-selector/target-selector.component.scss deleted file mode 100644 index 5503c56..0000000 --- a/src/packages/sensor/component/setting/target-selector/target-selector.component.scss +++ /dev/null @@ -1,8 +0,0 @@ -.radio-group { - display: inline-flex; - flex-direction: column; -} - -.radio-button { - margin: 5px; -} 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 b467cb8..fa6f773 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 @@ -1,78 +1,89 @@ -// import { Component, OnInit, Output, EventEmitter, Input, AfterContentInit } from '@angular/core'; -// import { Router } from '@angular/router'; -// import { MatRadioButton } from '@angular/material'; -// import { Target } from 'packages/target/model'; -// import { RPCClientError } from '@loafer/ng-rpc/protocol'; -// import { Domain } from 'packages/domain/model'; -// import { AuthSelector } from 'packages/member/store'; -// import * as ListStore from 'packages/infra/store/list'; -// import { ListSelector } from 'packages/infra/store'; -// import { Store, select } from '@ngrx/store'; -// import { Page, PageParams } from 'app/commons/model'; +import { Component, OnInit, Output, EventEmitter, Input, AfterContentInit } from '@angular/core'; +import { Router } from '@angular/router'; +import { Target } from 'packages/target/model'; +import { RPCClientError } from '@loafer/ng-rpc/protocol'; +import { Domain } from 'packages/domain/model'; +import { AuthSelector } from 'packages/member/store'; +import * as ListStore from 'packages/infra/store/list'; +import { ListSelector } from 'packages/infra/store'; +import { Store, select } from '@ngrx/store'; +import { Page, PageParams } from 'app/commons/model'; +import { SelectItem } from 'primeng/primeng'; -// @Component({ -// selector: 'of-target-selector', -// templateUrl: './target-selector.component.html', -// styleUrls: ['./target-selector.component.scss'] -// }) -// export class TargetSelectorComponent implements OnInit { +@Component({ + selector: 'of-target-selector', + templateUrl: './target-selector.component.html', +}) +export class TargetSelectorComponent implements OnInit { -// targets$ = this.store.pipe(select(ListSelector.select('page'))); + targets$ = this.store.pipe(select(ListSelector.select('page'))); -// @Input() target: Target = null; -// @Output() targetSelectEvent = new EventEmitter(); -// targets: Target[] = null; + @Input() target: Target = null; + @Output() targetSelectEvent = new EventEmitter(); + targets: Target[] = null; -// constructor( -// private router: Router, -// private store: Store -// ) { } + constructor( + private router: Router, + private store: Store + ) { } -// ngOnInit() { -// this.targets = new Array(); -// if (this.target === null) { -// this.getTargetList(); -// } else { -// this.targets.push(this.target); -// } + 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) { -// this.convertInfraToTarget(page); -// } -// }, -// (error: RPCClientError) => { -// console.log(error.response.message); -// } -// ); -// } + this.targets$.subscribe( + (page: Page) => { + if (page !== null) { + this.convertInfraToTarget(page); + } + }, + (error: RPCClientError) => { + console.log(error.response.message); + } + ); -// convertInfraToTarget(page: Page) { -// for (const infra of page.content) { -// this.targets.push(infra.target); -// } -// } + // Temporary data + for (let i = 0; i < 10; i++) { + const t: Target = { + id: i, + displayName: 'DisplayName' + i, + createDate: new Date(), + description: 'Description' + i, + }; + this.targets.push(t); + } + } -// getTargetList() { -// this.store.select(AuthSelector.select('domain')).subscribe( -// (domain: Domain) => { -// const pageParams: PageParams = { -// pageNo: '0', -// countPerPage: '9999', -// sortCol: 'id', -// sortDirection: 'descending' -// }; -// this.store.dispatch(new ListStore.ReadAllByDomain({ domain, pageParams })); -// }, -// (error) => { -// console.log(error); -// } -// ); -// } -// targetSelected(t: Target) { -// this.targetSelectEvent.emit(t); -// } + convertInfraToTarget(page: Page) { + for (const infra of page.content) { + this.targets.push(infra.target); + } + } -// } + getTargetList() { + this.store.select(AuthSelector.select('domain')).subscribe( + (domain: Domain) => { + const pageParams: PageParams = { + pageNo: '0', + countPerPage: '9999', + sortCol: 'id', + sortDirection: 'descending' + }; + this.store.dispatch(new ListStore.ReadAllByDomain({ domain, pageParams })); + }, + (error) => { + console.log(error); + } + ); + } + + targetSelected(t: Target) { + this.targetSelectEvent.emit(t); + } + +} diff --git a/src/packages/sensor/sensor.module.ts b/src/packages/sensor/sensor.module.ts index 12c6601..493b5ba 100644 --- a/src/packages/sensor/sensor.module.ts +++ b/src/packages/sensor/sensor.module.ts @@ -1,13 +1,12 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FormsModule } from '@angular/forms'; - +import { PrimeNGModules } from '../commons/prime-ng/prime-ng.module'; import { COMPONENTS } from './component'; import { SERVICES } from './service'; import { SensorStoreModule } from './sensor-store.module'; -import { TreeModule } from 'angular-tree-component'; -import { MetaCrawlerModule } from '../meta/crawler/crawler.module'; -import { MetaSensorDisplayItemModule } from '../meta/sensor-display-item/sensor-display-item.module'; +// import { MetaCrawlerModule } from '../meta/crawler/crawler.module'; +// import { MetaSensorDisplayItemModule } from '../meta/sensor-display-item/sensor-display-item.module'; // import { SensorItemModule } from '../sensor-item/sensor-item.module'; // import { MetaCrawlerInputItemModule } from '../meta/crawler-input-item/crawler-input.module'; @@ -16,10 +15,10 @@ import { MetaSensorDisplayItemModule } from '../meta/sensor-display-item/sensor- CommonModule, FormsModule, SensorStoreModule, - TreeModule, - MetaCrawlerModule, - MetaSensorDisplayItemModule, - // SensorItemModule + PrimeNGModules, + // SensorItemModule, + // MetaCrawlerModule, + // MetaSensorDisplayItemModule, ], declarations: [ COMPONENTS,