formatOnSave true

This commit is contained in:
insanity 2018-06-12 22:21:53 +09:00
parent 7e682274d4
commit 1c415fe163
13 changed files with 58 additions and 189 deletions

View File

@ -1,6 +1,8 @@
{ {
"editor.tabSize": 2, "editor.tabSize": 2,
"editor.insertSpaces": true, "editor.insertSpaces": true,
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.autoClosingBrackets": true,
"git.ignoreLimitWarning": true "git.ignoreLimitWarning": true
} }

View File

@ -1,13 +1,12 @@
import { import {
Component, Input, Output, EventEmitter, OnDestroy, ViewChild, Component, Input, OnDestroy, ViewChild,
} from '@angular/core'; } from '@angular/core';
import { Store, select } from '@ngrx/store';
import { Observable, of, Subscription } from 'rxjs'; import { Observable, of, Subscription } from 'rxjs';
import { catchError, exhaustMap, map, tap, take } from 'rxjs/operators'; import { catchError, map } from 'rxjs/operators';
import { Probe, ProbeHost } from '@overflow/commons-typescript/model/probe'; import { ProbeHost } from '@overflow/commons-typescript/model/probe';
import { DiscoverZone, Zone, Host, Port, Service } from '@overflow/commons-typescript/model/discovery'; import { DiscoverZone, Zone, Host, Port, Service } from '@overflow/commons-typescript/model/discovery';
import { Anim } from './animation'; import { Anim } from './animation';
@ -42,7 +41,6 @@ export class DiscoveryComponent implements OnDestroy {
constructor( constructor(
private discoveryService: DiscoveryService, private discoveryService: DiscoveryService,
private discoverySubscriber: DiscoverySubscriber, private discoverySubscriber: DiscoverySubscriber,
private store: Store<any>
) { ) {
this.discoverySubscription = null; this.discoverySubscription = null;
this.finished = false; this.finished = false;
@ -60,7 +58,7 @@ export class DiscoveryComponent implements OnDestroy {
// TODO: fix // TODO: fix
const zone: Zone = { const zone: Zone = {
network: '192.168.1.0/24', network: '192.168.1.0/24', // this.selectedProbe.probe.cidr
address: '192.168.1.103', address: '192.168.1.103',
iface: 'enp3s0', iface: 'enp3s0',
mac: '44:8a:5b:44:8c:e8', mac: '44:8a:5b:44:8c:e8',

View File

@ -195,25 +195,25 @@ export class SearchResultComponent implements OnInit, OnChanges {
} }
}); });
this.targetService.registDiscoveredTargets(this.probeHost.probe.id, hosts, services) // this.targetService.registDiscoveredTargets(this.probeHost.probe.id, hosts, services)
.pipe( // .pipe(
tap(() => { // tap(() => {
this.targetSaveSucceed = false; // this.targetSaveSucceed = false;
}), // }),
map((targets: Target[]) => { // map((targets: Target[]) => {
if (targets) { // if (targets) {
this.displayTargetDone = true; // this.displayTargetDone = true;
} // }
}), // }),
catchError(error => { // catchError(error => {
this.error$ = of(error); // this.error$ = of(error);
return of(); // return of();
}), // }),
tap(() => { // tap(() => {
this.targetSaveSucceed = true; // this.targetSaveSucceed = true;
}), // }),
take(1), // take(1),
).subscribe(); // ).subscribe();
} }
} }

View File

@ -1,15 +0,0 @@
import { TestBed, inject } from '@angular/core/testing';
import { DiscoveryService } from './discovery.service';
describe('DiscoveryService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [DiscoveryService]
});
});
it('should be created', inject([DiscoveryService], (service: DiscoveryService) => {
expect(service).toBeTruthy();
}));
});

View File

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

View File

@ -1,15 +0,0 @@
import { TestBed, inject } from '@angular/core/testing';
import { TargetDiscoveryService } from './target-discovery.service';
describe('TargetDiscoveryService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [TargetDiscoveryService]
});
});
it('should be created', inject([TargetDiscoveryService], (service: TargetDiscoveryService) => {
expect(service).toBeTruthy();
}));
});

View File

@ -1,31 +0,0 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { RPCService } from '@loafer/ng-rpc';
import {
DiscoveryStartInfo,
DiscoverZone as MDDiscoverZone,
DiscoverHost as MDDiscoverHost,
DiscoverPort as MDDiscoverPort,
DiscoverService as MDDiscoverService,
Zone,
Host,
Port,
Service,
} from '@overflow/commons-typescript/model/discovery';
import { Probe } from '@overflow/commons-typescript/model/probe';
@Injectable()
export class TargetDiscoveryService {
public constructor(
private rpcService: RPCService,
) {
}
public saveAllTarget(hosts: Host[], probe: Probe): Observable<Boolean> {
return this.rpcService.call('TargetDiscoveryService.saveAllTarget', hosts, probe);
}
}

View File

@ -1,15 +0,0 @@
import { TestBed, inject } from '@angular/core/testing';
import { InfraHostService } from './infra-host.service';
describe('InfraHostService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [InfraHostService]
});
});
it('should be created', inject([InfraHostService], (service: InfraHostService) => {
expect(service).toBeTruthy();
}));
});

View File

@ -1,28 +0,0 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { RPCService } from '@loafer/ng-rpc';
import { InfraHost } from '@overflow/commons-typescript/model/infra';
@Injectable()
export class InfraHostService {
public constructor(
private rpcService: RPCService,
) {
}
// public readAllByDomain(domain: Domain, pageParams: PageParams): Observable<Page> {
// return this.rpcService.call('InfraService.readAllByDomain', domain, pageParams);
// }
// public readAllByProbe(probe: Probe, pageParams: PageParams): Observable<Page> {
// return this.rpcService.call('InfraService.readAllByProbe', probe, pageParams);
// }
public read(id: number): Observable<InfraHost> {
return this.rpcService.call('InfraHostService.read', id);
}
}

