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.insertSpaces": true,
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.autoClosingBrackets": true,
"git.ignoreLimitWarning": true
}

View File

@ -1,13 +1,12 @@
import {
Component, Input, Output, EventEmitter, OnDestroy, ViewChild,
Component, Input, OnDestroy, ViewChild,
} from '@angular/core';
import { Store, select } from '@ngrx/store';
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 { Anim } from './animation';
@ -42,7 +41,6 @@ export class DiscoveryComponent implements OnDestroy {
constructor(
private discoveryService: DiscoveryService,
private discoverySubscriber: DiscoverySubscriber,
private store: Store<any>
) {
this.discoverySubscription = null;
this.finished = false;
@ -60,7 +58,7 @@ export class DiscoveryComponent implements OnDestroy {
// TODO: fix
const zone: Zone = {
network: '192.168.1.0/24',
network: '192.168.1.0/24', // this.selectedProbe.probe.cidr
address: '192.168.1.103',
iface: 'enp3s0',
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)
.pipe(
tap(() => {
this.targetSaveSucceed = false;
}),
map((targets: Target[]) => {
if (targets) {
this.displayTargetDone = true;
}
}),
catchError(error => {
this.error$ = of(error);
return of();
}),
tap(() => {
this.targetSaveSucceed = true;
}),
take(1),
).subscribe();
// this.targetService.registDiscoveredTargets(this.probeHost.probe.id, hosts, services)
// .pipe(
// tap(() => {
// this.targetSaveSucceed = false;
// }),
// map((targets: Target[]) => {
// if (targets) {
// this.displayTargetDone = true;
// }
// }),
// catchError(error => {
// this.error$ = of(error);
// return of();
// }),
// tap(() => {
// this.targetSaveSucceed = true;
// }),
// take(1),
// ).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 { TargetService } from '@overflow/target/service/target.service';
export const SERVICES = [
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 { Observable } from 'rxjs';
import { RPCService } from '@loafer/ng-rpc';
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 { Host, Service } from '@overflow/commons-typescript';
@Injectable()
export class InfraService {
@ -16,19 +14,27 @@ export class InfraService {
}
// public readAllByDomain(domain: Domain, pageParams: PageParams): Observable<Page> {
// return this.rpcService.call('InfraService.readAllByDomain', domain, pageParams);
// }
public readAllByProbeID(probeID: number, pageParams: PageParams): Observable<Page<Infra>> {
return this.rpcService.call<Page<Infra>>('InfraService.readAllByProbeID', probeID, pageParams);
public regist(infra: Infra): Observable<Infra> {
return this.rpcService.call<Infra>('InfraService.regist', infra);
}
public read(id: string): Observable<Infra> {
return this.rpcService.call<Infra>('InfraService.read', id);
}
public readAllInfraZoneByProbeID(probeID: number): Observable<Infra[]> {
return this.rpcService.call<Infra[]>('InfraService.readAllInfraZoneByProbeID', probeID);
public registDiscoverd(probeID: number, hosts: Host[], services: Service[]): Observable<Infra[]> {
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 { 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 {Notification} from '@overflow/commons-typescript/model/notification';
@Injectable()
export class TargetService {
@ -17,27 +15,28 @@ export class TargetService {
}
public registDiscoveredTargets(probeID: number, hosts: Host[], services: Service[]): Observable<Target[]> {
return this.rpcService.call<Target[]>('TargetService.registDiscoveredTargets', probeID, hosts, services);
}
//
// 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 regist(target: Target, probeID: number): Observable<Target> {
return this.rpcService.call<Target>('TargetService.regist', target, probeID);
}
public findExistServiceTarget(hostID: number, portNumber: number, portType: string): Observable<Target> {
return this.rpcService.call<Target>('TargetService.readExistServiceTarget', hostID, portNumber, portType);
public registAll(targets: Target[], probeID: number): Observable<Target[]> {
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>> {
return this.rpcService.call<Page<Target>>('TargetService.readAllByProbeID', probeID, pageParams);
}
public read(targetID: number): Observable<Target> {
return this.rpcService.call<Target>('TargetService.read', targetID);
public readAllTargetByProbeID(probeID: number): Observable<Target[]> {
return this.rpcService.call<Target[]>('TargetService.readAllTargetByProbeID', probeID);
}
}