diff --git a/.vscode/settings.json b/.vscode/settings.json index d0e8374..9648132 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,6 +1,8 @@ { "editor.tabSize": 2, "editor.insertSpaces": true, - + "editor.formatOnSave": true, + "editor.formatOnPaste": true, + "editor.autoClosingBrackets": true, "git.ignoreLimitWarning": true } \ No newline at end of file diff --git a/@overflow/discovery/component/discovery.component.ts b/@overflow/discovery/component/discovery.component.ts index 4d73f7c..f10d5c6 100644 --- a/@overflow/discovery/component/discovery.component.ts +++ b/@overflow/discovery/component/discovery.component.ts @@ -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 ) { 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', diff --git a/@overflow/discovery/component/search-result.component.ts b/@overflow/discovery/component/search-result.component.ts index 9984376..36d7252 100644 --- a/@overflow/discovery/component/search-result.component.ts +++ b/@overflow/discovery/component/search-result.component.ts @@ -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(); } } diff --git a/@overflow/discovery/service/discovery.service.spec.ts b/@overflow/discovery/service/discovery.service.spec.ts deleted file mode 100644 index 7859d24..0000000 --- a/@overflow/discovery/service/discovery.service.spec.ts +++ /dev/null @@ -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(); - })); -}); diff --git a/@overflow/discovery/service/index.ts b/@overflow/discovery/service/index.ts index bc88e90..f19161b 100644 --- a/@overflow/discovery/service/index.ts +++ b/@overflow/discovery/service/index.ts @@ -1,7 +1,5 @@ import { DiscoveryService } from './discovery.service'; -import { TargetService } from '@overflow/target/service/target.service'; export const SERVICES = [ DiscoveryService, - TargetService ]; diff --git a/@overflow/discovery/service/target-discovery.service.spec.ts b/@overflow/discovery/service/target-discovery.service.spec.ts deleted file mode 100644 index 6e58f64..0000000 --- a/@overflow/discovery/service/target-discovery.service.spec.ts +++ /dev/null @@ -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(); - })); -}); diff --git a/@overflow/discovery/service/target-discovery.service.ts b/@overflow/discovery/service/target-discovery.service.ts deleted file mode 100644 index 30f29d4..0000000 --- a/@overflow/discovery/service/target-discovery.service.ts +++ /dev/null @@ -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 { - - return this.rpcService.call('TargetDiscoveryService.saveAllTarget', hosts, probe); - } - -} diff --git a/@overflow/infra/service/infra-host.service.spec.ts b/@overflow/infra/service/infra-host.service.spec.ts deleted file mode 100644 index 8ea4409..0000000 --- a/@overflow/infra/service/infra-host.service.spec.ts +++ /dev/null @@ -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(); - })); -}); diff --git a/@overflow/infra/service/infra-host.service.ts b/@overflow/infra/service/infra-host.service.ts deleted file mode 100644 index 4ce6740..0000000 --- a/@overflow/infra/service/infra-host.service.ts +++ /dev/null @@ -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 { - // return this.rpcService.call('InfraService.readAllByDomain', domain, pageParams); - // } - - // public readAllByProbe(probe: Probe, pageParams: PageParams): Observable { - // return this.rpcService.call('InfraService.readAllByProbe', probe, pageParams); - // } - - public read(id: number): Observable { - return this.rpcService.call('InfraHostService.read', id); - } -} diff --git a/@overflow/infra/service/infra.service.spec.ts b/@overflow/infra/service/infra.service.spec.ts deleted file mode 100644 index 9d6ab70..0000000 --- a/@overflow/infra/service/infra.service.spec.ts +++ /dev/null @@ -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(); - })); -}); diff --git a/@overflow/infra/service/infra.service.ts b/@overflow/infra/service/infra.service.ts index d36f8d3..79d4141 100644 --- a/@overflow/infra/service/infra.service.ts +++ b/@overflow/infra/service/infra.service.ts @@ -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 { - // return this.rpcService.call('InfraService.readAllByDomain', domain, pageParams); - // } - - public readAllByProbeID(probeID: number, pageParams: PageParams): Observable> { - return this.rpcService.call>('InfraService.readAllByProbeID', probeID, pageParams); + public regist(infra: Infra): Observable { + return this.rpcService.call('InfraService.regist', infra); } public read(id: string): Observable { return this.rpcService.call('InfraService.read', id); } - public readAllInfraZoneByProbeID(probeID: number): Observable { - return this.rpcService.call('InfraService.readAllInfraZoneByProbeID', probeID); + public registDiscoverd(probeID: number, hosts: Host[], services: Service[]): Observable { + return this.rpcService.call('InfraService.registDiscoverd', probeID, hosts, services); + } + + public readAllByProbeID(probeID: number, pageParams: PageParams): Observable> { + return this.rpcService.call>('InfraService.readAllByProbeID', probeID, pageParams); + } + + public readAllByDomainID(domainID: number, pageParams: PageParams): Observable> { + return this.rpcService.call>('InfraService.readAllByDomainID', domainID, pageParams); + } + + public readAllInfraZoneByProbeDomainID(probeDomainID: number): Observable { + return this.rpcService.call('InfraService.readAllInfraZoneByProbeDomainID', probeDomainID); } } diff --git a/@overflow/target/service/target.service.spec.ts b/@overflow/target/service/target.service.spec.ts deleted file mode 100644 index 692b9cb..0000000 --- a/@overflow/target/service/target.service.spec.ts +++ /dev/null @@ -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(); - })); -}); diff --git a/@overflow/target/service/target.service.ts b/@overflow/target/service/target.service.ts index ebd0225..815a4d4 100644 --- a/@overflow/target/service/target.service.ts +++ b/@overflow/target/service/target.service.ts @@ -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 { - return this.rpcService.call('TargetService.registDiscoveredTargets', probeID, hosts, services); - } - // - // public modify(target: Target): Observable { - // return this.rpcService.call('TargetService.modify', target); - // } - - public findExistHostTarget(probeID: number, hostIP: string): Observable { - return this.rpcService.call('TargetService.readExistHostTarget', probeID, hostIP); + public regist(target: Target, probeID: number): Observable { + return this.rpcService.call('TargetService.regist', target, probeID); } - public findExistServiceTarget(hostID: number, portNumber: number, portType: string): Observable { - return this.rpcService.call('TargetService.readExistServiceTarget', hostID, portNumber, portType); + public registAll(targets: Target[], probeID: number): Observable { + return this.rpcService.call('TargetService.registAll', targets, probeID); + } + + public remove(id: number, probeID: number) { + return this.rpcService.call('TargetService.remove', id, probeID); + } + + public read(id: number): Observable { + return this.rpcService.call('TargetService.read', id); } public readAllByProbeID(probeID: number, pageParams: PageParams): Observable> { return this.rpcService.call>('TargetService.readAllByProbeID', probeID, pageParams); } - public read(targetID: number): Observable { - return this.rpcService.call('TargetService.read', targetID); + public readAllTargetByProbeID(probeID: number): Observable { + return this.rpcService.call('TargetService.readAllTargetByProbeID', probeID); } + }