This commit is contained in:
geek 2018-06-05 20:31:29 +09:00
parent f6021b9951
commit e934900a4a
14 changed files with 112 additions and 120 deletions

View File

@ -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) {

View File

@ -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
];

View File

@ -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

View File

@ -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);
}
}

View File

@ -1,5 +1,5 @@
import { TargetService } from './target.service';
export const SERVICES = [
TargetService,
// TargetService,
];

View File

@ -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);
}
}

View File

@ -11,9 +11,9 @@ import { InfraModule } from '../infra/infra.module';
@NgModule({
imports: [
CommonModule,
SensorModule,
// SensorModule,
UIModule,
InfraModule
// InfraModule
],
declarations: [
COMPONENTS,

View File

@ -4,7 +4,7 @@ import { ProbeTabPageComponent } from './probe-tab-page.component';
import { ProbeListPageComponent } from '@app/pages/probes/probe/probe-list-page.component';
import { ProbeDetailPageComponent } from '@app/pages/probes/probe/probe-detail-page.component';
import { NoAuthProbePageComponent } from '@app/pages/probes/noauth-probe/noauth-probe-page.component';
import { ProbeDownloadPageComponent } from '../../pages/probes/download/download-page.component';
import { ProbeDownloadPageComponent } from '@app/pages/probes/download/download-page.component';
const routes: Routes = [
{
@ -16,7 +16,7 @@ const routes: Routes = [
{ path: 'download', component: ProbeDownloadPageComponent },
{ path: 'download/:idx', component: ProbeDownloadPageComponent },
{ path: ':id/info', component: ProbeDetailPageComponent },
{ path: ':id/target', loadChildren: '../../pages/targets/target-page.module#TargetPageModule' },
{ path: ':id/target', loadChildren: '@app/pages/targets/target-page.module#TargetPageModule' },
{ path: ':id/history', component: null },
]
},

View File

@ -2,12 +2,12 @@ import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'of-target-detail-page',
selector: 'of-pages-target-detail',
templateUrl: './target-detail-page.component.html',
})
export class TargetDetailPageComponent implements OnInit {
probeHostID: number;
// probeHostID: number;
constructor(
private route: ActivatedRoute

View File

@ -2,7 +2,7 @@
<div class="ui-g">
<div class="ui-g-12">
<div class="card no-margin">
sdjklfhjsklfjhlksdjfklsdhfjoliwejiolf
<!--<of-target-list></of-target-list>-->
</div>
</div>
</div>

View File

@ -1,13 +1,13 @@
import { Component, OnInit } from '@angular/core';
import {Component, Input, OnInit} from '@angular/core';
import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'of-target-list-page',
selector: 'of-pages-target-list',
templateUrl: './target-list-page.component.html',
})
export class TargetListPageComponent implements OnInit {
probeHostID: number;
// @Input() probeHostID: string;
constructor(
private route: ActivatedRoute

View File

@ -1,11 +1,10 @@
<div class="ui-g">
<div class="ui-g-12">
<!--<div class="card no-margin">-->
<!--<of-tabbar [tabs]="tabs"></of-tabbar>-->
<!--</div>-->
<div class="card no-margin">
sdfsdf
<router-outlet></router-outlet>
<!--<router-outlet *ngIf="probeID !== undefined" else complete></router-outlet>-->
<!--<ng-template #complete>-->
<of-pages-target-list></of-pages-target-list>
<!--</ng-template>-->
</div>
</div>
</div>

View File

@ -1,25 +1,23 @@
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import {ActivatedRoute, Router} from '@angular/router';
import {BreadcrumbService} from '../../commons/service/breadcrumb.service';
@Component({
selector: 'of-pages-target',
templateUrl: './target-page.component.html',
})
export class TargetPageComponent implements OnInit {
// probeHostID: string;
// tabs = undefined;
constructor(private router: Router) {
constructor(
private router: Router,
private activatedRoute: ActivatedRoute,
) {
// this.probeHostID = this.activatedRoute.snapshot.params['id'];
}
ngOnInit() {
// const id = this.router.url.split('target/')[1].split('/')[0];
//
// this.tabs = [
// { label: 'INFO', routerLink: ['/target/', id, 'info'] },
// { label: 'HISTORY', path: ['/target/', id, 'history'], disabled: true },
// ];
// this.probeID = this.activatedRoute.snapshot.queryParams['probeID'];
// console.log(this.probeID);
}
}

View File

@ -2,7 +2,7 @@ import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { UIModule } from '@overflow/shared/ui/ui.module';
// import { TargetModule } from '@overflow/target/target.module';
import { TargetModule } from '@overflow/target/target.module';
import { TargetListPageComponent } from './target-list-page.component';
import { TargetDetailPageComponent } from './target-detail-page.component';