From 33b3340a8f2117e82ae0d7ca098e9fc51603b142 Mon Sep 17 00:00:00 2001 From: crusader Date: Fri, 2 Feb 2018 20:39:16 +0900 Subject: [PATCH] ing --- .../{api => }/service/api.service.spec.ts | 8 +++- .../commons/{api => }/service/api.service.ts | 19 ++++++++-- .../core/rpc/protocol/client-codec.ts | 0 .../rpc/protocol/json/client-notification.ts | 0 .../core/rpc/protocol/json/client-request.ts | 0 .../core/rpc/protocol/json/client-response.ts | 0 .../core/rpc/registry/rpc-registry.ts | 0 .../core/rx/websocket/rx-websocket-subject.ts | 4 +- .../components/signup/signup.component.scss | 37 ------------------- .../packages/member/service/member.service.ts | 16 +++++++- 10 files changed, 39 insertions(+), 45 deletions(-) rename src/app/commons/{api => }/service/api.service.spec.ts (61%) rename src/app/commons/{api => }/service/api.service.ts (57%) rename src/app/{commons => }/core/rpc/protocol/client-codec.ts (100%) rename src/app/{commons => }/core/rpc/protocol/json/client-notification.ts (100%) rename src/app/{commons => }/core/rpc/protocol/json/client-request.ts (100%) rename src/app/{commons => }/core/rpc/protocol/json/client-response.ts (100%) rename src/app/{commons => }/core/rpc/registry/rpc-registry.ts (100%) rename src/app/{commons => }/core/rx/websocket/rx-websocket-subject.ts (98%) delete mode 100644 src/app/packages/member/components/signup/signup.component.scss diff --git a/src/app/commons/api/service/api.service.spec.ts b/src/app/commons/service/api.service.spec.ts similarity index 61% rename from src/app/commons/api/service/api.service.spec.ts rename to src/app/commons/service/api.service.spec.ts index 9b2fbe6..3fc0d05 100644 --- a/src/app/commons/api/service/api.service.spec.ts +++ b/src/app/commons/service/api.service.spec.ts @@ -13,7 +13,13 @@ describe('APIService', () => { expect(service).toBeTruthy(); })); - it('should be created', inject([APIService], (service: APIService) => { + it('apiService connect to server', inject([APIService], (service: APIService) => { + service.connect(); + service.getConnectionStatus().subscribe( + (isConnected: boolean) => { + console.log('isConnected:' + isConnected); + } + ); expect(service).toBeTruthy(); })); diff --git a/src/app/commons/api/service/api.service.ts b/src/app/commons/service/api.service.ts similarity index 57% rename from src/app/commons/api/service/api.service.ts rename to src/app/commons/service/api.service.ts index 271952e..0131cbf 100644 --- a/src/app/commons/api/service/api.service.ts +++ b/src/app/commons/service/api.service.ts @@ -1,15 +1,17 @@ import { Injectable } from '@angular/core'; -import { RxWebsocketSubject } from 'app/commons/core/rx/websocket/rx-websocket-subject'; import { Observable } from 'rxjs/Observable'; +import { RxWebsocketSubject } from 'app/core/rx/websocket/rx-websocket-subject'; +import { RPCRegistry } from 'app/core/rpc/registry/rpc-registry'; @Injectable() export class APIService { private wsSocketSubject: RxWebsocketSubject; + private rpcRegistry: RPCRegistry; constructor() { - this.wsSocketSubject = new RxWebsocketSubject(''); + this.wsSocketSubject = new RxWebsocketSubject('ws://127.0.0.1:19090/webapp'); } public connect(): void { @@ -22,24 +24,35 @@ export class APIService { this.onError(error); }, () => { - + this.onDisconnected(); } ); } + public call(method: string, ...args: any[]): Observable { + return undefined; + } + + public send(method: string, ...args: any[]): void { + + } + public getConnectionStatus(): Observable { return this.wsSocketSubject.connectionStatus; } private onMessage(message: Object): void { // + console.log(message); } private onError(error: any): void { // + console.log(error); } private onDisconnected(): void { // + console.log('disconnected'); } } diff --git a/src/app/commons/core/rpc/protocol/client-codec.ts b/src/app/core/rpc/protocol/client-codec.ts similarity index 100% rename from src/app/commons/core/rpc/protocol/client-codec.ts rename to src/app/core/rpc/protocol/client-codec.ts diff --git a/src/app/commons/core/rpc/protocol/json/client-notification.ts b/src/app/core/rpc/protocol/json/client-notification.ts similarity index 100% rename from src/app/commons/core/rpc/protocol/json/client-notification.ts rename to src/app/core/rpc/protocol/json/client-notification.ts diff --git a/src/app/commons/core/rpc/protocol/json/client-request.ts b/src/app/core/rpc/protocol/json/client-request.ts similarity index 100% rename from src/app/commons/core/rpc/protocol/json/client-request.ts rename to src/app/core/rpc/protocol/json/client-request.ts diff --git a/src/app/commons/core/rpc/protocol/json/client-response.ts b/src/app/core/rpc/protocol/json/client-response.ts similarity index 100% rename from src/app/commons/core/rpc/protocol/json/client-response.ts rename to src/app/core/rpc/protocol/json/client-response.ts diff --git a/src/app/commons/core/rpc/registry/rpc-registry.ts b/src/app/core/rpc/registry/rpc-registry.ts similarity index 100% rename from src/app/commons/core/rpc/registry/rpc-registry.ts rename to src/app/core/rpc/registry/rpc-registry.ts diff --git a/src/app/commons/core/rx/websocket/rx-websocket-subject.ts b/src/app/core/rx/websocket/rx-websocket-subject.ts similarity index 98% rename from src/app/commons/core/rx/websocket/rx-websocket-subject.ts rename to src/app/core/rx/websocket/rx-websocket-subject.ts index 1ea93d5..0ee3bfb 100644 --- a/src/app/commons/core/rx/websocket/rx-websocket-subject.ts +++ b/src/app/core/rx/websocket/rx-websocket-subject.ts @@ -7,7 +7,6 @@ import { } from 'rxjs/observable/dom/WebSocketSubject'; import 'rxjs/add/operator/distinctUntilChanged'; -import 'rxjs/add/operator/interval'; import 'rxjs/add/operator/share'; import 'rxjs/add/operator/takeWhile'; import 'rxjs/add/observable/interval'; @@ -112,7 +111,8 @@ export class RxWebsocketSubject extends Subject { this.complete(); this.connectionObserver.complete(); } - }); + } + ); } public send(data: any): void { diff --git a/src/app/packages/member/components/signup/signup.component.scss b/src/app/packages/member/components/signup/signup.component.scss deleted file mode 100644 index eaf77bc..0000000 --- a/src/app/packages/member/components/signup/signup.component.scss +++ /dev/null @@ -1,37 +0,0 @@ -$gray-lighter: #eceeef !default; -$image_path: "/assets/images/" !default; - -$prefix: 'sigin'; - -.#{$prefix} { - - &-conainer { - min-height: 100%; - background-size: cover; - padding: 100px; - } - - &-main { - position: relative; - margin: 0 auto; - width: 500px; - } -} - -.full-width { - width: 100%; -} - -.help { - -} - -.is-danger { - -} - -.redirect { - font-size: 14px; - margin-left: 10px; - color: #00AAAA; -} diff --git a/src/app/packages/member/service/member.service.ts b/src/app/packages/member/service/member.service.ts index 85c1ee1..c56720c 100644 --- a/src/app/packages/member/service/member.service.ts +++ b/src/app/packages/member/service/member.service.ts @@ -1,11 +1,23 @@ import { Injectable } from '@angular/core'; +import { APIService } from 'app/commons/service/api.service'; + +import { Member } from '../model/member'; @Injectable() export class MemberService { - constructor() { } + public constructor( + private apiService: APIService, + ) { } - signin(email: string, password: string) { + public signin(email: string, password: string) { + this.apiService.call('MemberService.signin', email, password).subscribe( + (member: Member) => { + }, + (error: any) => { + + } + ); } }