noauth probe refresh

This commit is contained in:
snoop 2017-09-28 16:26:51 +09:00
parent 69325a7951
commit 4974336077
6 changed files with 69 additions and 4 deletions

View File

@ -14,6 +14,7 @@ import hostReadByProbeReducer from '@overflow/probe/redux/reducer/host_read_by_p
import modifyProbeReducer from '@overflow/probe/redux/reducer/modify';
import readNoAuthProbeReducer from '@overflow/noauthprobe/redux/reducer/read_all_by_domain';
import noauthNewReducer from '@overflow/noauthprobe/redux/reducer/new_noauth_probe';
import noauthAcceptReducer from '@overflow/noauthprobe/redux/reducer/accept';
import noauthDenyReducer from '@overflow/noauthprobe/redux/reducer/deny';
@ -76,7 +77,7 @@ export interface RPCConfig {
url: string;
}
const rpcConfig: RPCConfig = {
url: 'ws://192.168.1.101:19090/web',
url: 'ws://192.168.1.50:19090/web',
};
// REST Server Configuration
@ -126,6 +127,7 @@ const reduxConfig: ReduxConfig = {
readOSReducer,
readServiceReducer,
hostReadByProbeReducer,
noauthNewReducer,
noauthAcceptReducer,
noauthDenyReducer,
modifyProbeReducer,

View File

@ -5,7 +5,7 @@ import {
import Action from '@overflow/commons/redux/Action';
export abstract class Service {
private store: Store<any>;
protected store: Store<any>;
public setStore(store: Store<any>): void {
this.store = store;

View File

@ -1,7 +1,10 @@
import { Service } from '@overflow/commons/api/service';
import NoAuthProbe from '../model/NoAuthProbe';
import Action from '@overflow/commons/redux/Action';
import * as AcceptActions from '../../redux/action/accept';
import * as NewActions from '../../redux/action/new_noauth_probe';
import * as asyncRequestActions from '@overflow/commons/redux/action/asyncRequest';
import * as noauthListActions from '../../redux/action/read_all_by_domain';
export class NoAuthProbeService extends Service {
public constructor() {
@ -10,7 +13,12 @@ export class NoAuthProbeService extends Service {
public regist(params: any): void {
const noAuthProbe: NoAuthProbe = JSON.parse(params);
this.dispatch(AcceptActions.REQUEST, noAuthProbe);
if(noAuthProbe.domain === undefined || noAuthProbe.domain === null) {
return;
}
// this.dispatch(NewActions.REQUEST_SUCCESS, noAuthProbe);
this.store.dispatch(asyncRequestActions.request('NoAuthProbeService', 'readAllByDomain',
noauthListActions.REQUEST, JSON.stringify(noAuthProbe.domain)));
}
}

View File

@ -0,0 +1,7 @@
export type REQUEST = '@overflow/noAuthProbe/new/REQUEST';
export type REQUEST_SUCCESS = '@overflow/noAuthProbe/new/REQUEST/SUCCESS';
export type REQUEST_FAILURE = '@overflow/noAuthProbe/new/REQUEST/FAILURE';
export const REQUEST: REQUEST = '@overflow/noAuthProbe/new/REQUEST';
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/noAuthProbe/new/REQUEST/SUCCESS';
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/noAuthProbe/new/REQUEST/FAILURE';

View File

@ -0,0 +1,35 @@
import Action from '@overflow/commons/redux/Action';
import { ReducersMapObject } from 'redux';
import NoAuthProbe from '@overflow/noauthprobe/api/model/NoAuthProbe';
import * as NewActionTypes from '../action/new_noauth_probe';
import NewState, { defaultState as newDefaultState } from '../state/NewNoAuthProbe';
import * as _ from 'lodash';
const reducer: ReducersMapObject = {
[NewActionTypes.REQUEST_SUCCESS]:
(state: NewState = newDefaultState, action: Action<NoAuthProbe>):
NewState => {
let nlist: Array<NoAuthProbe>;
if (state.noauthList === undefined) {
nlist = null;
} else {
nlist = _.clone(state.noauthList);
nlist.push(action.payload);
}
return {
...state,
noauthList: nlist,
};
},
[NewActionTypes.REQUEST_FAILURE]:
(state: NewState = newDefaultState, action: Action<Error>):
NewState => {
return state;
},
};
export default reducer;

View File

@ -0,0 +1,13 @@
import NoAuthProbe from '../../api/model/NoAuthProbe';
export interface State {
readonly noauthList?: NoAuthProbe[];
readonly error?: Error;
}
export const defaultState: State = {
noauthList: undefined,
error: undefined,
};
export default State;