sensor in progress
This commit is contained in:
parent
2cce12ea37
commit
3ffc66a6e4
|
@ -1,7 +1,9 @@
|
||||||
import { SensorListComponent } from './list/list.component';
|
import { SensorListComponent } from './list/list.component';
|
||||||
import { SensorDetailComponent } from './detail/detail.component';
|
import { SensorDetailComponent } from './detail/detail.component';
|
||||||
|
import { SensorSettingComponent } from './setting/setting.component';
|
||||||
|
|
||||||
export const COMPONENTS = [
|
export const COMPONENTS = [
|
||||||
SensorListComponent,
|
SensorListComponent,
|
||||||
SensorDetailComponent,
|
SensorDetailComponent,
|
||||||
|
SensorSettingComponent,
|
||||||
];
|
];
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<div class="ui-g-12">
|
<div class="ui-g-12">
|
||||||
<div class="ui-g">
|
<div class="ui-g">
|
||||||
<div class="ui-g-12 ui-md-5 ui-g-nopad">
|
<div class="ui-g-12 ui-md-5 ui-g-nopad">
|
||||||
<button type="button" label="Add Sensor" icon="ui-icon-add" pButton class="ui-button-large ui-button-width-fit" (click)="onAddSensor()"></button>
|
<button type="button" label="Add Sensor" icon="ui-icon-add" pButton class="ui-button-large ui-button-width-fit" (click)="addSensor.emit()"></button>
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-12 ui-md-7 ui-g-nopad">
|
<div class="ui-g-12 ui-md-7 ui-g-nopad">
|
||||||
<div style="float: right; margin-top: 30px;">
|
<div style="float: right; margin-top: 30px;">
|
||||||
|
@ -82,7 +82,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="ui-g-2" style="text-align: center !important">
|
<div class="ui-g-2" style="text-align: center !important">
|
||||||
<div style="width:14px; height:14px; margin: auto;">
|
<div style="width:14px; height:14px; margin: auto;">
|
||||||
<button type="button" pButton icon="ui-icon-add" (click)="onAddSensorWithTarget(item.target)"></button>
|
<button type="button" pButton icon="ui-icon-add" (click)="addSensor.emit(item.target)"></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -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 { Sensor } from '@overflow/commons-typescript/model/sensor';
|
||||||
import { Page } from '@overflow/commons-typescript/model/commons/Page';
|
import { Page } from '@overflow/commons-typescript/model/commons/Page';
|
||||||
import { Target } from '@overflow/commons-typescript/model/target';
|
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 {
|
export class SensorListComponent implements OnChanges {
|
||||||
|
|
||||||
@Input() page: Page<Sensor>;
|
@Input() page: Page<Sensor>;
|
||||||
|
@Output() addSensor = new EventEmitter();
|
||||||
|
|
||||||
totalLength: number;
|
totalLength: number;
|
||||||
targetSensors: Object;
|
targetSensors: Object;
|
||||||
|
@ -55,6 +56,7 @@ export class SensorListComponent implements OnChanges {
|
||||||
return targetNode;
|
return targetNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// generateTargetFilter() {
|
// generateTargetFilter() {
|
||||||
// if (this.targetOptions) {
|
// if (this.targetOptions) {
|
||||||
// return;
|
// return;
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { Component } from '@angular/core';
|
||||||
selector: 'of-sensor-setting',
|
selector: 'of-sensor-setting',
|
||||||
templateUrl: './setting.component.html',
|
templateUrl: './setting.component.html',
|
||||||
})
|
})
|
||||||
export class SettingComponent {
|
export class SensorSettingComponent {
|
||||||
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
<of-sensor-list [page]="page$ | async"></of-sensor-list>
|
<of-sensor-list [page]="page$ | async" (addSensor)="addSensor.emit($event)"></of-sensor-list>
|
|
@ -8,6 +8,7 @@ import { AuthSelector } from '../../member/store';
|
||||||
import { Domain } from '@overflow/commons-typescript/model/domain';
|
import { Domain } from '@overflow/commons-typescript/model/domain';
|
||||||
import { PageParams } from '@overflow/commons-typescript/model/commons/PageParams';
|
import { PageParams } from '@overflow/commons-typescript/model/commons/PageParams';
|
||||||
import { Page } from '@overflow/commons-typescript/model/commons/Page';
|
import { Page } from '@overflow/commons-typescript/model/commons/Page';
|
||||||
|
import { Target } from '@overflow/commons-typescript/model/target';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'of-sensor-list-container',
|
selector: 'of-sensor-list-container',
|
||||||
|
@ -17,6 +18,7 @@ export class SensorListContainerComponent implements OnInit {
|
||||||
|
|
||||||
page$: Observable<Page<Sensor>>;
|
page$: Observable<Page<Sensor>>;
|
||||||
@Output() select = new EventEmitter<Sensor>();
|
@Output() select = new EventEmitter<Sensor>();
|
||||||
|
@Output() addSensor = new EventEmitter();
|
||||||
|
|
||||||
constructor(private store: Store<SensorEntityStore.State>) {
|
constructor(private store: Store<SensorEntityStore.State>) {
|
||||||
this.page$ = store.pipe(select(SensorPageSelector));
|
this.page$ = store.pipe(select(SensorPageSelector));
|
||||||
|
@ -38,4 +40,5 @@ export class SensorListContainerComponent implements OnInit {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
<div>SENSOR_ADD_CONTAINER</div>
|
<of-sensor-setting></of-sensor-setting>
|
|
@ -28,7 +28,7 @@ export class SensorTabPageComponent implements OnDestroy {
|
||||||
generateTabMenu(event: NavigationEnd) {
|
generateTabMenu(event: NavigationEnd) {
|
||||||
try {
|
try {
|
||||||
const parsedUrl = event.url.split('sensor/')[1].split('/')[0];
|
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: 'INFO', routerLink: ['/sensor/', parsedUrl, 'info'] },
|
||||||
{ label: 'HISTORY', path: ['/sensor/', parsedUrl, 'history'], disabled: true },
|
{ label: 'HISTORY', path: ['/sensor/', parsedUrl, 'history'], disabled: true },
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
<div *ngIf="!isDetail; else detailView">
|
<div *ngIf="!isDetail; else detailView">
|
||||||
<of-sensor-list-container (select)="onSensorSelect($event)"></of-sensor-list-container>
|
<of-sensor-list-container *ngIf="router.url === '/sensor/list'" (select)="onSensorSelect($event)" (addSensor)="onAddSensor($event)"> </of-sensor-list-container>
|
||||||
|
<of-sensor-setting-container *ngIf="router.url === '/sensor/setting'"></of-sensor-setting-container>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ng-template #detailView>
|
<ng-template #detailView>
|
||||||
<of-sensor-detail-container></of-sensor-detail-container>
|
<of-sensor-detail-container></of-sensor-detail-container>
|
||||||
<!-- <of-probe-detail-container [probeHostID]="probeHostID"
|
|
||||||
(targetSelect)="onTargetSelect($event)"
|
|
||||||
(discovery)="onDiscovery($event)"
|
|
||||||
></of-probe-detail-container> -->
|
|
||||||
</ng-template>
|
</ng-template>
|
|
@ -1,8 +1,8 @@
|
||||||
import { Component, OnDestroy } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { Router, ActivatedRoute, NavigationEnd } from '@angular/router';
|
import { Router, ActivatedRoute, NavigationEnd } from '@angular/router';
|
||||||
import { Subscription } from 'rxjs/Subscription';
|
|
||||||
import { Sensor } from '@overflow/commons-typescript/model/sensor';
|
import { Sensor } from '@overflow/commons-typescript/model/sensor';
|
||||||
import { BreadcrumbService } from '@app/commons/service/breadcrumb.service';
|
import { BreadcrumbService } from '@app/commons/service/breadcrumb.service';
|
||||||
|
import { Target } from '@overflow/commons-typescript/model/target';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'of-pages-sensor',
|
selector: 'of-pages-sensor',
|
||||||
|
@ -22,16 +22,14 @@ export class SensorPageComponent {
|
||||||
if (params['id']) {
|
if (params['id']) {
|
||||||
this.onDetailContainer(params['id']);
|
this.onDetailContainer(params['id']);
|
||||||
} else {
|
} else {
|
||||||
console.log('?');
|
this.onListSettingContainer();
|
||||||
console.log(params);
|
|
||||||
this.onListContainer();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
onListContainer() {
|
onListSettingContainer() {
|
||||||
this.breadcrumbService.setItems([
|
this.breadcrumbService.setItems([
|
||||||
{ label: 'Sensor', routerLink: ['/sensor/list'], }
|
{ label: 'Sensor', routerLink: ['/sensor/list'], }
|
||||||
]);
|
]);
|
||||||
this.isDetail = false;
|
this.isDetail = false;
|
||||||
}
|
}
|
||||||
|
@ -49,4 +47,14 @@ export class SensorPageComponent {
|
||||||
this.router.navigate(['sensor', sensor.id, 'info']);
|
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 });
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user