Merge branch 'master' of https://git.loafle.net/overflow/member_webapp
This commit is contained in:
commit
411ea2ab0e
|
@ -1,7 +1,7 @@
|
|||
import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
|
||||
|
||||
@Component({
|
||||
selector: 'of-download',
|
||||
selector: 'of-probe-download',
|
||||
templateUrl: './probe-download.component.html',
|
||||
})
|
||||
export class ProbeDownloadComponent implements OnInit {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { SensorListComponent } from './list/list.component';
|
||||
import { SensorDetailComponent } from './detail/detail.component';
|
||||
import { SensorListComponent } from './sensor-list.component';
|
||||
import { SensorDetailComponent } from './sensor-detail.component';
|
||||
import { SensorSettingComponent } from './setting/setting.component';
|
||||
|
||||
export const COMPONENTS = [
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ListComponent } from './list.component';
|
||||
import { SensorDetailComponent } from './sensor-detail.component';
|
||||
|
||||
describe('ListComponent', () => {
|
||||
let component: ListComponent;
|
||||
let fixture: ComponentFixture<ListComponent>;
|
||||
describe('SensorDetailComponent', () => {
|
||||
let component: SensorDetailComponent;
|
||||
let fixture: ComponentFixture<SensorDetailComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ListComponent ]
|
||||
declarations: [ SensorDetailComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ListComponent);
|
||||
fixture = TestBed.createComponent(SensorDetailComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
|
@ -9,7 +9,7 @@ import { Subscription } from 'rxjs/Subscription';
|
|||
|
||||
@Component({
|
||||
selector: 'of-sensor-detail',
|
||||
templateUrl: './detail.component.html',
|
||||
templateUrl: './sensor-detail.component.html',
|
||||
providers: [ConfirmationService]
|
||||
})
|
||||
export class SensorDetailComponent {
|
|
@ -1,20 +1,20 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { FilterComponent } from './filter.component';
|
||||
import { SensorListFilterComponent } from './sensor-list-filter.component';
|
||||
|
||||
describe('FilterComponent', () => {
|
||||
let component: FilterComponent;
|
||||
let fixture: ComponentFixture<FilterComponent>;
|
||||
describe('SensorListFilterComponent', () => {
|
||||
let component: SensorListFilterComponent;
|
||||
let fixture: ComponentFixture<SensorListFilterComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ FilterComponent ]
|
||||
declarations: [ SensorListFilterComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(FilterComponent);
|
||||
fixture = TestBed.createComponent(SensorListFilterComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
|
@ -3,11 +3,11 @@ import { Router } from '@angular/router';
|
|||
|
||||
|
||||
@Component({
|
||||
selector: 'of-target-filter',
|
||||
templateUrl: './filter.component.html',
|
||||
styleUrls: ['./filter.component.scss']
|
||||
selector: 'of-sensor-list-filter',
|
||||
templateUrl: './sensor-list-filter.component.html',
|
||||
styleUrls: ['./sensor-list-filter.component.scss']
|
||||
})
|
||||
export class FilterComponent implements OnInit {
|
||||
export class SensorListFilterComponent implements OnInit {
|
||||
|
||||
crawlers = [
|
||||
{value: 'ALL', name: 'All'},
|
|
@ -1,20 +1,20 @@
|
|||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DetailComponent } from './detail.component';
|
||||
import { SensorListComponent } from './sensor-list.component';
|
||||
|
||||
describe('DetailComponent', () => {
|
||||
let component: DetailComponent;
|
||||
let fixture: ComponentFixture<DetailComponent>;
|
||||
describe('SensorListComponent', () => {
|
||||
let component: SensorListComponent;
|
||||
let fixture: ComponentFixture<SensorListComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ DetailComponent ]
|
||||
declarations: [ SensorListComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(DetailComponent);
|
||||
fixture = TestBed.createComponent(SensorListComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
|
@ -1,23 +1,77 @@
|
|||
import { Component, Input, OnInit, OnChanges, SimpleChanges, Output, EventEmitter } from '@angular/core';
|
||||
import { Store, select } from '@ngrx/store';
|
||||
|
||||
import { Observable, of, Subscription } from 'rxjs';
|
||||
import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
|
||||
|
||||
import { AuthSelector } from '@overflow/shared/auth/store';
|
||||
|
||||
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';
|
||||
import { DomainMember } from '@overflow/commons-typescript/model/domain';
|
||||
import { SensorService } from '../service/sensor.service';
|
||||
import { PageParams } from '@overflow/commons-typescript/model/commons/PageParams';
|
||||
|
||||
@Component({
|
||||
selector: 'of-sensor-list',
|
||||
templateUrl: './list.component.html',
|
||||
templateUrl: './sensor-list.component.html',
|
||||
})
|
||||
export class SensorListComponent implements OnChanges {
|
||||
|
||||
@Input() page: Page<Sensor>;
|
||||
@Output() addSensor = new EventEmitter();
|
||||
export class SensorListComponent implements OnInit, OnChanges {
|
||||
@Input() pageNo: number;
|
||||
@Output() select = new EventEmitter<Sensor>();
|
||||
@Output() addSensor = new EventEmitter();
|
||||
|
||||
page: Page<Sensor>;
|
||||
pending$: Observable<boolean>;
|
||||
error$: Observable<any>;
|
||||
|
||||
totalLength: number;
|
||||
targetSensors: Object;
|
||||
|
||||
constructor(
|
||||
) { }
|
||||
private store: Store<any>,
|
||||
private sensorService: SensorService,
|
||||
) {
|
||||
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
if (1 > this.pageNo) {
|
||||
this.pageNo = 0;
|
||||
}
|
||||
|
||||
this.store.pipe(
|
||||
tap(() => {
|
||||
this.pending$ = of(true);
|
||||
}),
|
||||
select(AuthSelector.selectDomainMember),
|
||||
exhaustMap((domainMember: DomainMember) => {
|
||||
const pageParams: PageParams = {
|
||||
pageNo: this.pageNo,
|
||||
countPerPage: 10,
|
||||
sortCol: 'id',
|
||||
sortDirection: 'descending',
|
||||
};
|
||||
|
||||
return this.sensorService.readAllByDomainID(domainMember.domain.id, pageParams)
|
||||
.pipe(
|
||||
map((page: Page<Sensor>) => {
|
||||
this.page = page;
|
||||
}),
|
||||
catchError(error => {
|
||||
this.error$ = of(error);
|
||||
return of();
|
||||
})
|
||||
);
|
||||
}
|
||||
),
|
||||
tap(() => {
|
||||
this.pending$ = of(false);
|
||||
}),
|
||||
).take(1).subscribe();
|
||||
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges): void {
|
||||
this.generateSensorMap();
|
|
@ -1,9 +0,0 @@
|
|||
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,
|
||||
SensorSettingContainerComponent
|
||||
];
|
|
@ -1 +0,0 @@
|
|||
<of-sensor-detail></of-sensor-detail>
|
|
@ -1,14 +0,0 @@
|
|||
import { Component } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { Store, select } from '@ngrx/store';
|
||||
// import * as ProbeStore from '../store/entity/probe';
|
||||
// import { ProbeEntitySelector, ProbeDetailContainerSelector } from '../store';
|
||||
|
||||
@Component({
|
||||
selector: 'of-sensor-detail-container',
|
||||
templateUrl: './sensor-detail-container.component.html',
|
||||
})
|
||||
export class SensorDetailContainerComponent {
|
||||
|
||||
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
<of-sensor-list [page]="page$ | async" (addSensor)="addSensor.emit($event)" (select)="select.emit($event)"></of-sensor-list>
|
|
@ -1,47 +0,0 @@
|
|||
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 { AuthSelector } from '@overflow/shared/auth/store';
|
||||
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';
|
||||
import { DomainMember } from '@overflow/commons-typescript/model/domain';
|
||||
|
||||
@Component({
|
||||
selector: 'of-sensor-list-container',
|
||||
templateUrl: './sensor-list-container.component.html',
|
||||
})
|
||||
export class SensorListContainerComponent implements OnInit {
|
||||
|
||||
page$: Observable<Page<Sensor>>;
|
||||
pending$: Observable<boolean>;
|
||||
@Output() select = new EventEmitter<Sensor>();
|
||||
@Output() addSensor = new EventEmitter();
|
||||
pageNo: number;
|
||||
|
||||
constructor(private store: Store<any>) {
|
||||
this.pageNo = 0;
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
// this.page$ = this.store.pipe(select(SensorListContainerSelector.selectPage));
|
||||
// this.page$ = this.store.pipe(select(SensorListContainerSelector.selectPage));
|
||||
|
||||
this.getSensors();
|
||||
}
|
||||
|
||||
getSensors() {
|
||||
this.store.select(AuthSelector.selectDomainMember).subscribe(
|
||||
(domainMember: DomainMember) => {
|
||||
const pageParams: PageParams = {
|
||||
pageNo: this.pageNo,
|
||||
countPerPage: 10,
|
||||
sortCol: 'id',
|
||||
sortDirection: 'descending',
|
||||
};
|
||||
// this.store.dispatch(new SensorEntityStore.ReadAllByDomainID({ domainID: domainMember.domain.id, pageParams }));
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
<of-sensor-setting></of-sensor-setting>
|
|
@ -1,15 +0,0 @@
|
|||
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';
|
||||
|
||||
@Component({
|
||||
selector: 'of-sensor-setting-container',
|
||||
templateUrl: './sensor-setting-container.component.html',
|
||||
})
|
||||
export class SensorSettingContainerComponent {
|
||||
|
||||
constructor(private store: Store<any>) {
|
||||
}
|
||||
|
||||
}
|
|
@ -7,10 +7,6 @@ import { UIModule } from '@overflow/shared/ui/ui.module';
|
|||
import { COMPONENTS } from './component';
|
||||
import { SERVICES } from './service';
|
||||
import { SensorItemModule } from '../sensor-item/sensor-item.module';
|
||||
import { CONTAINER_COMPONENTS } from './container';
|
||||
// import { MetaCrawlerModule } from '../meta/crawler/crawler.module';
|
||||
// import { MetaSensorDisplayItemModule } from '../meta/sensor-display-item/sensor-display-item.module';
|
||||
// import { MetaCrawlerInputItemModule } from '../meta/crawler-input-item/crawler-input.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
|
@ -20,11 +16,9 @@ import { CONTAINER_COMPONENTS } from './container';
|
|||
SensorItemModule,
|
||||
],
|
||||
declarations: [
|
||||
CONTAINER_COMPONENTS,
|
||||
COMPONENTS,
|
||||
],
|
||||
exports: [
|
||||
CONTAINER_COMPONENTS,
|
||||
COMPONENTS,
|
||||
],
|
||||
providers: [
|
||||
|
|
|
@ -1 +1 @@
|
|||
<of-download (select)="onSelect($event)" [index]="index"></of-download>
|
||||
<of-probe-download (select)="onSelect($event)" [index]="index"></of-probe-download>
|
|
@ -3,7 +3,7 @@ import { Router, ActivatedRoute } from '@angular/router';
|
|||
import { BreadcrumbService } from '@app/commons/service/breadcrumb.service';
|
||||
|
||||
@Component({
|
||||
selector: 'of-pages-download',
|
||||
selector: 'of-pages-probe-download',
|
||||
templateUrl: './download-page.component.html',
|
||||
})
|
||||
export class ProbeDownloadPageComponent implements OnInit {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<of-sensor-list-container *ngIf="containerType === 1" (select)="onSensorSelect($event)" (addSensor)="onAddSensor($event)">
|
||||
</of-sensor-list-container>
|
||||
<of-sensor-detail-container *ngIf="containerType === 2"></of-sensor-detail-container>
|
||||
<of-sensor-setting-container *ngIf="containerType === 3"></of-sensor-setting-container>
|
||||
<of-sensor-list *ngIf="containerType === 1" (select)="onSensorSelect($event)" (addSensor)="onAddSensor($event)">
|
||||
</of-sensor-list>
|
||||
<of-sensor-detail *ngIf="containerType === 2"></of-sensor-detail>
|
||||
<of-sensor-setting *ngIf="containerType === 3"></of-sensor-setting>
|
Loading…
Reference in New Issue
Block a user