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

View File

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