This commit is contained in:
crusader 2017-09-27 18:33:10 +09:00
parent ffe7882ad5
commit 5a6d350a8e
11 changed files with 164 additions and 9 deletions

5
src/semantic-ui/index.js Normal file
View File

@ -0,0 +1,5 @@
// this would bundle all Semantic components
require("semantic-ui-less/semantic.less");
// this would bundle only our selected components through our local semantic.less file
// require("./semantic.less");

View File

@ -0,0 +1,12 @@
/* We will be keeping the globals and 2 components: Button and Breadcrumbs */
/* Global */
& { @import "~semantic-ui-less/definitions/globals/reset"; }
& { @import "~semantic-ui-less/definitions/globals/site"; }
/* Elements */
& { @import "~semantic-ui-less/definitions/elements/button"; }
/* Collections */
& { @import "~semantic-ui-less/definitions/collections/breadcrumb"; }

View File

@ -0,0 +1,6 @@
@backgroundColor: #aeaeae;
@primaryColor: #A05595;
@secondaryColor: #1C9BD5;
@fontWeight: normal;

View File

@ -0,0 +1,95 @@
/*
████████╗██╗ ██╗███████╗███╗ ███╗███████╗███████╗
╚══██╔══╝██║ ██║██╔════╝████╗ ████║██╔════╝██╔════╝
██║ ███████║█████╗ ██╔████╔██║█████╗ ███████╗
██║ ██╔══██║██╔══╝ ██║╚██╔╝██║██╔══╝ ╚════██║
██║ ██║ ██║███████╗██║ ╚═╝ ██║███████╗███████║
╚═╝ ╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝╚══════╝╚══════╝
*/
/*******************************
Theme Selection
*******************************/
/* To override a theme for an individual element
specify theme name below
*/
/* Global */
@site : 'default';
@reset : 'default';
/* Elements */
@button : 'default';
@container : 'default';
@divider : 'default';
@flag : 'default';
@header : 'default';
@icon : 'default';
@image : 'default';
@input : 'default';
@label : 'default';
@list : 'default';
@loader : 'default';
@rail : 'default';
@reveal : 'default';
@segment : 'default';
@step : 'default';
/* Collections */
@breadcrumb : 'default';
@form : 'default';
@grid : 'default';
@menu : 'default';
@message : 'default';
@table : 'default';
/* Modules */
@accordion : 'default';
@checkbox : 'default';
@dimmer : 'default';
@dropdown : 'default';
@embed : 'default';
@modal : 'default';
@nag : 'default';
@popup : 'default';
@progress : 'default';
@rating : 'default';
@search : 'default';
@shape : 'default';
@sidebar : 'default';
@sticky : 'default';
@tab : 'default';
@transition : 'default';
/* Views */
@ad : 'default';
@card : 'default';
@comment : 'default';
@feed : 'default';
@item : 'default';
@statistic : 'default';
/*******************************
Folders
*******************************/
/* Path to theme packages */
@themesFolder : 'themes';
/* Path to site override folder */
@siteFolder : "./site";
/*******************************
Import Theme
*******************************/
@import "~semantic-ui-less/theme.less";
/*
@fontPath : "../../../themes/@{theme}/assets/fonts";
*/
/* End Config */

View File

