diff --git a/@overflow/infra/component/map/map.component.html b/@overflow/infra/component/map/map.component.html index 5f076e9..6490929 100644 --- a/@overflow/infra/component/map/map.component.html +++ b/@overflow/infra/component/map/map.component.html @@ -78,9 +78,9 @@ - +
- + diff --git a/@overflow/sensor/component/list/list.component.ts b/@overflow/sensor/component/list/list.component.ts index d55da7e..c7c58b7 100644 --- a/@overflow/sensor/component/list/list.component.ts +++ b/@overflow/sensor/component/list/list.component.ts @@ -1,6 +1,7 @@ import { Component, Input, OnInit, OnChanges, SimpleChanges } from '@angular/core'; import { Sensor } from '@overflow/commons-typescript/model/sensor'; import { Page } from '@overflow/commons-typescript/model/commons/Page'; +import { Target } from '@overflow/commons-typescript/model/target'; @Component({ selector: 'of-sensor-list', @@ -10,8 +11,8 @@ export class SensorListComponent implements OnChanges { @Input() page: Page; - totalLength; - targetSensor; + totalLength: number; + targetSensors: Object; constructor( ) { } @@ -41,7 +42,7 @@ export class SensorListComponent implements OnChanges { } } this.totalLength = tempList.length; - this.targetSensor = tempList; + this.targetSensors = tempList; } existTarget(sensor: Sensor, tempList) { diff --git a/@overflow/sensor/component/setting/setting.component.html b/@overflow/sensor/component/setting/setting.component.html index 51eaecd..a405c0e 100644 --- a/@overflow/sensor/component/setting/setting.component.html +++ b/@overflow/sensor/component/setting/setting.component.html @@ -1,4 +1,4 @@ -

Add Sensor

+ - - - \ No newline at end of file +
SENSOR_SETTING_COMPONENT
\ No newline at end of file diff --git a/@overflow/sensor/component/setting/setting.component.ts b/@overflow/sensor/component/setting/setting.component.ts index d3679c6..85b48dc 100644 --- a/@overflow/sensor/component/setting/setting.component.ts +++ b/@overflow/sensor/component/setting/setting.component.ts @@ -1,161 +1,13 @@ -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'; +import { Component } from '@angular/core'; @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: boolean; - @Input() editMode: boolean; - - nextable = false; - selectedTarget: Target; - selectedCrawler: MetaCrawler; - credentialPassed: boolean; - selectedSensorDisplayItems: MetaSensorDisplayItem[]; - itemNodes: TreeNode[]; - step = 0; - page = 1; - - sensorItemKeys$: StateObservable; +export class SettingComponent { constructor( - private keyListStore: Store ) { - keyListStore.pipe(select(ReadSensorItemKeySelector.select('list'))); - this.editMode = true; - } - - 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/container/index.ts b/@overflow/sensor/container/index.ts index affa068..f46d623 100644 --- a/@overflow/sensor/container/index.ts +++ b/@overflow/sensor/container/index.ts @@ -1,7 +1,9 @@ import { SensorListContainerComponent } from './sensor-list-container.component'; import { SensorDetailContainerComponent } from './sensor-detail-container.component'; +import { SensorSettingContainerComponent } from './sensor-setting-container.component'; export const CONTAINER_COMPONENTS = [ SensorListContainerComponent, - SensorDetailContainerComponent + SensorDetailContainerComponent, + SensorSettingContainerComponent ]; diff --git a/@overflow/sensor/container/sensor-setting-container.component.html b/@overflow/sensor/container/sensor-setting-container.component.html new file mode 100644 index 0000000..b92bc2c --- /dev/null +++ b/@overflow/sensor/container/sensor-setting-container.component.html @@ -0,0 +1 @@ +
SENSOR_ADD_CONTAINER
\ No newline at end of file diff --git a/@overflow/sensor/container/sensor-setting-container.component.ts b/@overflow/sensor/container/sensor-setting-container.component.ts new file mode 100644 index 0000000..ddae4ca --- /dev/null +++ b/@overflow/sensor/container/sensor-setting-container.component.ts @@ -0,0 +1,17 @@ +import { Component, EventEmitter, Output, OnInit } from '@angular/core'; +import { Observable } from 'rxjs'; +import { Store, select } from '@ngrx/store'; +import { Sensor } from '@overflow/commons-typescript/model/sensor'; +import * as SensorEntityStore from '../store/entity/sensor'; +import { SensorEntitySelector } from '../store'; + +@Component({ + selector: 'of-sensor-setting-container', + templateUrl: './sensor-setting-container.component.html', +}) +export class SensorSettingContainerComponent { + + constructor(private store: Store) { + } + +} diff --git a/src/app/pages/sensor_b/sensor-page-routing.module.ts b/src/app/pages/sensor_b/sensor-page-routing.module.ts deleted file mode 100644 index 7e570ac..0000000 --- a/src/app/pages/sensor_b/sensor-page-routing.module.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { NgModule } from '@angular/core'; -import { Routes, RouterModule } from '@angular/router'; -import { SensorPageComponent } from './sensor-page.component'; -import { DetailComponent } from '@overflow/sensor/component/detail/detail.component'; - -const routes: Routes = [ - { - path: '', - component: SensorPageComponent, - children: [ - { path: ':id/info', component: DetailComponent }, - { path: ':id/history', component: null }, - ] - } -]; - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule] -}) -export class SensorPageRoutingModule { } diff --git a/src/app/pages/sensor_b/sensor-page.component.html b/src/app/pages/sensor_b/sensor-page.component.html deleted file mode 100644 index 0328d41..0000000 --- a/src/app/pages/sensor_b/sensor-page.component.html +++ /dev/null @@ -1,12 +0,0 @@ -
-
-
-
- -
-
- -
-
-
-
\ No newline at end of file diff --git a/src/app/pages/sensor_b/sensor-page.component.spec.ts b/src/app/pages/sensor_b/sensor-page.component.spec.ts deleted file mode 100644 index 8c96fd5..0000000 --- a/src/app/pages/sensor_b/sensor-page.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { SensorPageComponent } from './sensor-page.component'; - -describe('SensorPageComponent', () => { - let component: SensorPageComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ SensorPageComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(SensorPageComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/pages/sensor_b/sensor-page.component.ts b/src/app/pages/sensor_b/sensor-page.component.ts deleted file mode 100644 index 2cb4e3a..0000000 --- a/src/app/pages/sensor_b/sensor-page.component.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { Router, ActivatedRoute } from '@angular/router'; - -@Component({ - selector: 'of-pages-sensor', - templateUrl: './sensor-page.component.html', -}) -export class SensorPageComponent implements OnInit { - - tabs = undefined; - - constructor(private route: ActivatedRoute, private router: Router) { - } - - ngOnInit() { - const id = this.router.url.split('sensor/')[1].split('/')[0]; - - this.tabs = [ - { label: 'INFO', routerLink: ['/sensor/' + id, 'info'] }, - { label: 'HISTORY', path: ['/sensor/' + id, 'history'], disabled: true }, - ]; - } - -} diff --git a/src/app/pages/sensor_b/sensor-page.module.ts b/src/app/pages/sensor_b/sensor-page.module.ts deleted file mode 100644 index 6ab189c..0000000 --- a/src/app/pages/sensor_b/sensor-page.module.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; - -import { SensorModule } from '@overflow/sensor/sensor.module'; -import { SensorPageRoutingModule } from './sensor-page-routing.module'; -import { SensorPageComponent } from './sensor-page.component'; -import { TabbarModule } from '../../commons/component/layout/tabbar/app.tabbar.module'; - -@NgModule({ - imports: [ - CommonModule, - SensorPageRoutingModule, - SensorModule, - TabbarModule - ], - declarations: [ - SensorPageComponent, - ] -}) -export class SensorPageModule { } diff --git a/src/app/pages/sensors/sensor-tab-page-routing.module.ts b/src/app/pages/sensors/sensor-tab-page-routing.module.ts index 0d0a1d0..84446b7 100644 --- a/src/app/pages/sensors/sensor-tab-page-routing.module.ts +++ b/src/app/pages/sensors/sensor-tab-page-routing.module.ts @@ -8,6 +8,7 @@ const routes: Routes = [ component: SensorTabPageComponent, children: [ { path: 'list', loadChildren: './sensor/sensor-page.module#SensorPageModule' }, + { path: 'setting', loadChildren: './sensor/sensor-page.module#SensorPageModule' }, { path: ':id/info', loadChildren: './sensor/sensor-page.module#SensorPageModule' }, { path: ':id/history', component: null }, ] diff --git a/src/app/pages/sensors/sensor/sensor-page.component.ts b/src/app/pages/sensors/sensor/sensor-page.component.ts index 3e937b7..e20c485 100644 --- a/src/app/pages/sensors/sensor/sensor-page.component.ts +++ b/src/app/pages/sensors/sensor/sensor-page.component.ts @@ -22,6 +22,8 @@ export class SensorPageComponent { if (params['id']) { this.onDetailContainer(params['id']); } else { + console.log('?'); + console.log(params); this.onListContainer(); } }); @@ -34,8 +36,8 @@ export class SensorPageComponent { this.isDetail = false; } - onDetailContainer(sensorHostID: string) { - this.sensorID = sensorHostID; + onDetailContainer(sensorID: string) { + this.sensorID = sensorID; this.breadcrumbService.setItems([ { label: 'Sensor', routerLink: ['/sensor/list'] }, { label: this.sensorID } diff --git a/src/app/pages/sensors_b/sensors-page-routing.module.ts b/src/app/pages/sensors_b/sensors-page-routing.module.ts deleted file mode 100644 index 2c60e9c..0000000 --- a/src/app/pages/sensors_b/sensors-page-routing.module.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { NgModule } from '@angular/core'; -import { Routes, RouterModule } from '@angular/router'; -import { SensorsPageComponent } from './sensors-page.component'; - -const routes: Routes = [ - { - path: '', - component: SensorsPageComponent, - children: [ - // { path: '', component: SensorListComponent }, - ] - } -]; - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule] -}) -export class SensorsPageRoutingModule { } diff --git a/src/app/pages/sensors_b/sensors-page.component.html b/src/app/pages/sensors_b/sensors-page.component.html deleted file mode 100644 index 8058f5f..0000000 --- a/src/app/pages/sensors_b/sensors-page.component.html +++ /dev/null @@ -1,9 +0,0 @@ -
-
-
-
- -
-
-
-
\ No newline at end of file diff --git a/src/app/pages/sensors_b/sensors-page.component.spec.ts b/src/app/pages/sensors_b/sensors-page.component.spec.ts deleted file mode 100644 index 8120231..0000000 --- a/src/app/pages/sensors_b/sensors-page.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { SensorsPageComponent } from './sensors-page.component'; - -describe('SensorsComponent', () => { - let component: SensorsPageComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ SensorsPageComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(SensorsPageComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/pages/sensors_b/sensors-page.component.ts b/src/app/pages/sensors_b/sensors-page.component.ts deleted file mode 100644 index a4160c4..0000000 --- a/src/app/pages/sensors_b/sensors-page.component.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Component, OnInit } from '@angular/core'; - -@Component({ - selector: 'of-pages-sensors', - templateUrl: './sensors-page.component.html', -}) -export class SensorsPageComponent implements OnInit { - - tabs = [ - { label: 'Overview', path: '/sensors' }, - { label: 'History', path: '/sensors/history' }, - ]; - - constructor() { } - - ngOnInit() { - } - -} diff --git a/src/app/pages/sensors_b/sensors-page.module.ts b/src/app/pages/sensors_b/sensors-page.module.ts deleted file mode 100644 index ab1fbae..0000000 --- a/src/app/pages/sensors_b/sensors-page.module.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { SensorModule } from '@overflow/sensor/sensor.module'; -import { SensorsPageComponent } from './sensors-page.component'; -import { SensorsPageRoutingModule } from './sensors-page-routing.module'; - -@NgModule({ - imports: [ - CommonModule, - SensorsPageRoutingModule, - SensorModule - ], - declarations: [ - SensorsPageComponent - ] -}) -export class SensorsPageModule { }