ing
This commit is contained in:
@@ -19,37 +19,37 @@ import { Target } from '@overflow/commons-typescript/model/target';
|
||||
})
|
||||
export class DetailComponent implements OnInit, AfterContentInit, OnDestroy {
|
||||
|
||||
infra$: Observable<Infra>;
|
||||
infraSubscription$: Subscription;
|
||||
sensorsSubscription$: Subscription;
|
||||
// sensors$ = this.sensorListStore.pipe(select(sensorListSelector.select('page')));
|
||||
target$: Observable<Target>;
|
||||
|
||||
infraId = null;
|
||||
infra: Infra;
|
||||
sensors: Sensor[];
|
||||
sensorsCount = 0;
|
||||
sensorSettingDisplay = false;
|
||||
|
||||
pageSize = '10';
|
||||
totalLength = 0;
|
||||
currPage = 0;
|
||||
// infra$: Observable<Infra>;
|
||||
// infraSubscription$: Subscription;
|
||||
// sensorsSubscription$: Subscription;
|
||||
// // sensors$ = this.sensorListStore.pipe(select(sensorListSelector.select('page')));
|
||||
// target$: Observable<Target>;
|
||||
//
|
||||
// infraId = null;
|
||||
// infra: Infra;
|
||||
// sensors: Sensor[];
|
||||
// sensorsCount = 0;
|
||||
// sensorSettingDisplay = false;
|
||||
//
|
||||
// pageSize = '10';
|
||||
// totalLength = 0;
|
||||
// currPage = 0;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private store: Store<any>,
|
||||
// private router: Router,
|
||||
// private route: ActivatedRoute,
|
||||
// private store: Store<any>,
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.infraSubscription$ = this.infra$.subscribe(
|
||||
(infra: Infra) => {
|
||||
this.infra = infra;
|
||||
},
|
||||
(error: RPCClientError) => {
|
||||
console.log(error.response.message);
|
||||
}
|
||||
);
|
||||
// this.infraSubscription$ = this.infra$.subscribe(
|
||||
// (infra: Infra) => {
|
||||
// this.infra = infra;
|
||||
// },
|
||||
// (error: RPCClientError) => {
|
||||
// console.log(error.response.message);
|
||||
// }
|
||||
// );
|
||||
// this.sensorsSubscription$ = this.sensors$.subscribe(
|
||||
// (page: Page) => {
|
||||
// if (page) {
|
||||
@@ -64,15 +64,15 @@ export class DetailComponent implements OnInit, AfterContentInit, OnDestroy {
|
||||
}
|
||||
|
||||
ngAfterContentInit() {
|
||||
this.infraId = this.route.snapshot.paramMap.get('id');
|
||||
this.getInfra();
|
||||
this.getSensors(this.currPage);
|
||||
// this.infraId = this.route.snapshot.paramMap.get('id');
|
||||
// this.getInfra();
|
||||
// this.getSensors(this.currPage);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (this.infraSubscription$) {
|
||||
this.infraSubscription$.unsubscribe();
|
||||
}
|
||||
// if (this.infraSubscription$) {
|
||||
// this.infraSubscription$.unsubscribe();
|
||||
// }
|
||||
}
|
||||
|
||||
getInfra() {
|
||||
@@ -98,48 +98,48 @@ export class DetailComponent implements OnInit, AfterContentInit, OnDestroy {
|
||||
}
|
||||
|
||||
onAddSensor() {
|
||||
this.sensorSettingDisplay = true;
|
||||
// this.sensorSettingDisplay = true;
|
||||
}
|
||||
|
||||
onSensorSettingClose() {
|
||||
this.sensorSettingDisplay = false;
|
||||
// this.sensorSettingDisplay = false;
|
||||
}
|
||||
|
||||
onPaging(e) {
|
||||
this.getSensors(e.page);
|
||||
// this.getSensors(e.page);
|
||||
}
|
||||
|
||||
onRowSelect(event) {
|
||||
this.router.navigate(['sensor', event.data.id, 'info']);
|
||||
// this.router.navigate(['sensor', event.data.id, 'info']);
|
||||
}
|
||||
|
||||
onTraceroute() {
|
||||
alert('지원 예정');
|
||||
// alert('지원 예정');
|
||||
}
|
||||
|
||||
|
||||
onDisplayNameChange(value: string) {
|
||||
if (value === this.infra.target.displayName) {
|
||||
return;
|
||||
}
|
||||
const target = this.infra.target;
|
||||
target.displayName = value;
|
||||
// if (value === this.infra.target.displayName) {
|
||||
// return;
|
||||
// }
|
||||
// const target = this.infra.target;
|
||||
// target.displayName = value;
|
||||
// this.targetModifyStore.dispatch(
|
||||
// new TargetModifyStore.Modify(target)
|
||||
// );
|
||||
|
||||
const modifySuccessSubscription$: Subscription = this.target$.subscribe(
|
||||
(t: Target) => {
|
||||
if (t) {
|
||||
}
|
||||
if (modifySuccessSubscription$) {
|
||||
modifySuccessSubscription$.unsubscribe();
|
||||
}
|
||||
},
|
||||
(error: RPCClientError) => {
|
||||
console.log(error);
|
||||
}
|
||||
);
|
||||
// const modifySuccessSubscription$: Subscription = this.target$.subscribe(
|
||||
// (t: Target) => {
|
||||
// if (t) {
|
||||
// }
|
||||
// if (modifySuccessSubscription$) {
|
||||
// modifySuccessSubscription$.unsubscribe();
|
||||
// }
|
||||
// },
|
||||
// (error: RPCClientError) => {
|
||||
// console.log(error);
|
||||
// }
|
||||
// );
|
||||
}
|
||||
|
||||
onDisplayNameChangeKeypress(event, value) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { DetailComponent } from './detail/detail.component';
|
||||
import { ListComponent } from './list/list.component';
|
||||
import { FilterComponent } from './list/filter/filter.component';
|
||||
// import { FilterComponent } from './list/filter/filter.component';
|
||||
|
||||
export const COMPONENTS = [
|
||||
ListComponent,
|
||||
DetailComponent,
|
||||
FilterComponent
|
||||
// DetailComponent,
|
||||
// FilterComponent
|
||||
];
|
||||
|
||||
@@ -32,3 +32,4 @@
|
||||
<!--<p-dialog [modal]="true" [width]="800" [(visible)]="sensorSettingDisplay" [showHeader]="false" [closeOnEscape]="false">-->
|
||||
<!--<of-sensor-setting [visible]="sensorSettingDisplay" [preTarget]="target" (close)="onSensorSettingClose()"></of-sensor-setting>-->
|
||||
<!--</p-dialog>-->
|
||||
sdfsdfsdf
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
import { Component, OnInit, AfterContentInit, OnDestroy } from '@angular/core';
|
||||
import { Observable, of, Subscription } from 'rxjs';
|
||||
import { catchError, exhaustMap, map, tap } from 'rxjs/operators';
|
||||
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { Infra } from '@overflow/commons-typescript/model/infra';
|
||||
import { Store, select } from '@ngrx/store';
|
||||
// import { Page, PageParams } from 'app/commons/model';
|
||||
import { RPCClientError } from '@loafer/ng-rpc';
|
||||
import { Probe } from '@overflow/commons-typescript/model/probe';
|
||||
|
||||
import { Target } from '@overflow/commons-typescript/model/target';
|
||||
|
||||
|
||||
import { Observable, of, Subscription } from 'rxjs';
|
||||
import { Store, select } from '@ngrx/store';
|
||||
|
||||
@Component({
|
||||
selector: 'of-target-list',
|
||||
@@ -19,21 +13,21 @@ import { Target } from '@overflow/commons-typescript/model/target';
|
||||
})
|
||||
export class ListComponent implements OnInit, AfterContentInit, OnDestroy {
|
||||
|
||||
infrasSubscription$: Subscription;
|
||||
infras$: Observable<Infra[]>;
|
||||
infras: Infra[];
|
||||
probe: Probe;
|
||||
target: Target = null;
|
||||
sensorSettingDisplay = false;
|
||||
// infrasSubscription$: Subscription;
|
||||
// infras$: Observable<Infra[]>;
|
||||
// infras: Infra[];
|
||||
// probe: Probe;
|
||||
// target: Target = null;
|
||||
// sensorSettingDisplay = false;
|
||||
|
||||
pageSize = '10';
|
||||
totalLength = 0;
|
||||
currPage = 0;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
private store: Store<any>,
|
||||
// private route: ActivatedRoute,
|
||||
// private router: Router,
|
||||
// private store: Store<any>,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -50,21 +44,22 @@ export class ListComponent implements OnInit, AfterContentInit, OnDestroy {
|
||||
// console.log(error);
|
||||
// }
|
||||
// );
|
||||
console.log('ddddddddddddddddddddd');
|
||||
}
|
||||
|
||||
ngAfterContentInit() {
|
||||
this.route.params.subscribe((params: any) => {
|
||||
this.probe = {
|
||||
id: params['id'],
|
||||
};
|
||||
this.getInfras(0);
|
||||
});
|
||||
// this.route.params.subscribe((params: any) => {
|
||||
// this.probe = {
|
||||
// id: params['id'],
|
||||
// };
|
||||
// this.getInfras(0);
|
||||
// });
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (this.infrasSubscription$) {
|
||||
this.infrasSubscription$.unsubscribe();
|
||||
}
|
||||
// if (this.infrasSubscription$) {
|
||||
// this.infrasSubscription$.unsubscribe();
|
||||
// }
|
||||
}
|
||||
|
||||
getInfras(pageNo) {
|
||||
@@ -83,20 +78,20 @@ export class ListComponent implements OnInit, AfterContentInit, OnDestroy {
|
||||
|
||||
onRowSelect(event) {
|
||||
// this.router.navigate(['target'], { queryParams: { target: event.data.id } });
|
||||
this.router.navigate(['target', event.data.id, 'info']);
|
||||
// this.router.navigate(['target', event.data.id, 'info']);
|
||||
}
|
||||
|
||||
onAddSensor(target: Target) {
|
||||
this.target = target;
|
||||
this.sensorSettingDisplay = true;
|
||||
// this.target = target;
|
||||
// this.sensorSettingDisplay = true;
|
||||
}
|
||||
|
||||
onSensorSettingClose() {
|
||||
this.sensorSettingDisplay = false;
|
||||
// this.sensorSettingDisplay = false;
|
||||
}
|
||||
|
||||
onPaging(e) {
|
||||
this.getInfras(e.page);
|
||||
// this.getInfras(e.page);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { TargetService } from './target.service';
|
||||
|
||||
export const SERVICES = [
|
||||
TargetService,
|
||||
// TargetService,
|
||||
];
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { RPCService } from '@loafer/ng-rpc';
|
||||
import { Observable } from 'rxjs';
|
||||
|
||||
import { Target } from '@overflow/commons-typescript/model/target';
|
||||
import { Host, Service } from '@overflow/commons-typescript/model/discovery';
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class TargetService {
|
||||
|
||||
@@ -21,7 +20,7 @@ export class TargetService {
|
||||
}
|
||||
|
||||
public modify(target: Target): Observable<Target> {
|
||||
return this.rpcService.call('TargetService.modify', target);
|
||||
return this.rpcService.call<Target>('TargetService.modify', target);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,9 +11,9 @@ import { InfraModule } from '../infra/infra.module';
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
SensorModule,
|
||||
// SensorModule,
|
||||
UIModule,
|
||||
InfraModule
|
||||
// InfraModule
|
||||
],
|
||||
declarations: [
|
||||
COMPONENTS,
|
||||
|
||||
Reference in New Issue
Block a user