From 2dab359c06daa6848f252b6f1f1a3936e7eb3848 Mon Sep 17 00:00:00 2001 From: insanity Date: Mon, 16 Apr 2018 15:00:05 +0900 Subject: [PATCH] sensor pages --- src/app/pages/pages-routing.module.ts | 1 - src/app/pages/pages.module.ts | 2 ++ src/app/pages/probe/probe-page.component.ts | 6 ++-- src/app/pages/probe/probe-page.module.ts | 2 +- .../sensor/sensor-page-routing.module.ts | 6 ++-- .../pages/sensor/sensor-page.component.html | 10 +++--- src/app/pages/sensor/sensor-page.component.ts | 4 +-- src/app/pages/sensor/sensor-page.module.ts | 2 ++ .../pages/sensors/sensors-page.component.html | 1 - .../pages/sensors/sensors-page.component.ts | 1 - .../component/detail/detail.component.ts | 33 +++++++++---------- src/packages/sensor/component/index.ts | 6 ++-- .../sensor/component/list/list.component.html | 30 +++++++++++++++-- .../sensor/component/list/list.component.ts | 28 ++++++++-------- 14 files changed, 76 insertions(+), 56 deletions(-) diff --git a/src/app/pages/pages-routing.module.ts b/src/app/pages/pages-routing.module.ts index 6523f95..c58f2a2 100644 --- a/src/app/pages/pages-routing.module.ts +++ b/src/app/pages/pages-routing.module.ts @@ -15,7 +15,6 @@ const routes: Routes = [ { path: 'sensor', loadChildren: './sensor/sensor-page.module#SensorPageModule' }, // { path: 'discovery', loadChildren: './discovery/discovery-page.module#DiscoveryPageModule' }, { path: 'map', loadChildren: './infra/infra-page.module#InfraPageModule' }, - // { path: 'sensor-setting', loadChildren: './sensor-setting/sensor-setting-page.module#SensorSettingPageModule' }, // { 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/pages.module.ts b/src/app/pages/pages.module.ts index 0557889..439840c 100644 --- a/src/app/pages/pages.module.ts +++ b/src/app/pages/pages.module.ts @@ -18,6 +18,7 @@ import { PagesComponent } from './pages.component'; import { PagesRoutingModule } from './pages-routing.module'; import { LocationStrategy, HashLocationStrategy } from '@angular/common'; import { PrimeNGModules } from 'packages/commons/prime-ng/prime-ng.module'; +import { TabbarModule } from 'app/commons/component/layout/tabbar/app.tabbar.module'; @NgModule({ imports: [ @@ -25,6 +26,7 @@ import { PrimeNGModules } from 'packages/commons/prime-ng/prime-ng.module'; PagesRoutingModule, LocalizationModule, PrimeNGModules, + TabbarModule ], declarations: [ PagesComponent, diff --git a/src/app/pages/probe/probe-page.component.ts b/src/app/pages/probe/probe-page.component.ts index f6fa0d7..a46f4a9 100644 --- a/src/app/pages/probe/probe-page.component.ts +++ b/src/app/pages/probe/probe-page.component.ts @@ -22,9 +22,9 @@ export class ProbePageComponent implements OnInit { // ]; this.tabs = [ - { label: 'Info', routerLink: ['/probe/', id, 'info'], path: '/probe/' + id, icon: 'fa-check' }, - { label: 'Targets', routerLink: ['/probe/', id, 'targets'], icon: 'fa-check' }, - { label: 'History', routerLink: ['/probe/', id, 'history'], icon: 'fa-check', disabled: true }, + { label: 'INFO', routerLink: ['/probe/', id, 'info'], path: '/probe/' + id, icon: 'fa-check' }, + { label: 'TARGETS', routerLink: ['/probe/', id, 'targets'], icon: 'fa-check' }, + { label: 'HISTORY', routerLink: ['/probe/', id, 'history'], icon: 'fa-check', disabled: true }, ]; } diff --git a/src/app/pages/probe/probe-page.module.ts b/src/app/pages/probe/probe-page.module.ts index a6573fb..a292fc1 100644 --- a/src/app/pages/probe/probe-page.module.ts +++ b/src/app/pages/probe/probe-page.module.ts @@ -6,7 +6,7 @@ import { ProbePageComponent } from './probe-page.component'; import { ProbePageRoutingModule } from './probe-page-routing.module'; import { PrimeNGModules } from 'packages/commons/prime-ng/prime-ng.module'; import { ProbeModule } from 'packages/probe/probe.module'; -import { TabbarModule } from '../../commons/component/layout/tabbar/app.tabbar.module'; +import { TabbarModule } from 'app/commons/component/layout/tabbar/app.tabbar.module'; @NgModule({ imports: [ diff --git a/src/app/pages/sensor/sensor-page-routing.module.ts b/src/app/pages/sensor/sensor-page-routing.module.ts index 1f2f47b..64d83c2 100644 --- a/src/app/pages/sensor/sensor-page-routing.module.ts +++ b/src/app/pages/sensor/sensor-page-routing.module.ts @@ -1,15 +1,15 @@ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; import { SensorPageComponent } from './sensor-page.component'; -// import { DetailComponent } from 'packages/sensor/component/detail/detail.component'; +import { DetailComponent } from 'packages/sensor/component/detail/detail.component'; const routes: Routes = [ { path: '', component: SensorPageComponent, children: [ - // { path: ':id', component: DetailComponent }, - // { path: ':id/history', component: null }, + { path: ':id/info', component: DetailComponent }, + { path: ':id/history', component: null }, ] } ]; diff --git a/src/app/pages/sensor/sensor-page.component.html b/src/app/pages/sensor/sensor-page.component.html index 52f223f..0328d41 100644 --- a/src/app/pages/sensor/sensor-page.component.html +++ b/src/app/pages/sensor/sensor-page.component.html @@ -2,12 +2,10 @@
-

Sensors

- - -
- -
+ +
+
+
diff --git a/src/app/pages/sensor/sensor-page.component.ts b/src/app/pages/sensor/sensor-page.component.ts index 05dccf5..2cb4e3a 100644 --- a/src/app/pages/sensor/sensor-page.component.ts +++ b/src/app/pages/sensor/sensor-page.component.ts @@ -16,8 +16,8 @@ export class SensorPageComponent implements OnInit { const id = this.router.url.split('sensor/')[1].split('/')[0]; this.tabs = [ - { label: 'Info', path: '/sensor/' + id }, - { label: 'History', path: '/sensor/' + id + '/history' }, + { label: 'INFO', routerLink: ['/sensor/' + id, 'info'] }, + { label: 'HISTORY', path: ['/sensor/' + id, 'history'], disabled: true }, ]; } diff --git a/src/app/pages/sensor/sensor-page.module.ts b/src/app/pages/sensor/sensor-page.module.ts index a4e8977..43fdd6b 100644 --- a/src/app/pages/sensor/sensor-page.module.ts +++ b/src/app/pages/sensor/sensor-page.module.ts @@ -4,12 +4,14 @@ import { CommonModule } from '@angular/common'; import { SensorModule } from 'packages/sensor/sensor.module'; import { SensorPageRoutingModule } from './sensor-page-routing.module'; import { SensorPageComponent } from './sensor-page.component'; +import { TabbarModule } from 'app/commons/component/layout/tabbar/app.tabbar.module'; @NgModule({ imports: [ CommonModule, SensorPageRoutingModule, SensorModule, + TabbarModule ], declarations: [ SensorPageComponent, diff --git a/src/app/pages/sensors/sensors-page.component.html b/src/app/pages/sensors/sensors-page.component.html index 63ec980..8058f5f 100644 --- a/src/app/pages/sensors/sensors-page.component.html +++ b/src/app/pages/sensors/sensors-page.component.html @@ -2,7 +2,6 @@
-

Sensors

diff --git a/src/app/pages/sensors/sensors-page.component.ts b/src/app/pages/sensors/sensors-page.component.ts index ba02598..a4160c4 100644 --- a/src/app/pages/sensors/sensors-page.component.ts +++ b/src/app/pages/sensors/sensors-page.component.ts @@ -9,7 +9,6 @@ export class SensorsPageComponent implements OnInit { tabs = [ { label: 'Overview', path: '/sensors' }, { label: 'History', path: '/sensors/history' }, - { label: 'Settings', path: '/sensors/setting' }, ]; constructor() { } diff --git a/src/packages/sensor/component/detail/detail.component.ts b/src/packages/sensor/component/detail/detail.component.ts index cb9b5c2..42ffd10 100644 --- a/src/packages/sensor/component/detail/detail.component.ts +++ b/src/packages/sensor/component/detail/detail.component.ts @@ -1,22 +1,19 @@ -// import { Component, OnInit, Inject } from '@angular/core'; -// import { ActivatedRoute, Router } from '@angular/router'; -// import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; -// import { ConfirmDialogComponent } from 'packages/commons/component/confirm-dialog/confirm-dialog.component'; +import { Component, OnInit, Inject } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; -// @Component({ -// selector: 'of-sensor-detail', -// templateUrl: './detail.component.html', -// styleUrls: ['./detail.component.scss'] -// }) -// export class DetailComponent implements OnInit { +@Component({ + selector: 'of-sensor-detail', + templateUrl: './detail.component.html', + styleUrls: ['./detail.component.scss'] +}) +export class DetailComponent implements OnInit { -// constructor( -// private route: ActivatedRoute, -// private router: Router, -// public dialog: MatDialog, -// ) { } + constructor( + private route: ActivatedRoute, + private router: Router, + ) { } -// ngOnInit() { -// } -// } + ngOnInit() { + } +} diff --git a/src/packages/sensor/component/index.ts b/src/packages/sensor/component/index.ts index cd7f7ce..be62731 100644 --- a/src/packages/sensor/component/index.ts +++ b/src/packages/sensor/component/index.ts @@ -6,10 +6,9 @@ import { CrawlerSelectorComponent } from './setting/crawler-selector/crawler-sel 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 { DetailComponent } from './detail/detail.component'; // import { FilterComponent } from './list/filter/filter.component'; -// import { DetailComponent } from './detail/detail.component'; // import { TargetSelectorComponent } from './setting/target-selector/target-selector.component'; -// import { NameTagComponent } from './name-tag/name-tag.component'; export const COMPONENTS = [ SettingComponent, @@ -19,8 +18,7 @@ export const COMPONENTS = [ SensorItemSelectorComponent, SettingETCComponent, ListComponent, + DetailComponent, // FilterComponent, - // DetailComponent, // SettingETCComponent, - // NameTagComponent, ]; diff --git a/src/packages/sensor/component/list/list.component.html b/src/packages/sensor/component/list/list.component.html index 9b860ad..c521f4f 100644 --- a/src/packages/sensor/component/list/list.component.html +++ b/src/packages/sensor/component/list/list.component.html @@ -1,11 +1,35 @@ +

Sensors

+
- - + +
-
sensor list
\ No newline at end of file + + + + + No. + Description + Status + Crawler + Items + Created at + + + + + {{rowIndex + 1}} + {{sensor.Description}} + {{sensor.status.name}} + {{sensor.crawler.name}} + ??? + {{sensor.createDate | date: 'dd.MM.yyyy'}} + + + \ No newline at end of file diff --git a/src/packages/sensor/component/list/list.component.ts b/src/packages/sensor/component/list/list.component.ts index d06e270..3ce652e 100644 --- a/src/packages/sensor/component/list/list.component.ts +++ b/src/packages/sensor/component/list/list.component.ts @@ -28,6 +28,7 @@ export class ListComponent implements OnInit, AfterContentInit { totalLength = 0; sensorSettingDisplay = false; + sensors: Sensor[]; target: Target = null; constructor(private router: Router, @@ -35,20 +36,21 @@ export class ListComponent implements OnInit, AfterContentInit { ) { } ngOnInit() { - // this.sensorList$.subscribe( - // (page: Page) => { - // if (page != null) { - // this.totalLength = page.totalElements; - // } - // }, - // (error: RPCClientError) => { - // console.log(error.response.message); - // } - // ); + this.sensorList$.subscribe( + (page: Page) => { + if (page != null) { + this.sensors = page.content; + this.totalLength = page.totalElements; + } + }, + (error: RPCClientError) => { + console.log(error.response.message); + } + ); } ngAfterContentInit() { - // this.getSensors(0); + this.getSensors(0); } getSensors(pageIndex: number) { @@ -69,8 +71,8 @@ export class ListComponent implements OnInit, AfterContentInit { ); } - handleRowClick(obj: Sensor) { - this.router.navigate(['target', obj.id]); + onRowSelect(event) { + this.router.navigate(['sensor', event.data.id, 'info']); } onAddSensor() {