Merge remote-tracking branch 'origin/master'

This commit is contained in:
geek 2018-04-19 22:05:52 +09:00
commit 7a9ee9ed9e
2 changed files with 21 additions and 72 deletions

View File

@ -19,7 +19,6 @@ import { Target } from '../../model';
}) })
export class ListComponent implements OnInit, AfterContentInit { export class ListComponent implements OnInit, AfterContentInit {
probe$ = this.probeDetailStore.pipe(select(ProbeDetailSelector.select('probe')));
infras$ = this.infraListStore.pipe(select(ListSelector.select('page'))); infras$ = this.infraListStore.pipe(select(ListSelector.select('page')));
infras: Infra[]; infras: Infra[];
probe: Probe; probe: Probe;
@ -30,85 +29,33 @@ export class ListComponent implements OnInit, AfterContentInit {
private route: ActivatedRoute, private route: ActivatedRoute,
private router: Router, private router: Router,
private infraListStore: Store<InfraListStore.State>, private infraListStore: Store<InfraListStore.State>,
private probeDetailStore: Store<ProbeDetailStore.State>,
) { ) {
} }
ngOnInit() { ngOnInit() {
// this.probe$.subscribe(
// (probe: Probe) => {
// if (probe) {
// console.log(probe);
// this.probe = probe;
// this.getInfras(probe);
// }
// },
// (error: RPCClientError) => {
// console.log(error.response.message);
// }
// );
// this.infras$.subscribe( this.infras$.subscribe(
// (page: Page) => { (page: Page) => {
// if (!page) { if (!page) {
// return; return;
// } }
// this.infras = page.content; this.infras = page.content;
// }, },
// (error: RPCClientError) => { (error: RPCClientError) => {
// console.log(error); console.log(error);
// } }
// ); );
} }
ngAfterContentInit() { ngAfterContentInit() {
const probeId = this.route.snapshot.paramMap.get('id'); this.route.params.subscribe((params: any) => {
this.getProbe(probeId); const probe = {
id: params['id'],
// Temporary };
const infra1 = { this.getInfras(probe);
id: 1, });
infraType: {
id: 1
},
target: {
id: 1,
displayName: 'FakeTarget1',
},
};
const infra2 = {
id: 2,
infraType: {
id: 3
},
target: {
id: 2,
displayName: 'FakeTarget2',
},
};
const infra3 = {
id: 3,
infraType: {
id: 2
},
target: {
id: 3,
displayName: 'FakeTarget3',
},
};
this.infras = [];
this.infras.push(infra1);
this.infras.push(infra2);
this.infras.push(infra3);
} }
getProbe(probeId: string) {
this.probeDetailStore.dispatch(
new ProbeDetailStore.Read(
{ id: probeId }
)
);
}
getInfras(probe) { getInfras(probe) {
const pageParams: PageParams = { const pageParams: PageParams = {
pageNo: '0', pageNo: '0',
@ -124,7 +71,7 @@ export class ListComponent implements OnInit, AfterContentInit {
} }
onRowSelect(event) { onRowSelect(event) {
this.router.navigate(['sensors'], { queryParams: {target: event.data.id}}); this.router.navigate(['sensors'], { queryParams: { target: event.data.id } });
} }
onAddSensor(target: Target) { onAddSensor(target: Target) {

View File

@ -6,13 +6,15 @@ import { SERVICES } from './service';
import { PrimeNGModules } from '../commons/prime-ng/prime-ng.module'; import { PrimeNGModules } from '../commons/prime-ng/prime-ng.module';
import { SensorModule } from '../sensor/sensor.module'; import { SensorModule } from '../sensor/sensor.module';
import { KeyValueModule } from 'app/commons/component/key-value/key-value.module'; import { KeyValueModule } from 'app/commons/component/key-value/key-value.module';
import { InfraModule } from '../infra/infra.module';
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, CommonModule,
PrimeNGModules, PrimeNGModules,
SensorModule, SensorModule,
KeyValueModule KeyValueModule,
InfraModule
], ],
declarations: [ declarations: [
COMPONENTS, COMPONENTS,