diff --git a/@overflow/sensor/component/index.ts b/@overflow/sensor/component/index.ts index 0a3070e..8681872 100644 --- a/@overflow/sensor/component/index.ts +++ b/@overflow/sensor/component/index.ts @@ -1,7 +1,9 @@ import { SensorListComponent } from './list/list.component'; import { SensorDetailComponent } from './detail/detail.component'; +import { SensorSettingComponent } from './setting/setting.component'; export const COMPONENTS = [ SensorListComponent, SensorDetailComponent, + SensorSettingComponent, ]; diff --git a/@overflow/sensor/component/list/list.component.html b/@overflow/sensor/component/list/list.component.html index 48adc49..18f6f16 100644 --- a/@overflow/sensor/component/list/list.component.html +++ b/@overflow/sensor/component/list/list.component.html @@ -21,7 +21,7 @@
- +
@@ -82,7 +82,7 @@
- +
diff --git a/@overflow/sensor/component/list/list.component.ts b/@overflow/sensor/component/list/list.component.ts index c7c58b7..6509d91 100644 --- a/@overflow/sensor/component/list/list.component.ts +++ b/@overflow/sensor/component/list/list.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnInit, OnChanges, SimpleChanges } from '@angular/core'; +import { Component, Input, OnInit, OnChanges, SimpleChanges, Output, EventEmitter } 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'; @@ -10,6 +10,7 @@ import { Target } from '@overflow/commons-typescript/model/target'; export class SensorListComponent implements OnChanges { @Input() page: Page; + @Output() addSensor = new EventEmitter(); totalLength: number; targetSensors: Object; @@ -55,6 +56,7 @@ export class SensorListComponent implements OnChanges { return targetNode; } + // generateTargetFilter() { // if (this.targetOptions) { // return; diff --git a/@overflow/sensor/component/setting/setting.component.ts b/@overflow/sensor/component/setting/setting.component.ts index 85b48dc..d7247a6 100644 --- a/@overflow/sensor/component/setting/setting.component.ts +++ b/@overflow/sensor/component/setting/setting.component.ts @@ -4,7 +4,7 @@ import { Component } from '@angular/core'; selector: 'of-sensor-setting', templateUrl: './setting.component.html', }) -export class SettingComponent { +export class SensorSettingComponent { constructor( diff --git a/@overflow/sensor/container/sensor-list-container.component.html b/@overflow/sensor/container/sensor-list-container.component.html index 338b9c4..1f9f7ad 100644 --- a/@overflow/sensor/container/sensor-list-container.component.html +++ b/@overflow/sensor/container/sensor-list-container.component.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/@overflow/sensor/container/sensor-list-container.component.ts b/@overflow/sensor/container/sensor-list-container.component.ts index 121894c..8e70f35 100644 --- a/@overflow/sensor/container/sensor-list-container.component.ts +++ b/@overflow/sensor/container/sensor-list-container.component.ts @@ -8,6 +8,7 @@ import { AuthSelector } from '../../member/store'; import { Domain } from '@overflow/commons-typescript/model/domain'; import { PageParams } from '@overflow/commons-typescript/model/commons/PageParams'; import { Page } from '@overflow/commons-typescript/model/commons/Page'; +import { Target } from '@overflow/commons-typescript/model/target'; @Component({ selector: 'of-sensor-list-container', @@ -17,6 +18,7 @@ export class SensorListContainerComponent implements OnInit { page$: Observable>; @Output() select = new EventEmitter(); + @Output() addSensor = new EventEmitter(); constructor(private store: Store) { this.page$ = store.pipe(select(SensorPageSelector)); @@ -38,4 +40,5 @@ export class SensorListContainerComponent implements OnInit { } ); } + } diff --git a/@overflow/sensor/container/sensor-setting-container.component.html b/@overflow/sensor/container/sensor-setting-container.component.html index b92bc2c..c1a506a 100644 --- a/@overflow/sensor/container/sensor-setting-container.component.html +++ b/@overflow/sensor/container/sensor-setting-container.component.html @@ -1 +1 @@ -
SENSOR_ADD_CONTAINER
\ No newline at end of file + \ No newline at end of file diff --git a/src/app/pages/sensors/sensor-tab-page.component.ts b/src/app/pages/sensors/sensor-tab-page.component.ts index 148e253..428c5f9 100644 --- a/src/app/pages/sensors/sensor-tab-page.component.ts +++ b/src/app/pages/sensors/sensor-tab-page.component.ts @@ -28,7 +28,7 @@ export class SensorTabPageComponent implements OnDestroy { generateTabMenu(event: NavigationEnd) { try { const parsedUrl = event.url.split('sensor/')[1].split('/')[0]; - this.tabs = parsedUrl === 'list' ? null : [ + this.tabs = parsedUrl === 'list' || 'setting' ? null : [ { label: 'INFO', routerLink: ['/sensor/', parsedUrl, 'info'] }, { label: 'HISTORY', path: ['/sensor/', parsedUrl, 'history'], disabled: true }, ]; diff --git a/src/app/pages/sensors/sensor/sensor-page.component.html b/src/app/pages/sensors/sensor/sensor-page.component.html index 03f3b31..e84003f 100644 --- a/src/app/pages/sensors/sensor/sensor-page.component.html +++ b/src/app/pages/sensors/sensor/sensor-page.component.html @@ -1,11 +1,8 @@
- + +
- \ 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 index e20c485..75a6f73 100644 --- a/src/app/pages/sensors/sensor/sensor-page.component.ts +++ b/src/app/pages/sensors/sensor/sensor-page.component.ts @@ -1,8 +1,8 @@ -import { Component, OnDestroy } from '@angular/core'; +import { Component } 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'; +import { Target } from '@overflow/commons-typescript/model/target'; @Component({ selector: 'of-pages-sensor', @@ -22,16 +22,14 @@ export class SensorPageComponent { if (params['id']) { this.onDetailContainer(params['id']); } else { - console.log('?'); - console.log(params); - this.onListContainer(); + this.onListSettingContainer(); } }); } - onListContainer() { + onListSettingContainer() { this.breadcrumbService.setItems([ - { label: 'Sensor', routerLink: ['/sensor/list'], } + { label: 'Sensor', routerLink: ['/sensor/list'], } ]); this.isDetail = false; } @@ -49,4 +47,14 @@ export class SensorPageComponent { this.router.navigate(['sensor', sensor.id, 'info']); } + onAddSensor(target?: Target) { + const queryParams = target ? { + target : target.id, + mode : 'NEW', + } : { + mode : 'NEW', + }; + this.router.navigate(['sensor/setting'], { queryParams: queryParams }); + } + }