@ -1,6 +1,8 @@
import { ReducersMapObject } from 'redux';
import SagaWatcher from '@overflow/commons/redux/saga/SagaWatcher';
import { Service as APIService } from '@overflow/commons/api/service';
import signInReducer from '@overflow/member/redux/reducer/signIn';
import signUpReducer from '@overflow/member/redux/reducer/signUp';
import modifyMemberReducer from '@overflow/member/redux/reducer/modify';
@ -57,6 +59,8 @@ import AuthCrawlerRegistReducer from '@overflow/auth/redux/reducer/regist';
import AsyncRequest from '@overflow/app/redux/saga/AsyncRequest';
import AsyncRestRequest from '@overflow/app/redux/saga/AsyncRestRequest';
import DiscoveryService from '@overflow/discovery/api/service/DiscoveryService';
// Container Configuration
export interface ContainerConfig {
placeholderID: string;
@ -70,7 +74,7 @@ export interface RPCConfig {
url: string;
}
const rpcConfig: RPCConfig = {
url: 'ws://192.168.1.209:19090/web',
url: 'ws://192.168.1.101:19090/web',
};
// REST Server Configuration
@ -143,6 +147,9 @@ const reduxConfig: ReduxConfig = {
],
};
const serviceConfig: Map<string, APIService> = new Map([
['DiscoveryService', DiscoveryService],
]);
// Configuration
export interface Config {
@ -150,6 +157,7 @@ export interface Config {
rpc: RPCConfig;
rest: RestConfig;
redux: ReduxConfig;
service: Map<string, APIService>;
}
const config: Config = {
@ -157,6 +165,7 @@ const config: Config = {
rpc: rpcConfig,
rest: restConfig,
redux: reduxConfig,
service: serviceConfig,
};
export default config;

View File

@ -47,6 +47,8 @@ import WebSocketRPC from '@overflow/commons/websocket/WebSocketRPC';
import ReducerContext from '@overflow/commons/redux/ReducerContext';
import SagaWatcher from '@overflow/commons/redux/saga/SagaWatcher';
import ServiceInvoker from '@overflow/commons/invoke/ServiceInvoker';
import appConfig, { Config, ReduxState } from './config';
@ -105,6 +107,7 @@ class OFApplication {
private initRpcClient(): Promise<WebSocketRPC> {
const rpcClient = new Promise<WebSocketRPC>((resolve, reject) => {
let serviceInvoker = new ServiceInvoker(this.config.service);
let client = new WebSocketRPC(this.config.rpc.url);
client.initialize()
.then(() => {

View File

@ -0,0 +1,5 @@
export abstract class Service {
}
export default Service;

View File

@ -0,0 +1 @@
export * from './Service';

View File

@ -1,13 +1,24 @@
import {Service} from '@overflow/commons/api/service';
export class ServiceInvoker {
private config: Map<string, Service>;
private instanceMap: Map<string, Object>;
private configMap: Map<string, Object>;
public constructor(config: Map<string, Service>) {
this.config = config;
this.instanceMap = new Map();
public constructor() {
this.configMap = new Map();
this.initialize();
}
private initialize(): void {
this.config.forEach((value, key) => {
this.instanceMap.set(key, Object.create(value));
});
}
public invoke(className: string, methodName: string, params?: any): void {
let classObj: Object = this.configMap.get(className);
let classObj: Object = this.instanceMap.get(className);
if (classObj === null || classObj === undefined) {
console.log('Error: Cannot find the class. [' + className + ']');
return;
@ -21,3 +32,4 @@ export class ServiceInvoker {
}
export default ServiceInvoker;

View File

@ -44,13 +44,16 @@ export default class WebSocketRPC {
private requestQueue: Map<ID_TYPE, RequestQueue>;
private serviceInvoker: ServiceInvoker;
/**
* name
*/
public constructor(url: string) {
public constructor(url: string, serviceInvoker: ServiceInvoker) {
this.isReady = false;
this.connStatus = WebSocketStatus.NOT_CONNECT;
this.url = url;
this.serviceInvoker = serviceInvoker;
this.onResponseListeners = new Map();
this.requestQueue = new Map();
}
@ -195,8 +198,7 @@ export default class WebSocketRPC {
let className = methodArr[0];
let methodName = methodArr[1];
let serviceInvoker: ServiceInvoker = new ServiceInvoker();
serviceInvoker.invoke(className, methodName, notification.Params);
this.serviceInvoker.invoke(className, methodName, notification.Params);
}
private fireOnDisconnect(): void {

View File

@ -1,7 +1,10 @@
import { Service } from '@overflow/commons/api/service';
export class DiscoveryService {
export class DiscoveryService extends Service {
// tslint:disable-next-line:no-empty
public constructor() {
super();
}
public done(): void {
@ -10,3 +13,5 @@ export class DiscoveryService {
}
}
export default DiscoveryService;