ing
This commit is contained in:
parent
c47bb4fad5
commit
553c6e3759
|
@ -38,7 +38,7 @@ SENSOR_DETAIL_COMPONENT
|
||||||
<p-panel [showHeader]="false">
|
<p-panel [showHeader]="false">
|
||||||
<div class="ui-g form-group ui-key-value">
|
<div class="ui-g form-group ui-key-value">
|
||||||
<of-key-value [key]="'ID'" [value]="sensor.id"></of-key-value>
|
<of-key-value [key]="'ID'" [value]="sensor.id"></of-key-value>
|
||||||
<of-key-value [key]="'Location'" [value]="sensor.target.displayName" [clickable]="true" (click)="onTargetClick(sensor.target)"></of-key-value>
|
<of-key-value [key]="'Location'" [value]="sensor.target.displayName" [clickable]="true" (click)="selectTarget.emit(sensor.target)"></of-key-value>
|
||||||
<of-key-value [key]="'Description'" [value]="sensor.description"></of-key-value>
|
<of-key-value [key]="'Description'" [value]="sensor.description"></of-key-value>
|
||||||
<of-key-value [key]="'Crawler Type'" [value]="sensor.crawler.name"></of-key-value>
|
<of-key-value [key]="'Crawler Type'" [value]="sensor.crawler.name"></of-key-value>
|
||||||
<of-key-value [key]="'Sensor Items'" [value]="sensor.itemCount"></of-key-value>
|
<of-key-value [key]="'Sensor Items'" [value]="sensor.itemCount"></of-key-value>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Component, OnInit, Inject, AfterContentInit, OnDestroy, Input } from '@angular/core';
|
import { Component, OnInit, Inject, AfterContentInit, OnDestroy, Input, Output, EventEmitter } from '@angular/core';
|
||||||
|
|
||||||
import { Store, select } from '@ngrx/store';
|
import { Store, select } from '@ngrx/store';
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import { RPCClientError } from '@loafer/ng-rpc';
|
||||||
|
|
||||||
import { Sensor } from '@overflow/commons-typescript/model/sensor';
|
import { Sensor } from '@overflow/commons-typescript/model/sensor';
|
||||||
import { SensorService } from '../service/sensor.service';
|
import { SensorService } from '../service/sensor.service';
|
||||||
|
import { Target } from '@overflow/commons-typescript/model/target';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'of-sensor-detail',
|
selector: 'of-sensor-detail',
|
||||||
|
@ -19,6 +20,7 @@ import { SensorService } from '../service/sensor.service';
|
||||||
})
|
})
|
||||||
export class SensorDetailComponent implements OnInit, OnDestroy {
|
export class SensorDetailComponent implements OnInit, OnDestroy {
|
||||||
@Input() sensorID: number;
|
@Input() sensorID: number;
|
||||||
|
@Output() selectTarget = new EventEmitter<Target>();
|
||||||
|
|
||||||
sensor: Sensor;
|
sensor: Sensor;
|
||||||
sensorSettingDisplay: boolean;
|
sensorSettingDisplay: boolean;
|
||||||
|
@ -75,10 +77,5 @@ export class SensorDetailComponent implements OnInit, OnDestroy {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onTargetClick(target) {
|
|
||||||
// this.router.navigate(['sensors'], { queryParams: { target: target.id } });
|
|
||||||
// this.router.navigate(['target', target.id, 'info']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,10 @@ import { PageParams } from '@overflow/commons-typescript/model/commons/PageParam
|
||||||
templateUrl: './sensor-list.component.html',
|
templateUrl: './sensor-list.component.html',
|
||||||
})
|
})
|
||||||
export class SensorListComponent implements OnInit, OnChanges {
|
export class SensorListComponent implements OnInit, OnChanges {
|
||||||
|
@Input() pageNo: number;
|
||||||
@Output() select = new EventEmitter<Sensor>();
|
@Output() select = new EventEmitter<Sensor>();
|
||||||
@Output() addSensor = new EventEmitter();
|
@Output() addSensor = new EventEmitter();
|
||||||
|
|
||||||
pageNo = 1;
|
|
||||||
page: Page<Sensor>;
|
page: Page<Sensor>;
|
||||||
pending$: Observable<boolean>;
|
pending$: Observable<boolean>;
|
||||||
error$: Observable<any>;
|
error$: Observable<any>;
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { Routes, RouterModule } from '@angular/router';
|
import { Routes, RouterModule } from '@angular/router';
|
||||||
import { SensorTabPageComponent } from './sensor-tab-page.component';
|
import { SensorTabPageComponent } from './sensor-tab-page.component';
|
||||||
|
import { SensorListPageComponent } from '@app/pages/sensors/sensor/sensor-list-page.component';
|
||||||
|
import { SensorDetailPageComponent } from '@app/pages/sensors/sensor/sensor-detail-page.component';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: SensorTabPageComponent,
|
component: SensorTabPageComponent,
|
||||||
children: [
|
children: [
|
||||||
{ path: 'list', loadChildren: './sensor/sensor-page.module#SensorPageModule' },
|
{ path: 'list', component: SensorListPageComponent },
|
||||||
{ path: 'setting', loadChildren: './sensor/sensor-page.module#SensorPageModule' },
|
{ path: ':id/info', component: SensorDetailPageComponent },
|
||||||
{ path: ':id/info', loadChildren: './sensor/sensor-page.module#SensorPageModule' },
|
|
||||||
{ path: ':id/history', component: null },
|
{ path: ':id/history', component: null },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -5,6 +5,9 @@ import { UIModule } from '@overflow/shared/ui/ui.module';
|
||||||
import { SensorModule } from '@overflow/sensor/sensor.module';
|
import { SensorModule } from '@overflow/sensor/sensor.module';
|
||||||
|
|
||||||
import { SensorTabPageComponent } from './sensor-tab-page.component';
|
import { SensorTabPageComponent } from './sensor-tab-page.component';
|
||||||
|
import { SensorListPageComponent } from '@app/pages/sensors/sensor/sensor-list-page.component';
|
||||||
|
import { SensorDetailPageComponent } from '@app/pages/sensors/sensor/sensor-detail-page.component';
|
||||||
|
|
||||||
import { SensorTabPageRoutingModule } from './sensor-tab-page-routing.module';
|
import { SensorTabPageRoutingModule } from './sensor-tab-page-routing.module';
|
||||||
import { TabbarModule } from '../../commons/component/layout/tabbar/app.tabbar.module';
|
import { TabbarModule } from '../../commons/component/layout/tabbar/app.tabbar.module';
|
||||||
|
|
||||||
|
@ -18,6 +21,8 @@ import { TabbarModule } from '../../commons/component/layout/tabbar/app.tabbar.m
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
SensorTabPageComponent,
|
SensorTabPageComponent,
|
||||||
|
SensorListPageComponent,
|
||||||
|
SensorDetailPageComponent,
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class SensorTabPageModule { }
|
export class SensorTabPageModule { }
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
<of-sensor-detail [sensorID]="sensorID" (discovery)="onDiscovery($event)"></of-sensor-detail>
|
37
src/app/pages/sensors/sensor/sensor-detail-page.component.ts
Normal file
37
src/app/pages/sensors/sensor/sensor-detail-page.component.ts
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||||
|
import { Router, ActivatedRoute, NavigationEnd } from '@angular/router';
|
||||||
|
import { Subscription } from 'rxjs';
|
||||||
|
import { ProbeHost, Probe } from '@overflow/commons-typescript/model/probe';
|
||||||
|
import { Target } from '@overflow/commons-typescript/model/target';
|
||||||
|
import { BreadcrumbService } from '@app/commons/service/breadcrumb.service';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'of-pages-sensor-detail',
|
||||||
|
templateUrl: './sensor-detail-page.component.html',
|
||||||
|
})
|
||||||
|
export class SensorDetailPageComponent implements OnInit {
|
||||||
|
|
||||||
|
isDetail: boolean;
|
||||||
|
sensorID: string;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private router: Router,
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
private breadcrumbService: BreadcrumbService
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.route.params.subscribe(params => {
|
||||||
|
this.sensorID = params['id'];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onTargetSelect(target: Target) {
|
||||||
|
this.router.navigate(['target', target.id, 'info']);
|
||||||
|
}
|
||||||
|
|
||||||
|
onDiscovery(probeHostID: number) {
|
||||||
|
this.router.navigate(['discovery', probeHostID]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
<of-sensor-list [pageNo]="pageNo" (select)="onSensorSelect($event)" (addSensor)="onAddSensor($event)"></of-sensor-list>
|
43
src/app/pages/sensors/sensor/sensor-list-page.component.ts
Normal file
43
src/app/pages/sensors/sensor/sensor-list-page.component.ts
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
import { Component, OnDestroy, OnInit } from '@angular/core';
|
||||||
|
import { Router, ActivatedRoute, NavigationEnd } from '@angular/router';
|
||||||
|
import { Subscription } from 'rxjs';
|
||||||
|
import { ProbeHost, Probe } from '@overflow/commons-typescript/model/probe';
|
||||||
|
import { Target } from '@overflow/commons-typescript/model/target';
|
||||||
|
import { BreadcrumbService } from '@app/commons/service/breadcrumb.service';
|
||||||
|
import { Sensor } from '@overflow/commons-typescript/model/sensor';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'of-pages-sensor-list',
|
||||||
|
templateUrl: './sensor-list-page.component.html',
|
||||||
|
})
|
||||||
|
export class SensorListPageComponent implements OnInit {
|
||||||
|
pageNo: number;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
private router: Router,
|
||||||
|
private route: ActivatedRoute,
|
||||||
|
private breadcrumbService: BreadcrumbService
|
||||||
|
) {
|
||||||
|
this.breadcrumbService.setItems([
|
||||||
|
{ label: 'Sensor', routerLink: ['/sensor/list'], }
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.route.queryParams.subscribe(queryParams => {
|
||||||
|
this.pageNo = queryParams['page'] || 1;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
onSensorSelect(sensor: Sensor) {
|
||||||
|
this.router.navigate(['sensor', sensor.id, 'info']);
|
||||||
|
}
|
||||||
|
|
||||||
|
onAddSensor() {
|
||||||
|
this.router.navigate(['sensor', 0, 'info']);
|
||||||
|
}
|
||||||
|
|
||||||
|
onPageChange(pageNo: number) {
|
||||||
|
this.router.navigate(['/notification'], { queryParams: { page: pageNo } });
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user