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 { export class DetailComponent implements OnInit, AfterContentInit, OnDestroy {
infra$: Observable<Infra>; // infra$: Observable<Infra>;
infraSubscription$: Subscription; // infraSubscription$: Subscription;
sensorsSubscription$: Subscription; // sensorsSubscription$: Subscription;
// sensors$ = this.sensorListStore.pipe(select(sensorListSelector.select('page'))); // // sensors$ = this.sensorListStore.pipe(select(sensorListSelector.select('page')));
target$: Observable<Target>; // target$: Observable<Target>;
//
infraId = null; // infraId = null;
infra: Infra; // infra: Infra;
sensors: Sensor[]; // sensors: Sensor[];
sensorsCount = 0; // sensorsCount = 0;
sensorSettingDisplay = false; // sensorSettingDisplay = false;
//
pageSize = '10'; // pageSize = '10';
totalLength = 0; // totalLength = 0;
currPage = 0; // currPage = 0;
constructor( constructor(
private router: Router, // private router: Router,
private route: ActivatedRoute, // private route: ActivatedRoute,
private store: Store<any>, // private store: Store<any>,
) { } ) { }
ngOnInit() { ngOnInit() {
this.infraSubscription$ = this.infra$.subscribe( // this.infraSubscription$ = this.infra$.subscribe(
(infra: Infra) => { // (infra: Infra) => {
this.infra = infra; // this.infra = infra;
}, // },
(error: RPCClientError) => { // (error: RPCClientError) => {
console.log(error.response.message); // console.log(error.response.message);
} // }
); // );
// this.sensorsSubscription$ = this.sensors$.subscribe( // this.sensorsSubscription$ = this.sensors$.subscribe(
// (page: Page) => { // (page: Page) => {
// if (page) { // if (page) {
@ -64,15 +64,15 @@ export class DetailComponent implements OnInit, AfterContentInit, OnDestroy {
} }
ngAfterContentInit() { ngAfterContentInit() {
this.infraId = this.route.snapshot.paramMap.get('id'); // this.infraId = this.route.snapshot.paramMap.get('id');
this.getInfra(); // this.getInfra();
this.getSensors(this.currPage); // this.getSensors(this.currPage);
} }
ngOnDestroy() { ngOnDestroy() {
if (this.infraSubscription$) { // if (this.infraSubscription$) {
this.infraSubscription$.unsubscribe(); // this.infraSubscription$.unsubscribe();
} // }
} }
getInfra() { getInfra() {
@ -98,48 +98,48 @@ export class DetailComponent implements OnInit, AfterContentInit, OnDestroy {
} }
onAddSensor() { onAddSensor() {
this.sensorSettingDisplay = true; // this.sensorSettingDisplay = true;
} }
onSensorSettingClose() { onSensorSettingClose() {
this.sensorSettingDisplay = false; // this.sensorSettingDisplay = false;
} }
onPaging(e) { onPaging(e) {
this.getSensors(e.page); // this.getSensors(e.page);
} }
onRowSelect(event) { onRowSelect(event) {
this.router.navigate(['sensor', event.data.id, 'info']); // this.router.navigate(['sensor', event.data.id, 'info']);
} }
onTraceroute() { onTraceroute() {
alert('지원 예정'); // alert('지원 예정');
} }
onDisplayNameChange(value: string) { onDisplayNameChange(value: string) {
if (value === this.infra.target.displayName) { // if (value === this.infra.target.displayName) {
return; // return;
} // }
const target = this.infra.target; // const target = this.infra.target;
target.displayName = value; // target.displayName = value;
// this.targetModifyStore.dispatch( // this.targetModifyStore.dispatch(
// new TargetModifyStore.Modify(target) // new TargetModifyStore.Modify(target)
// ); // );
const modifySuccessSubscription$: Subscription = this.target$.subscribe( // const modifySuccessSubscription$: Subscription = this.target$.subscribe(
(t: Target) => { // (t: Target) => {
if (t) { // if (t) {
} // }
if (modifySuccessSubscription$) { // if (modifySuccessSubscription$) {
modifySuccessSubscription$.unsubscribe(); // modifySuccessSubscription$.unsubscribe();
} // }
}, // },
(error: RPCClientError) => { // (error: RPCClientError) => {
console.log(error); // console.log(error);
} // }
); // );
} }
onDisplayNameChangeKeypress(event, value) { onDisplayNameChangeKeypress(event, value) {

View File

@ -1,9 +1,9 @@
import { DetailComponent } from './detail/detail.component'; import { DetailComponent } from './detail/detail.component';
import { ListComponent } from './list/list.component'; import { ListComponent } from './list/list.component';
import { FilterComponent } from './list/filter/filter.component'; // import { FilterComponent } from './list/filter/filter.component';
export const COMPONENTS = [ export const COMPONENTS = [
ListComponent, ListComponent,
DetailComponent, // DetailComponent,
FilterComponent // FilterComponent
]; ];

View File

@ -32,3 +32,4 @@
<!--<p-dialog [modal]="true" [width]="800" [(visible)]="sensorSettingDisplay" [showHeader]="false" [closeOnEscape]="false">--> <!--<p-dialog [modal]="true" [width]="800" [(visible)]="sensorSettingDisplay" [showHeader]="false" [closeOnEscape]="false">-->
<!--<of-sensor-setting [visible]="sensorSettingDisplay" [preTarget]="target" (close)="onSensorSettingClose()"></of-sensor-setting>--> <!--<of-sensor-setting [visible]="sensorSettingDisplay" [preTarget]="target" (close)="onSensorSettingClose()"></of-sensor-setting>-->
<!--</p-dialog>--> <!--</p-dialog>-->
sdfsdfsdf

View File

@ -1,17 +1,11 @@
import { Component, OnInit, AfterContentInit, OnDestroy } from '@angular/core'; 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 { Router, ActivatedRoute } from '@angular/router';
import { Infra } from '@overflow/commons-typescript/model/infra'; 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 { Probe } from '@overflow/commons-typescript/model/probe';
import { Target } from '@overflow/commons-typescript/model/target'; import { Target } from '@overflow/commons-typescript/model/target';
import { Observable, of, Subscription } from 'rxjs';
import { Store, select } from '@ngrx/store';
@Component({ @Component({
selector: 'of-target-list', selector: 'of-target-list',
@ -19,21 +13,21 @@ import { Target } from '@overflow/commons-typescript/model/target';
}) })
export class ListComponent implements OnInit, AfterContentInit, OnDestroy { export class ListComponent implements OnInit, AfterContentInit, OnDestroy {
infrasSubscription$: Subscription; // infrasSubscription$: Subscription;
infras$: Observable<Infra[]>; // infras$: Observable<Infra[]>;
infras: Infra[]; // infras: Infra[];
probe: Probe; // probe: Probe;
target: Target = null; // target: Target = null;
sensorSettingDisplay = false; // sensorSettingDisplay = false;
pageSize = '10'; pageSize = '10';
totalLength = 0; totalLength = 0;
currPage = 0; currPage = 0;
constructor( constructor(
private route: ActivatedRoute, // private route: ActivatedRoute,
private router: Router, // private router: Router,
private store: Store<any>, // private store: Store<any>,
) { ) {
} }
@ -50,21 +44,22 @@ export class ListComponent implements OnInit, AfterContentInit, OnDestroy {
// console.log(error); // console.log(error);
// } // }
// ); // );
console.log('ddddddddddddddddddddd');
} }
ngAfterContentInit() { ngAfterContentInit() {
this.route.params.subscribe((params: any) => { // this.route.params.subscribe((params: any) => {
this.probe = { // this.probe = {
id: params['id'], // id: params['id'],
}; // };
this.getInfras(0); // this.getInfras(0);
}); // });
} }
ngOnDestroy() { ngOnDestroy() {
if (this.infrasSubscription$) { // if (this.infrasSubscription$) {
this.infrasSubscription$.unsubscribe(); // this.infrasSubscription$.unsubscribe();
} // }
} }
getInfras(pageNo) { getInfras(pageNo) {
@ -83,20 +78,20 @@ export class ListComponent implements OnInit, AfterContentInit, OnDestroy {
onRowSelect(event) { onRowSelect(event) {
// this.router.navigate(['target'], { queryParams: { target: event.data.id } }); // 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) { onAddSensor(target: Target) {
this.target = target; // this.target = target;
this.sensorSettingDisplay = true; // this.sensorSettingDisplay = true;
} }
onSensorSettingClose() { onSensorSettingClose() {
this.sensorSettingDisplay = false; // this.sensorSettingDisplay = false;
} }
onPaging(e) { onPaging(e) {
this.getInfras(e.page); // this.getInfras(e.page);
} }
} }

View File

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

View File

@ -1,12 +1,11 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { RPCService } from '@loafer/ng-rpc'; import { RPCService } from '@loafer/ng-rpc';
import { Observable } from 'rxjs';
import { Target } from '@overflow/commons-typescript/model/target'; import { Target } from '@overflow/commons-typescript/model/target';
import { Host, Service } from '@overflow/commons-typescript/model/discovery'; import { Host, Service } from '@overflow/commons-typescript/model/discovery';
@Injectable() @Injectable()
export class TargetService { export class TargetService {
@ -21,7 +20,7 @@ export class TargetService {
} }
public modify(target: Target): Observable<Target> { 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({ @NgModule({
imports: [ imports: [
CommonModule, CommonModule,
SensorModule, // SensorModule,
UIModule, UIModule,
InfraModule // InfraModule
], ],
declarations: [ declarations: [
COMPONENTS, 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 { ProbeListPageComponent } from '@app/pages/probes/probe/probe-list-page.component';
import { ProbeDetailPageComponent } from '@app/pages/probes/probe/probe-detail-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 { 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 = [ const routes: Routes = [
{ {
@ -16,7 +16,7 @@ const routes: Routes = [
{ path: 'download', component: ProbeDownloadPageComponent }, { path: 'download', component: ProbeDownloadPageComponent },
{ path: 'download/:idx', component: ProbeDownloadPageComponent }, { path: 'download/:idx', component: ProbeDownloadPageComponent },
{ path: ':id/info', component: ProbeDetailPageComponent }, { 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 }, { path: ':id/history', component: null },
] ]
}, },

View File

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

View File

@ -2,7 +2,7 @@
<div class="ui-g"> <div class="ui-g">
<div class="ui-g-12"> <div class="ui-g-12">
<div class="card no-margin"> <div class="card no-margin">
sdjklfhjsklfjhlksdjfklsdhfjoliwejiolf <!--<of-target-list></of-target-list>-->
</div> </div>
</div> </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'; import { ActivatedRoute } from '@angular/router';
@Component({ @Component({
selector: 'of-target-list-page', selector: 'of-pages-target-list',
templateUrl: './target-list-page.component.html', templateUrl: './target-list-page.component.html',
}) })
export class TargetListPageComponent implements OnInit { export class TargetListPageComponent implements OnInit {
probeHostID: number; // @Input() probeHostID: string;
constructor( constructor(
private route: ActivatedRoute private route: ActivatedRoute

View File

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

View File

@ -1,25 +1,23 @@
import { Component, OnInit } from '@angular/core'; 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({ @Component({
selector: 'of-pages-target', selector: 'of-pages-target',
templateUrl: './target-page.component.html', templateUrl: './target-page.component.html',
}) })
export class TargetPageComponent implements OnInit { 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() { ngOnInit() {
// this.probeID = this.activatedRoute.snapshot.queryParams['probeID'];
// const id = this.router.url.split('target/')[1].split('/')[0]; // console.log(this.probeID);
//
// this.tabs = [
// { label: 'INFO', routerLink: ['/target/', id, 'info'] },
// { label: 'HISTORY', path: ['/target/', id, 'history'], disabled: true },
// ];
} }
} }

View File

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