View File

@ -1,15 +0,0 @@
import { TestBed, inject } from '@angular/core/testing';
import { InfraService } from './infra.service';
describe('InfraService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [InfraService]
});
});
it('should be created', inject([InfraService], (service: InfraService) => {
expect(service).toBeTruthy();
}));
});

View File

@ -1,11 +1,9 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable } from 'rxjs'; import { Observable } from 'rxjs';
import { RPCService } from '@loafer/ng-rpc'; import { RPCService } from '@loafer/ng-rpc';
import { Infra } from '@overflow/commons-typescript/model/infra'; import { Infra } from '@overflow/commons-typescript/model/infra';
import { Domain } from '@overflow/commons-typescript/model/domain';
import { Page, PageParams } from '@overflow/commons-typescript/core/model'; import { Page, PageParams } from '@overflow/commons-typescript/core/model';
import { Host, Service } from '@overflow/commons-typescript';
@Injectable() @Injectable()
export class InfraService { export class InfraService {
@ -16,19 +14,27 @@ export class InfraService {
} }
// public readAllByDomain(domain: Domain, pageParams: PageParams): Observable<Page> { public regist(infra: Infra): Observable<Infra> {
// return this.rpcService.call('InfraService.readAllByDomain', domain, pageParams); return this.rpcService.call<Infra>('InfraService.regist', infra);
// }
public readAllByProbeID(probeID: number, pageParams: PageParams): Observable<Page<Infra>> {
return this.rpcService.call<Page<Infra>>('InfraService.readAllByProbeID', probeID, pageParams);
} }
public read(id: string): Observable<Infra> { public read(id: string): Observable<Infra> {
return this.rpcService.call<Infra>('InfraService.read', id); return this.rpcService.call<Infra>('InfraService.read', id);
} }
public readAllInfraZoneByProbeID(probeID: number): Observable<Infra[]> { public registDiscoverd(probeID: number, hosts: Host[], services: Service[]): Observable<Infra[]> {
return this.rpcService.call<Infra[]>('InfraService.readAllInfraZoneByProbeID', probeID); return this.rpcService.call<Infra[]>('InfraService.registDiscoverd', probeID, hosts, services);
}
public readAllByProbeID(probeID: number, pageParams: PageParams): Observable<Page<Infra>> {
return this.rpcService.call<Page<Infra>>('InfraService.readAllByProbeID', probeID, pageParams);
}
public readAllByDomainID(domainID: number, pageParams: PageParams): Observable<Page<Infra>> {
return this.rpcService.call<Page<Infra>>('InfraService.readAllByDomainID', domainID, pageParams);
}
public readAllInfraZoneByProbeDomainID(probeDomainID: number): Observable<Infra[]> {
return this.rpcService.call<Infra[]>('InfraService.readAllInfraZoneByProbeDomainID', probeDomainID);
} }
} }

View File

@ -1,15 +0,0 @@
import { TestBed, inject } from '@angular/core/testing';
import { TargetService } from './target.service';
describe('TargetService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [TargetService]
});
});
it('should be created', inject([TargetService], (service: TargetService) => {
expect(service).toBeTruthy();
}));
});

View File

@ -4,9 +4,7 @@ import { RPCService } from '@loafer/ng-rpc';
import { Observable } from 'rxjs'; 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 { Page, PageParams } from '@overflow/commons-typescript/core/model'; import { Page, PageParams } from '@overflow/commons-typescript/core/model';
import {Notification} from '@overflow/commons-typescript/model/notification';
@Injectable() @Injectable()
export class TargetService { export class TargetService {
@ -17,27 +15,28 @@ export class TargetService {
} }
public registDiscoveredTargets(probeID: number, hosts: Host[], services: Service[]): Observable<Target[]> { public regist(target: Target, probeID: number): Observable<Target> {
return this.rpcService.call<Target[]>('TargetService.registDiscoveredTargets', probeID, hosts, services); return this.rpcService.call<Target>('TargetService.regist', target, probeID);
}
//
// public modify(target: Target): Observable<Target> {
// return this.rpcService.call<Target>('TargetService.modify', target);
// }
public findExistHostTarget(probeID: number, hostIP: string): Observable<Target> {
return this.rpcService.call<Target>('TargetService.readExistHostTarget', probeID, hostIP);
} }
public findExistServiceTarget(hostID: number, portNumber: number, portType: string): Observable<Target> { public registAll(targets: Target[], probeID: number): Observable<Target[]> {
return this.rpcService.call<Target>('TargetService.readExistServiceTarget', hostID, portNumber, portType); return this.rpcService.call<Target[]>('TargetService.registAll', targets, probeID);
}
public remove(id: number, probeID: number) {
return this.rpcService.call('TargetService.remove', id, probeID);
}
public read(id: number): Observable<Target> {
return this.rpcService.call<Target>('TargetService.read', id);
} }
public readAllByProbeID(probeID: number, pageParams: PageParams): Observable<Page<Target>> { public readAllByProbeID(probeID: number, pageParams: PageParams): Observable<Page<Target>> {
return this.rpcService.call<Page<Target>>('TargetService.readAllByProbeID', probeID, pageParams); return this.rpcService.call<Page<Target>>('TargetService.readAllByProbeID', probeID, pageParams);
} }
public read(targetID: number): Observable<Target> { public readAllTargetByProbeID(probeID: number): Observable<Target[]> {
return this.rpcService.call<Target>('TargetService.read', targetID); return this.rpcService.call<Target[]>('TargetService.readAllTargetByProbeID', probeID);
} }
} }