diff --git a/@overflow/meta/component/meta-service-type-selector.component.html b/@overflow/meta/component/meta-service-type-selector.component.html new file mode 100644 index 0000000..b50a77c --- /dev/null +++ b/@overflow/meta/component/meta-service-type-selector.component.html @@ -0,0 +1,15 @@ + + + + +
+ + +
+
{{service.name}}
+
+
+
+
+
\ No newline at end of file diff --git a/@overflow/meta/component/meta-service-type-selector.component.ts b/@overflow/meta/component/meta-service-type-selector.component.ts new file mode 100644 index 0000000..4199f71 --- /dev/null +++ b/@overflow/meta/component/meta-service-type-selector.component.ts @@ -0,0 +1,50 @@ +import { Component, OnInit, Input, OnChanges, Output, EventEmitter } 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 { MetaCrawler, MetaTargetServiceType, MetaInfraTypeEnum, toMetaInfraTypeEnum, toMetaInfraType, MetaTargetType } from '@overflow/commons-typescript/model/meta'; +import { MetaCrawlerService } from '../service/meta-crawler.service'; +import { MetaTargetTypeService } from '../service/meta-target-type.service'; + + +@Component({ + selector: 'of-meta-service-type-selector', + templateUrl: './meta-service-type-selector.component.html', +}) +export class MetaServiceTypeSelectorComponent implements OnInit { + + @Output() selected = new EventEmitter(); + + metaTargetServiceTypes: MetaTargetServiceType[]; + pending$: Observable; + error$: Observable; + + constructor( + private metaTargetTypeService: MetaTargetTypeService, + ) { } + + ngOnInit() { + this.metaTargetTypeService.readAllByMetaInfraType + (toMetaInfraType(MetaInfraTypeEnum.SERVICE)) + .pipe( + tap(() => { + this.pending$ = of(true); + }), + map((metaTargetTypes: MetaTargetType[]) => { + this.metaTargetServiceTypes = metaTargetTypes; + console.log(this.metaTargetServiceTypes); + }), + catchError(error => { + this.error$ = of(error); + return of(); + }), + tap(() => { + this.pending$ = of(false); + }), + take(1), + ).subscribe(); + } + +} diff --git a/@overflow/meta/service/meta-target-type.service.ts b/@overflow/meta/service/meta-target-type.service.ts index 370ea93..ad7babc 100644 --- a/@overflow/meta/service/meta-target-type.service.ts +++ b/@overflow/meta/service/meta-target-type.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { Observable } from 'rxjs'; import { RPCService } from '@loafer/ng-rpc'; -import { MetaTargetType } from '@overflow/commons-typescript/model/meta'; +import { MetaTargetType, MetaInfraType } from '@overflow/commons-typescript/model/meta'; @Injectable() export class MetaTargetTypeService { @@ -19,4 +19,8 @@ export class MetaTargetTypeService { public readAll(): Observable { return this.rpcService.call('MetaTargetTypeService.readAll'); } + + public readAllByMetaInfraType(metaInfraType: MetaInfraType): Observable { + return this.rpcService.call('MetaTargetTypeService.readAllByMetaInfraType', metaInfraType); + } } diff --git a/package.json b/package.json index df6d10c..2ffb3d0 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "@ngrx/router-store": "^5.2.0", "@ngrx/store": "^5.2.0", "@ngrx/store-devtools": "^5.2.0", - "@overflow/commons-typescript": "^0.0.13", + "@overflow/commons-typescript": "^0.0.14", "angular-google-recaptcha": "^1.0.3", "angular-l10n": "^5.0.0", "angularx-qrcode": "^1.1.7", @@ -76,4 +76,4 @@ "tslint": "~5.9.1", "typescript": "~2.7.2" } -} +} \ No newline at end of file diff --git a/src/environments/environment.ts b/src/environments/environment.ts index a586811..1d32219 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -5,9 +5,9 @@ export const environment = { production: false, - restBaseURL: 'http://192.168.1.50:19080/webapp', + restBaseURL: 'http://192.168.1.101:19080/webapp', webappRPCConfig: { - url: 'ws://192.168.1.50:19090/webapp', + url: 'ws://192.168.1.101:19090/webapp', reconnectInterval: 5000, reconnectRetry: 10, },