diff --git a/@overflow/sensor/component/setting.1/crawler-auth/crawler-auth.component.html b/@overflow/sensor/component/setting.1/crawler-auth/crawler-auth.component.html deleted file mode 100644 index 5108fca..0000000 --- a/@overflow/sensor/component/setting.1/crawler-auth/crawler-auth.component.html +++ /dev/null @@ -1,17 +0,0 @@ - -
-
- - - - -
-
- - -
개발자의 배려가 돋보이는 친절한 안내 메시지
-
-
- -
-
\ No newline at end of file diff --git a/@overflow/sensor/component/setting.1/crawler-auth/crawler-auth.component.spec.ts b/@overflow/sensor/component/setting.1/crawler-auth/crawler-auth.component.spec.ts deleted file mode 100644 index 87f023d..0000000 --- a/@overflow/sensor/component/setting.1/crawler-auth/crawler-auth.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { CrawlerAuthComponent } from './crawler-auth.component'; - -describe('FilterComponent', () => { - let component: CrawlerAuthComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ CrawlerAuthComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(CrawlerAuthComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/@overflow/sensor/component/setting.1/crawler-auth/crawler-auth.component.ts b/@overflow/sensor/component/setting.1/crawler-auth/crawler-auth.component.ts deleted file mode 100644 index 6a0b3d9..0000000 --- a/@overflow/sensor/component/setting.1/crawler-auth/crawler-auth.component.ts +++ /dev/null @@ -1,96 +0,0 @@ -import { Component, OnInit, Input, OnChanges, Output, EventEmitter } from '@angular/core'; -import { Router } from '@angular/router'; -import { MetaCrawler } from '@overflow/commons-typescript/model/meta'; - -import { Store, select } from '@ngrx/store'; -import { RPCClientError } from '@loafer/ng-rpc'; -import * as ListStore from '@overflow/meta/crawler-input-item/store/list'; -import { ReadCrawlerInputItemSelector } from '@overflow/meta/crawler-input-item/store'; -import { MetaCrawlerInputItem } from '@overflow/commons-typescript/model/meta'; - - -@Component({ - selector: 'of-crawler-auth', - templateUrl: './crawler-auth.component.html', -}) -export class CrawlerAuthComponent implements OnInit, OnChanges { - - inputItems$ = this.listStore.pipe(select(ReadCrawlerInputItemSelector.select('inputs'))); - inputItems: MetaCrawlerInputItem[]; - title: string; - - @Output() credentialPassed = new EventEmitter(); - @Input() crawler: MetaCrawler; - - constructor( - private router: Router, - private listStore: Store, - ) { } - - ngOnInit() { - // this.inputItems$.subscribe( - // (list: MetaCrawlerInputItem[]) => { - // if (list !== null) { - // if (this.inputItems !== list) { - // this.testPassEvent.emit(false); - // } - // this.inputItems = list; - // } - // }, - // (error: RPCClientError) => { - // console.log(error.response.message); - // } - // ); - } - - ngOnChanges() { - // this.getCrawlerAuthInputItems(); - this.title = '3. Credentials'; - - this.inputItems = []; - // Temporary data - if (null == this.crawler) { - return; - } - this.title += ' for ' + this.crawler.name; - for (let i = 0; i < 10; i++) { - const item: MetaCrawlerInputItem = { - id: i, - // inputType: { - // id: i, - // name: '', - // description: '', - // }, - crawler: null, - description: '', - name: '', - createDate: new Date(), - required: true, - defaultValue: '', - pattern: '', - keyName: '', - keyValue: '', - }; - this.inputItems.push(item); - } - - } - - getCrawlerAuthInputItems() { - this.listStore.dispatch(new ListStore.ReadAll(this.crawler)); - } - - testCredentials() { - // switch (this.crawler.id) { - // case 1: - // break; - // case 2: - // break; - // case 3: - // break; - // default : - // break; - // } - this.credentialPassed.emit(true); - } -} diff --git a/@overflow/sensor/component/setting.1/crawler-selector/crawler-selector.component.html b/@overflow/sensor/component/setting.1/crawler-selector/crawler-selector.component.html deleted file mode 100644 index ad29f81..0000000 --- a/@overflow/sensor/component/setting.1/crawler-selector/crawler-selector.component.html +++ /dev/null @@ -1,16 +0,0 @@ -
- - -
-
{{crawler.name}}
-
-
-
-
- - - -
개발자의 배려가 돋보이는 친절한 안내 메시지
-
-
\ No newline at end of file diff --git a/@overflow/sensor/component/setting.1/crawler-selector/crawler-selector.component.spec.ts b/@overflow/sensor/component/setting.1/crawler-selector/crawler-selector.component.spec.ts deleted file mode 100644 index 77251eb..0000000 --- a/@overflow/sensor/component/setting.1/crawler-selector/crawler-selector.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { CrawlerSelectorComponent } from './crawler-selector.component'; - -describe('FilterComponent', () => { - let component: CrawlerSelectorComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ CrawlerSelectorComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(CrawlerSelectorComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/@overflow/sensor/component/setting.1/crawler-selector/crawler-selector.component.ts b/@overflow/sensor/component/setting.1/crawler-selector/crawler-selector.component.ts deleted file mode 100644 index b052fe8..0000000 --- a/@overflow/sensor/component/setting.1/crawler-selector/crawler-selector.component.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { Component, OnInit, Input, OnChanges, AfterContentInit, Output, EventEmitter } from '@angular/core'; -import { Router } from '@angular/router'; -import { Target } from '@overflow/commons-typescript/model/target'; - -import { Store, select } from '@ngrx/store'; -import { RPCClientError } from '@loafer/ng-rpc'; -import * as ListStore from '@overflow/meta/crawler/store/list'; -import { ReadAllCrawlerSelector } from '@overflow/meta/crawler/store'; -import { MetaCrawler } from '@overflow/commons-typescript/model/meta'; - - -@Component({ - selector: 'of-crawler-selector', - templateUrl: './crawler-selector.component.html', -}) -export class CrawlerSelectorComponent implements OnInit, OnChanges, AfterContentInit { - - crawlers$ = this.listStore.pipe(select(ReadAllCrawlerSelector.select('metaCrawlerList'))); - @Input() target: Target; - crawlers: MetaCrawler[]; - @Output() crawlerSelected = new EventEmitter(); - - constructor( - private router: Router, - private listStore: Store, - ) { } - - ngOnInit() { - // this.crawlers$.subscribe( - // (list: MetaCrawler[]) => { - // if (list !== null) { - // this.crawlers = list; - // } - // }, - // (error: RPCClientError) => { - // console.log(error.response.message); - // } - // ); - - } - - ngAfterContentInit() { - // this.listStore.dispatch(new ListStore.ReadAll()); - } - - ngOnChanges() { - - this.crawlers = []; - if (null == this.target) { - return; - } - - // Temporary Data - for (let i = 0; i < 4; i++) { - const c: MetaCrawler = { - id: i, - name: 'CrawlerName' + i + ' For ' + this.target.displayName, - }; - this.crawlers.push(c); - } - - } - - onSelectionChange(event) { - this.crawlerSelected.emit(event.value[0]); - } -} diff --git a/@overflow/sensor/component/setting.1/sensor-item-selector/sensor-item-selector.component.html b/@overflow/sensor/component/setting.1/sensor-item-selector/sensor-item-selector.component.html deleted file mode 100644 index 595851d..0000000 --- a/@overflow/sensor/component/setting.1/sensor-item-selector/sensor-item-selector.component.html +++ /dev/null @@ -1,10 +0,0 @@ - -
- -
- - -
개발자의 배려가 돋보이는 친절한 안내 메시지
-
-
\ No newline at end of file diff --git a/@overflow/sensor/component/setting.1/sensor-item-selector/sensor-item-selector.component.spec.ts b/@overflow/sensor/component/setting.1/sensor-item-selector/sensor-item-selector.component.spec.ts deleted file mode 100644 index 25e7477..0000000 --- a/@overflow/sensor/component/setting.1/sensor-item-selector/sensor-item-selector.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { SensorItemSelectorComponent } from './sensor-item-selector.component'; - -describe('SensorItemSelectorComponent', () => { - let component: SensorItemSelectorComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ SensorItemSelectorComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(SensorItemSelectorComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/@overflow/sensor/component/setting.1/sensor-item-selector/sensor-item-selector.component.ts b/@overflow/sensor/component/setting.1/sensor-item-selector/sensor-item-selector.component.ts deleted file mode 100644 index b4114fe..0000000 --- a/@overflow/sensor/component/setting.1/sensor-item-selector/sensor-item-selector.component.ts +++ /dev/null @@ -1,126 +0,0 @@ -import { Component, OnInit, OnChanges, Input, Output, EventEmitter, ViewChild, AfterViewInit, OnDestroy } from '@angular/core'; -import { Router } from '@angular/router'; -import { Store, select } from '@ngrx/store'; -import { RPCClientError } from '@loafer/ng-rpc'; -import * as ListStore from '@overflow/meta/sensor-display-item/store/list'; -import { ReadAllSensorDisplayItemByCrawlerSelector } from '@overflow/meta/sensor-display-item/store'; -import { MetaSensorDisplayItem } from '@overflow/commons-typescript/model/meta'; -import { MetaCrawler } from '@overflow/commons-typescript/model/meta'; -import { MetaSensorItemType } from '@overflow/commons-typescript/model/meta'; -import { TreeNode } from 'primeng/primeng'; -import { Target } from '@overflow/commons-typescript/model/target'; - -@Component({ - selector: 'of-sensor-item-selector', - templateUrl: './sensor-item-selector.component.html', -}) -export class SensorItemSelectorComponent implements OnInit, OnChanges { - - @Input() target: Target; - @Input() crawler: MetaCrawler; - @Output() sensorItemsSelected = new EventEmitter(); - - items$ = this.listStore.pipe(select(ReadAllSensorDisplayItemByCrawlerSelector.select('list'))); - - selectedItems: TreeNode[]; - itemTreeNode: TreeNode[]; - - constructor( - private router: Router, - private listStore: Store, - ) { } - - ngOnInit() { - // this.selectedItems = new Set(); - // this.items$.subscribe( - // (list: MetaSensorDisplayItem[]) => { - // if (list !== null) { - // } - // }, - // (error: RPCClientError) => { - // console.log(error.response.message); - // } - // ); - - } - - ngOnChanges() { - // this.selectedItems.clear(); - // this.listStore.dispatch(new ListStore.ReadAllByCrawler(this.crawler)); - - this.itemTreeNode = []; - if (!this.target || !this.crawler) { - return; - } - // 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: 'this.is.display.item.name' + i, - description: 'Description' + i, - default: isDefault, - itemType: t - }; - displayItems.push(si); - } - - this.generateTreeData(displayItems); - } - - generateTreeData(items) { - this.itemTreeNode = []; - for (const item of items) { - const categoryNode = this.existCategory(item); - if (categoryNode === null) { - const childrenNode = []; - childrenNode.push(this.getChildNode(item)); - const node = { - label: item.itemType.name, - children: childrenNode, - expanded: true, - }; - this.itemTreeNode.push(node); - } else { - categoryNode.children.push(this.getChildNode(item)); - } - } - } - - getChildNode(item) { - const childNode = { - label: item.displayName, - expandedIcon: item.default ? 'ui-icon-star' : '', - collapsedIcon: item.default ? 'ui-icon-star' : '', - expanded: true, - data: item - }; - return childNode; - } - existCategory(item: MetaSensorDisplayItem) { - let categoryNode = null; - for (const node of this.itemTreeNode) { - if (node.label === item.itemType.name) { - categoryNode = node; - } - } - return categoryNode; - } - - - onNodeSelect(event) { - this.sensorItemsSelected.emit(this.selectedItems); - } - onNodeUnselect(event) { - this.sensorItemsSelected.emit(this.selectedItems); - } -} diff --git a/@overflow/sensor/component/setting.1/setting-etc/setting-etc.component.html b/@overflow/sensor/component/setting.1/setting-etc/setting-etc.component.html deleted file mode 100644 index 68799a4..0000000 --- a/@overflow/sensor/component/setting.1/setting-etc/setting-etc.component.html +++ /dev/null @@ -1,3 +0,0 @@ -
- page 2222222 -
\ No newline at end of file diff --git a/@overflow/sensor/component/setting.1/setting-etc/setting-etc.component.spec.ts b/@overflow/sensor/component/setting.1/setting-etc/setting-etc.component.spec.ts deleted file mode 100644 index 4f94006..0000000 --- a/@overflow/sensor/component/setting.1/setting-etc/setting-etc.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { SettingETCComponent } from './setting-etc.component'; - -describe('SettingETCComponent', () => { - let component: SettingETCComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ SettingETCComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(SettingETCComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/@overflow/sensor/component/setting.1/setting-etc/setting-etc.component.ts b/@overflow/sensor/component/setting.1/setting-etc/setting-etc.component.ts deleted file mode 100644 index 2891968..0000000 --- a/@overflow/sensor/component/setting.1/setting-etc/setting-etc.component.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Component, OnInit, Input } from '@angular/core'; -import { Router } from '@angular/router'; -import { MetaCrawler } from '@overflow/commons-typescript/model/meta'; -import { MetaSensorDisplayItem } from '@overflow/commons-typescript/model/meta'; -import { Target } from '@overflow/commons-typescript/model/target'; - - -@Component({ - selector: 'of-sensor-setting-etc', - templateUrl: './setting-etc.component.html', -}) -export class SettingETCComponent implements OnInit { - - @Input() selectedTarget: Target; - @Input() selectedCrawler: MetaCrawler; - @Input() selectedItems: MetaSensorDisplayItem[]; - - intervals = [ - '600 sec', - '400 sec', - '200 sec', - ]; - - - constructor( - private router: Router, - ) { } - - ngOnInit() { - } - -} diff --git a/@overflow/sensor/component/setting.1/setting.component.html b/@overflow/sensor/component/setting.1/setting.component.html deleted file mode 100644 index 51eaecd..0000000 --- a/@overflow/sensor/component/setting.1/setting.component.html +++ /dev/null @@ -1,60 +0,0 @@ -

Add Sensor

-
- - - - - - - - - - - - - - -
- - - - - -
- - - - - -
- - - - \ No newline at end of file diff --git a/@overflow/sensor/component/setting.1/setting.component.spec.ts b/@overflow/sensor/component/setting.1/setting.component.spec.ts deleted file mode 100644 index 0f66542..0000000 --- a/@overflow/sensor/component/setting.1/setting.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { SettingComponent } from './setting.component'; - -describe('SensorSettingComponent', () => { - let component: SettingComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ SettingComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(SettingComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/@overflow/sensor/component/setting.1/setting.component.ts b/@overflow/sensor/component/setting.1/setting.component.ts deleted file mode 100644 index fd56717..0000000 --- a/@overflow/sensor/component/setting.1/setting.component.ts +++ /dev/null @@ -1,159 +0,0 @@ -import { Component, OnInit, Input, Inject, DoCheck, ViewEncapsulation, Output, EventEmitter, OnChanges } from '@angular/core'; -import { Target } from '@overflow/commons-typescript/model/target'; -import { Infra } from '@overflow/commons-typescript/model/infra'; -import { MetaCrawler } from '@overflow/commons-typescript/model/meta'; -import { MetaSensorDisplayItem } from '@overflow/commons-typescript/model/meta'; - -import { Store, select, StateObservable } from '@ngrx/store'; -import { RPCClientError } from '@loafer/ng-rpc'; -import * as SensorItemKeyListStore from '@overflow/sensor-item/store/key-list'; -import { ReadSensorItemKeySelector } from '@overflow/sensor-item/store'; -import { MetaSensorItemKey } from '@overflow/commons-typescript/model/meta'; -import { TreeNode } from 'primeng/primeng'; - -@Component({ - selector: 'of-sensor-setting', - templateUrl: './setting.component.html', - encapsulation: ViewEncapsulation.None -}) -export class SettingComponent implements OnInit, DoCheck, OnChanges { - - @Input() preTarget: Target; - @Output() close = new EventEmitter(); - @Input() visible; - - nextable = false; - selectedTarget: Target; - selectedCrawler: MetaCrawler; - credentialPassed: boolean; - selectedSensorDisplayItems: MetaSensorDisplayItem[]; - itemNodes: TreeNode[]; - step = 0; - page = 1; - - sensorItemKeys$: StateObservable; - - - constructor( - private keyListStore: Store - ) { - keyListStore.pipe(select(ReadSensorItemKeySelector.select('list'))); - } - - ngOnInit() { - this.step = this.preTarget ? 1 : 0; - // this.sensorItemKeys$.subscribe( - // (list: MetaSensorItemKey[]) => { - // if (list !== null) { - // console.log(list); - // } - // }, - // (error: RPCClientError) => { - // console.log(error.response.message); - // } - // ); - } - - ngOnChanges(changes) { - this.step = this.preTarget ? 1 : 0; - } - - ngDoCheck() { - try { - if ( - this.selectedTarget === null || - this.selectedCrawler === null || - this.itemNodes === null || - this.itemNodes.length === 0 || - !this.credentialPassed - ) { - this.nextable = false; - } else { - this.nextable = true; - } - } catch (exception) { - this.nextable = false; - } - } - - onCancel() { - this.page = 1; - this.step = 0; - this.visible = false; - this.nextable = false; - this.selectedTarget = null; - this.selectedCrawler = null; - this.credentialPassed = false; - this.selectedSensorDisplayItems = null; - this.close.emit(); - } - - onNext() { - this.page += 1; - } - - onPrev() { - this.page -= 1; - } - - onDone() { - this.selectedSensorDisplayItems = []; - for (const node of this.itemNodes) { - if (node.data && node.data !== undefined) { - this.selectedSensorDisplayItems.push(node.data); - } - } - console.log(this.selectedSensorDisplayItems); - } - - 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/@overflow/sensor/component/setting.1/target-selector/target-selector.component.html b/@overflow/sensor/component/setting.1/target-selector/target-selector.component.html deleted file mode 100644 index 1758fe1..0000000 --- a/@overflow/sensor/component/setting.1/target-selector/target-selector.component.html +++ /dev/null @@ -1,11 +0,0 @@ -
- - -
- -
{{ target.displayName }}
-
-
-
-
diff --git a/@overflow/sensor/component/setting.1/target-selector/target-selector.component.spec.ts b/@overflow/sensor/component/setting.1/target-selector/target-selector.component.spec.ts deleted file mode 100644 index c13ee67..0000000 --- a/@overflow/sensor/component/setting.1/target-selector/target-selector.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { TargetSelectorComponent } from './target-selector.component'; - -describe('FilterComponent', () => { - let component: TargetSelectorComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ TargetSelectorComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(TargetSelectorComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/@overflow/sensor/component/setting.1/target-selector/target-selector.component.ts b/@overflow/sensor/component/setting.1/target-selector/target-selector.component.ts deleted file mode 100644 index 144a77e..0000000 --- a/@overflow/sensor/component/setting.1/target-selector/target-selector.component.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { Component, OnInit, Output, EventEmitter, Input, AfterContentInit, OnChanges } from '@angular/core'; -import { Router } from '@angular/router'; -import { Target } from '@overflow/commons-typescript/model/target'; -import { RPCClientError } from '@loafer/ng-rpc'; -import { Domain } from '@overflow/commons-typescript/model/domain'; -import { AuthSelector } from '@overflow/member/store'; -import * as ListStore from '@overflow/infra/store/list'; -import { ListSelector } from '@overflow/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', -}) -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; - - constructor( - private router: Router, - private store: Store - ) { } - - ngOnInit() { - // this.targets$.subscribe( - // (page: Page) => { - // if (page !== null) { - // this.convertInfraToTarget(page); - // } - // }, - // (error: RPCClientError) => { - // console.log(error.response.message); - // } - // ); - } - - ngOnChanges(changes) { - this.targets = []; - if (this.preTarget === null) { - this.getTargetList(); - } else { - this.targets.push(this.preTarget); - this.targetSelected.emit(this.preTarget); - } - } - - // 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); - // } - // ); - - // 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); - } - } - - onSelectionChange(event) { - this.targetSelected.emit(event.value[0]); - } - -} diff --git a/@overflow/sensor/container/index.ts b/@overflow/sensor/container/index.ts new file mode 100644 index 0000000..2435478 --- /dev/null +++ b/@overflow/sensor/container/index.ts @@ -0,0 +1,7 @@ +import { SensorListContainerComponent } from './sensor-list-container'; +import { SensorDetailContainerComponent } from './sensor-detail-container'; + +export const CONTAINER_COMPONENTS = [ + SensorListContainerComponent, + SensorDetailContainerComponent +]; diff --git a/@overflow/sensor/container/sensor-detail-container.html b/@overflow/sensor/container/sensor-detail-container.html new file mode 100644 index 0000000..b557836 --- /dev/null +++ b/@overflow/sensor/container/sensor-detail-container.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/@overflow/sensor/container/sensor-detail-container.ts b/@overflow/sensor/container/sensor-detail-container.ts new file mode 100644 index 0000000..fc06b6d --- /dev/null +++ b/@overflow/sensor/container/sensor-detail-container.ts @@ -0,0 +1,14 @@ +import { Component } from '@angular/core'; +import { Observable } from 'rxjs'; +import { Store, select } from '@ngrx/store'; +// import * as ProbeStore from '../store/entity/probe'; +// import { ProbeEntitySelector, ProbeDetailContainerSelector } from '../store'; + +@Component({ + selector: 'of-sensor-detail-container', + templateUrl: './sensor-detail-container.html', +}) +export class SensorDetailContainerComponent { + + +} diff --git a/@overflow/sensor/container/sensor-list-container.html b/@overflow/sensor/container/sensor-list-container.html new file mode 100644 index 0000000..6844dda --- /dev/null +++ b/@overflow/sensor/container/sensor-list-container.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/@overflow/sensor/container/sensor-list-container.ts b/@overflow/sensor/container/sensor-list-container.ts new file mode 100644 index 0000000..171adbe --- /dev/null +++ b/@overflow/sensor/container/sensor-list-container.ts @@ -0,0 +1,16 @@ +import { Component, EventEmitter, Output } from '@angular/core'; +import { Observable } from 'rxjs'; +import { Store, select } from '@ngrx/store'; +import { Sensor } from '@overflow/commons-typescript/model/sensor'; +// import * as ProbeStore from '../store/entity/probe'; +// import { ProbeEntitySelector, ProbeListContainerSelector } from '../store'; + +@Component({ + selector: 'of-sensor-list-container', + templateUrl: './sensor-list-container.html', +}) +export class SensorListContainerComponent { + + @Output() select = new EventEmitter(); + +} diff --git a/@overflow/sensor/sensor.module.ts b/@overflow/sensor/sensor.module.ts index e5b7e8c..f3c2e27 100644 --- a/@overflow/sensor/sensor.module.ts +++ b/@overflow/sensor/sensor.module.ts @@ -7,6 +7,7 @@ import { SERVICES } from './service'; import { SensorStoreModule } from './sensor-store.module'; import { SensorItemModule } from '../sensor-item/sensor-item.module'; import { KeyValueModule } from '@overflow/commons/component/key-value/key-value.module'; +import { CONTAINER_COMPONENTS } from './container'; // import { MetaCrawlerModule } from '../meta/crawler/crawler.module'; // import { MetaSensorDisplayItemModule } from '../meta/sensor-display-item/sensor-display-item.module'; // import { MetaCrawlerInputItemModule } from '../meta/crawler-input-item/crawler-input.module'; @@ -23,9 +24,11 @@ import { KeyValueModule } from '@overflow/commons/component/key-value/key-value. KeyValueModule ], declarations: [ + CONTAINER_COMPONENTS, COMPONENTS, ], exports: [ + CONTAINER_COMPONENTS, COMPONENTS, ], providers: [ diff --git a/src/app/commons/component/layout/menu/app.menu.component.ts b/src/app/commons/component/layout/menu/app.menu.component.ts index 5cfe4d8..21316f0 100644 --- a/src/app/commons/component/layout/menu/app.menu.component.ts +++ b/src/app/commons/component/layout/menu/app.menu.component.ts @@ -23,7 +23,7 @@ export class AppMenuComponent implements OnInit { { label: 'Infra', icon: 'all_inclusive', items: [ { label: 'Map', icon: 'map', routerLink: ['/map'] }, - { label: 'Sensors', icon: 'compare_arrows', routerLink: ['/sensors'] }, + { label: 'Sensors', icon: 'compare_arrows', routerLink: ['/sensor/list'] }, { label: 'Probes', icon: 'dock', routerLink: ['/probe/list'] }, ] }, diff --git a/src/app/pages/pages-routing.module.ts b/src/app/pages/pages-routing.module.ts index da36dea..0c83c27 100644 --- a/src/app/pages/pages-routing.module.ts +++ b/src/app/pages/pages-routing.module.ts @@ -12,8 +12,7 @@ const routes: Routes = [ { path: 'probe', loadChildren: './probes/probe-tab-page.module#ProbeTabPageModule' }, { path: 'discovery', loadChildren: './discovery/discovery-page.module#DiscoveryPageModule' }, { path: 'map', loadChildren: './infra/infra-page.module#InfraPageModule' }, - // { path: 'sensors', loadChildren: './sensors/sensors-page.module#SensorsPageModule' }, - // { path: 'sensor', loadChildren: './sensor/sensor-page.module#SensorPageModule' }, + { path: 'sensor', loadChildren: './sensors/sensor-tab-page.module#SensorTabPageModule' }, // { path: 'target', loadChildren: './target/target-page.module#TargetPageModule' }, // { path: 'overview', loadChildren: './overview/overview-page.module#OverviewPageModule' }, // { path: 'dashboard', loadChildren: './dashboard/dashboard-page.module#DashboardPageModule' }, diff --git a/src/app/pages/sensor/sensor-page-routing.module.ts b/src/app/pages/sensor_b/sensor-page-routing.module.ts similarity index 100% rename from src/app/pages/sensor/sensor-page-routing.module.ts rename to src/app/pages/sensor_b/sensor-page-routing.module.ts diff --git a/src/app/pages/sensor/sensor-page.component.html b/src/app/pages/sensor_b/sensor-page.component.html similarity index 100% rename from src/app/pages/sensor/sensor-page.component.html rename to src/app/pages/sensor_b/sensor-page.component.html diff --git a/src/app/pages/sensor/sensor-page.component.spec.ts b/src/app/pages/sensor_b/sensor-page.component.spec.ts similarity index 100% rename from src/app/pages/sensor/sensor-page.component.spec.ts rename to src/app/pages/sensor_b/sensor-page.component.spec.ts diff --git a/src/app/pages/sensor/sensor-page.component.ts b/src/app/pages/sensor_b/sensor-page.component.ts similarity index 100% rename from src/app/pages/sensor/sensor-page.component.ts rename to src/app/pages/sensor_b/sensor-page.component.ts diff --git a/src/app/pages/sensor/sensor-page.module.ts b/src/app/pages/sensor_b/sensor-page.module.ts similarity index 100% rename from src/app/pages/sensor/sensor-page.module.ts rename to src/app/pages/sensor_b/sensor-page.module.ts diff --git a/src/app/pages/sensors/sensor-tab-page-routing.module.ts b/src/app/pages/sensors/sensor-tab-page-routing.module.ts new file mode 100644 index 0000000..0d0a1d0 --- /dev/null +++ b/src/app/pages/sensors/sensor-tab-page-routing.module.ts @@ -0,0 +1,21 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import { SensorTabPageComponent } from './sensor-tab-page.component'; + +const routes: Routes = [ + { + path: '', + component: SensorTabPageComponent, + children: [ + { path: 'list', loadChildren: './sensor/sensor-page.module#SensorPageModule' }, + { path: ':id/info', loadChildren: './sensor/sensor-page.module#SensorPageModule' }, + { path: ':id/history', component: null }, + ] + }, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class SensorTabPageRoutingModule { } diff --git a/src/app/pages/sensors/sensor-tab-page.component.html b/src/app/pages/sensors/sensor-tab-page.component.html new file mode 100644 index 0000000..55b3c04 --- /dev/null +++ b/src/app/pages/sensors/sensor-tab-page.component.html @@ -0,0 +1,12 @@ +
+
+
+
+ +
+
+ +
+
+
+
diff --git a/src/app/pages/sensors/sensor-tab-page.component.ts b/src/app/pages/sensors/sensor-tab-page.component.ts new file mode 100644 index 0000000..148e253 --- /dev/null +++ b/src/app/pages/sensors/sensor-tab-page.component.ts @@ -0,0 +1,40 @@ +import { Component, OnDestroy } from '@angular/core'; +import { Router, NavigationEnd } from '@angular/router'; +import { Subscription } from 'rxjs/Subscription'; + +@Component({ + selector: 'of-pages-sensor-tab', + templateUrl: './sensor-tab-page.component.html', +}) +export class SensorTabPageComponent implements OnDestroy { + + tabs; + routerSubscription$: Subscription; + + constructor( + private router: Router + ) { + this.routerSubscription$ = this.router.events.subscribe((event) => { + if (event instanceof NavigationEnd) { + this.generateTabMenu(event); + } + }); + } + + ngOnDestroy() { + this.routerSubscription$.unsubscribe(); + } + + generateTabMenu(event: NavigationEnd) { + try { + const parsedUrl = event.url.split('sensor/')[1].split('/')[0]; + this.tabs = parsedUrl === 'list' ? null : [ + { label: 'INFO', routerLink: ['/sensor/', parsedUrl, 'info'] }, + { label: 'HISTORY', path: ['/sensor/', parsedUrl, 'history'], disabled: true }, + ]; + } catch { + this.router.navigate(['error']); + } + } + +} diff --git a/src/app/pages/sensors/sensor-tab-page.module.ts b/src/app/pages/sensors/sensor-tab-page.module.ts new file mode 100644 index 0000000..288e930 --- /dev/null +++ b/src/app/pages/sensors/sensor-tab-page.module.ts @@ -0,0 +1,22 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { SensorTabPageComponent } from './sensor-tab-page.component'; +import { SensorTabPageRoutingModule } from './sensor-tab-page-routing.module'; +import { PrimeNGModules } from '@overflow/commons/prime-ng/prime-ng.module'; +import { SensorModule } from '@overflow/sensor/sensor.module'; +import { TabbarModule } from '../../commons/component/layout/tabbar/app.tabbar.module'; + +@NgModule({ + imports: [ + CommonModule, + SensorTabPageRoutingModule, + PrimeNGModules, + SensorModule, + TabbarModule, + ], + declarations: [ + SensorTabPageComponent, + ] +}) +export class SensorTabPageModule { } diff --git a/src/app/pages/sensors/sensor/sensor-page-routing.module.ts b/src/app/pages/sensors/sensor/sensor-page-routing.module.ts new file mode 100644 index 0000000..82a32ff --- /dev/null +++ b/src/app/pages/sensors/sensor/sensor-page-routing.module.ts @@ -0,0 +1,16 @@ +import { NgModule } from '@angular/core'; +import { Routes, RouterModule } from '@angular/router'; +import { SensorPageComponent } from './sensor-page.component'; + +const routes: Routes = [ + { + path: '', + component: SensorPageComponent, + }, +]; + +@NgModule({ + imports: [RouterModule.forChild(routes)], + exports: [RouterModule] +}) +export class SensorPageRoutingModule { } diff --git a/src/app/pages/sensors/sensor/sensor-page.component.html b/src/app/pages/sensors/sensor/sensor-page.component.html new file mode 100644 index 0000000..03f3b31 --- /dev/null +++ b/src/app/pages/sensors/sensor/sensor-page.component.html @@ -0,0 +1,11 @@ +
+ +
+ + + + + \ No newline at end of file diff --git a/src/app/pages/sensors/sensor/sensor-page.component.ts b/src/app/pages/sensors/sensor/sensor-page.component.ts new file mode 100644 index 0000000..3e937b7 --- /dev/null +++ b/src/app/pages/sensors/sensor/sensor-page.component.ts @@ -0,0 +1,50 @@ +import { Component, OnDestroy } from '@angular/core'; +import { Router, ActivatedRoute, NavigationEnd } from '@angular/router'; +import { Subscription } from 'rxjs/Subscription'; +import { Sensor } from '@overflow/commons-typescript/model/sensor'; +import { BreadcrumbService } from '@app/commons/service/breadcrumb.service'; + +@Component({ + selector: 'of-pages-sensor', + templateUrl: './sensor-page.component.html', +}) +export class SensorPageComponent { + + isDetail: boolean; + sensorID: string; + + constructor( + private router: Router, + private route: ActivatedRoute, + private breadcrumbService: BreadcrumbService + ) { + this.route.params.subscribe(params => { + if (params['id']) { + this.onDetailContainer(params['id']); + } else { + this.onListContainer(); + } + }); + } + + onListContainer() { + this.breadcrumbService.setItems([ + { label: 'Sensor', routerLink: ['/sensor/list'], } + ]); + this.isDetail = false; + } + + onDetailContainer(sensorHostID: string) { + this.sensorID = sensorHostID; + this.breadcrumbService.setItems([ + { label: 'Sensor', routerLink: ['/sensor/list'] }, + { label: this.sensorID } + ]); + this.isDetail = true; + } + + onSensorSelect(sensor: Sensor) { + this.router.navigate(['sensor', sensor.id, 'info']); + } + +} diff --git a/src/app/pages/sensors/sensor/sensor-page.module.ts b/src/app/pages/sensors/sensor/sensor-page.module.ts new file mode 100644 index 0000000..9e1f82e --- /dev/null +++ b/src/app/pages/sensors/sensor/sensor-page.module.ts @@ -0,0 +1,19 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; + +import { PrimeNGModules } from '@overflow/commons/prime-ng/prime-ng.module'; +import { SensorPageComponent } from './sensor-page.component'; +import { SensorPageRoutingModule } from './sensor-page-routing.module'; +import { SensorModule } from '@overflow/sensor/sensor.module'; + +@NgModule({ + imports: [ + CommonModule, + SensorPageRoutingModule, + SensorModule + ], + entryComponents: [ + ], + declarations: [SensorPageComponent] +}) +export class SensorPageModule { } diff --git a/src/app/pages/sensors/sensors-page-routing.module.ts b/src/app/pages/sensors_b/sensors-page-routing.module.ts similarity index 100% rename from src/app/pages/sensors/sensors-page-routing.module.ts rename to src/app/pages/sensors_b/sensors-page-routing.module.ts diff --git a/src/app/pages/sensors/sensors-page.component.html b/src/app/pages/sensors_b/sensors-page.component.html similarity index 100% rename from src/app/pages/sensors/sensors-page.component.html rename to src/app/pages/sensors_b/sensors-page.component.html diff --git a/src/app/pages/sensors/sensors-page.component.spec.ts b/src/app/pages/sensors_b/sensors-page.component.spec.ts similarity index 100% rename from src/app/pages/sensors/sensors-page.component.spec.ts rename to src/app/pages/sensors_b/sensors-page.component.spec.ts diff --git a/src/app/pages/sensors/sensors-page.component.ts b/src/app/pages/sensors_b/sensors-page.component.ts similarity index 100% rename from src/app/pages/sensors/sensors-page.component.ts rename to src/app/pages/sensors_b/sensors-page.component.ts diff --git a/src/app/pages/sensors/sensors-page.module.ts b/src/app/pages/sensors_b/sensors-page.module.ts similarity index 100% rename from src/app/pages/sensors/sensors-page.module.ts rename to src/app/pages/sensors_b/sensors-page.module.ts