ing
This commit is contained in:
parent
9c0f27b9a2
commit
a0dcd38dcf
|
@ -2,6 +2,9 @@ import { ReducersMapObject } from 'redux';
|
|||
import SagaWatcher from '@overflow/commons/redux/saga/SagaWatcher';
|
||||
|
||||
import signInReducer from '@overflow/member/redux/reducer/signIn';
|
||||
import readAllProbeReducer from '@overflow/probe/redux/reducer/readAllByDomain';
|
||||
import readProbeReducer from '@overflow/probe/redux/reducer/read';
|
||||
|
||||
import AsyncRequest from '@overflow/app/redux/saga/AsyncRequest';
|
||||
|
||||
// Container Configuration
|
||||
|
@ -37,6 +40,8 @@ const reduxConfig: ReduxConfig = {
|
|||
state: reduxState,
|
||||
reducerMaps: [
|
||||
signInReducer,
|
||||
readAllProbeReducer,
|
||||
readProbeReducer,
|
||||
],
|
||||
sagaWatchers: [
|
||||
AsyncRequest,
|
||||
|
|
|
@ -112,6 +112,7 @@ export default class WebSocketRPC {
|
|||
let promise = this.requestQueue.get(requestID);
|
||||
this.requestQueue.delete(requestID);
|
||||
if (null != result) {
|
||||
console.log(result);
|
||||
promise.resolve(result);
|
||||
} else if (null != error) {
|
||||
promise.reject(error);
|
||||
|
|
|
@ -41,10 +41,8 @@ export class SignIn extends React.Component<Props, State> {
|
|||
forgotPopup: false,
|
||||
sendComPopup: false,
|
||||
email: 'overflow@loafle.com',
|
||||
pass: 'qwer5795',
|
||||
pass: '!@#$qwer1234',
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
public render(): JSX.Element {
|
||||
|
|
|
@ -6,8 +6,6 @@ import {
|
|||
} from './components/NoauthProbeList';
|
||||
import Domain from '@overflow/domain/api/model/Domain';
|
||||
|
||||
import * as probeListActions from '../redux/action/read_all_by_domain';
|
||||
|
||||
|
||||
export function mapStateToProps(state: any): ProbeListStateProps {
|
||||
return {
|
||||
|
@ -17,9 +15,6 @@ export function mapStateToProps(state: any): ProbeListStateProps {
|
|||
|
||||
export function mapDispatchToProps(dispatch: Dispatch<any>): ProbeListDispatchProps {
|
||||
return {
|
||||
onReadAllByDomain: (domain: Domain) => {
|
||||
dispatch(probeListActions.request(domain));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ export interface StateProps {
|
|||
}
|
||||
|
||||
export interface DispatchProps {
|
||||
onReadAllByDomain(domain: Domain): void;
|
||||
}
|
||||
|
||||
export type Props = StateProps & DispatchProps;
|
||||
|
|
|
@ -6,7 +6,8 @@ import {
|
|||
} from './components/ProbeDetailInfo';
|
||||
import { push as routerPush } from 'react-router-redux';
|
||||
import Probe from '@overflow/probe/api/model/Probe';
|
||||
|
||||
import * as asyncRequestActions from '@overflow/commons/redux/action/asyncRequest';
|
||||
import * as probeReadActions from '../redux/action/read';
|
||||
|
||||
export function mapStateToProps(state: any, props: any): ProbeDetailStateProps {
|
||||
return {
|
||||
|
@ -16,9 +17,12 @@ export function mapStateToProps(state: any, props: any): ProbeDetailStateProps {
|
|||
|
||||
export function mapDispatchToProps(dispatch: Dispatch<any>): ProbeDetailDispatchProps {
|
||||
return {
|
||||
onDiscoveryClick: ( id: string) => {
|
||||
dispatch(routerPush( id + '/ targets' ));
|
||||
},
|
||||
onRead: (id: string) => {
|
||||
dispatch(asyncRequestActions.request('ProbeService', 'read', probeReadActions.REQUEST, id));
|
||||
},
|
||||
onDiscoveryClick: (id: string) => {
|
||||
dispatch(routerPush(id + '/ targets'));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -8,17 +8,17 @@ import {
|
|||
import Domain from '@overflow/domain/api/model/Domain';
|
||||
import * as probeListActions from '../redux/action/read_all_by_domain';
|
||||
import { push as routerPush } from 'react-router-redux';
|
||||
import * as asyncRequestActions from '@overflow/commons/redux/action/asyncRequest';
|
||||
|
||||
export function mapStateToProps(state: any): ProbeListStateProps {
|
||||
return {
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
export function mapDispatchToProps(dispatch: Dispatch<any>): ProbeListDispatchProps {
|
||||
return {
|
||||
onReadAllByDomain: (domain: Domain) => {
|
||||
dispatch(probeListActions.request(domain));
|
||||
dispatch(asyncRequestActions.request('ProbeService', 'readAllByDomain', probeListActions.REQUEST, JSON.stringify(domain)));
|
||||
},
|
||||
onProbeSelection: (id: string) => {
|
||||
dispatch(routerPush('/probe/' + id));
|
||||
|
|
|
@ -15,7 +15,8 @@ export interface StateProps {
|
|||
}
|
||||
|
||||
export interface DispatchProps {
|
||||
onDiscoveryClick(id:string):void;
|
||||
onRead?(id: string): void;
|
||||
onDiscoveryClick?(id:string):void;
|
||||
}
|
||||
|
||||
export type Props = StateProps & DispatchProps;
|
||||
|
@ -37,7 +38,7 @@ export class ProbeDetailInfo extends React.Component<Props, State> {
|
|||
}
|
||||
|
||||
public componentWillMount(): void {
|
||||
|
||||
this.props.onRead(this.props.id);
|
||||
// todo. getting probe by probeId
|
||||
let p = {
|
||||
'id': '11',
|
||||
|
|
|
@ -8,8 +8,8 @@ export interface StateProps {
|
|||
}
|
||||
|
||||
export interface DispatchProps {
|
||||
onReadAllByDomain(domain: Domain): void;
|
||||
onProbeSelection(id: string): void;
|
||||
onReadAllByDomain?(domain: Domain): void;
|
||||
onProbeSelection?(id: string): void;
|
||||
}
|
||||
|
||||
export type Props = StateProps & DispatchProps;
|
||||
|
@ -33,13 +33,13 @@ export class ProbeList extends React.Component<Props, State> {
|
|||
}
|
||||
|
||||
public componentWillMount(): void {
|
||||
// let domain: Domain = {
|
||||
// id: 1,
|
||||
// };
|
||||
// this.props.onReadAllByDomain(domain);
|
||||
let domain: Domain = {
|
||||
id: 1,
|
||||
};
|
||||
this.props.onReadAllByDomain(domain);
|
||||
this.data = [
|
||||
{
|
||||
'id': 11,
|
||||
'id': 1,
|
||||
'status': {
|
||||
'name': 'NORMAL',
|
||||
},
|
||||
|
@ -58,7 +58,7 @@ export class ProbeList extends React.Component<Props, State> {
|
|||
'description': 'description1111111111',
|
||||
},
|
||||
{
|
||||
'id': 22,
|
||||
'id': 1,
|
||||
'status': {
|
||||
'name': 'INITIAL',
|
||||
},
|
||||
|
@ -73,7 +73,7 @@ export class ProbeList extends React.Component<Props, State> {
|
|||
'description': 'description1111111111',
|
||||
},
|
||||
{
|
||||
'id': 33,
|
||||
'id': 1,
|
||||
'status': {
|
||||
'name': 'NORMAL',
|
||||
},
|
||||
|
|
7
src/ts/@overflow/probe/redux/action/read.ts
Normal file
7
src/ts/@overflow/probe/redux/action/read.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
export type REQUEST = '@overflow/probe/read/REQUEST';
|
||||
export type REQUEST_SUCCESS = '@overflow/probe/read/REQUEST/SUCCESS';
|
||||
export type REQUEST_FAILURE = '@overflow/probe/read/REQUEST/FAILURE';
|
||||
|
||||
export const REQUEST: REQUEST = '@overflow/probe/read/REQUEST';
|
||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/probe/read/REQUEST/SUCCESS';
|
||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/probe/read/REQUEST/FAILURE';
|
|
@ -1,43 +1,7 @@
|
|||
import Action from '@overflow/commons/redux/Action';
|
||||
import Probe from '../../api/model/Probe';
|
||||
import ReadAllByDomainPayload from '../payload/ReadAllByDomainPayload';
|
||||
import Domain from '@overflow/domain/api/model/Domain';
|
||||
|
||||
// Action Type
|
||||
export type REQUEST = '@overflow/probe/read_all_by_domain/REQUEST';
|
||||
export type REQUEST_SUCCESS = '@overflow/probe/read_all_by_domain/REQUEST_SUCCESS';
|
||||
export type REQUEST_FAILURE = '@overflow/probe/read_all_by_domain/REQUEST_FAILURE';
|
||||
export type REQUEST_SUCCESS = '@overflow/probe/read_all_by_domain/REQUEST/SUCCESS';
|
||||
export type REQUEST_FAILURE = '@overflow/probe/read_all_by_domain/REQUEST/FAILURE';
|
||||
|
||||
export const REQUEST: REQUEST = '@overflow/probe/read_all_by_domain/REQUEST';
|
||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/probe/read_all_by_domain/REQUEST_SUCCESS';
|
||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/probe/read_all_by_domain/REQUEST_FAILURE';
|
||||
|
||||
// Action Creater
|
||||
export type request = (domain: Domain) => Action<ReadAllByDomainPayload>;
|
||||
export type requestSuccess = (probes: Probe[]) => Action<Probe[]>;
|
||||
export type requestFailure = (error: Error) => Action;
|
||||
|
||||
|
||||
|
||||
export const request: request = (domain: Domain): Action<ReadAllByDomainPayload> => {
|
||||
return {
|
||||
type: REQUEST,
|
||||
payload: {
|
||||
domain: domain,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const requestSuccess: requestSuccess = (probes: Probe[]): Action<Probe[]> => {
|
||||
return {
|
||||
type: REQUEST_SUCCESS,
|
||||
payload: probes,
|
||||
};
|
||||
};
|
||||
|
||||
export const requestFailure: requestFailure = (error: Error): Action => {
|
||||
return {
|
||||
type: REQUEST_FAILURE,
|
||||
error: error,
|
||||
};
|
||||
};
|
||||
export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/probe/read_all_by_domain/REQUEST/SUCCESS';
|
||||
export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/probe/read_all_by_domain/REQUEST/FAILURE';
|
||||
|
|
6
src/ts/@overflow/probe/redux/payload/ReadPayload.ts
Normal file
6
src/ts/@overflow/probe/redux/payload/ReadPayload.ts
Normal file
|
@ -0,0 +1,6 @@
|
|||
|
||||
interface ReadPayload {
|
||||
id: string;
|
||||
}
|
||||
|
||||
export default ReadPayload;
|
21
src/ts/@overflow/probe/redux/reducer/read.ts
Normal file
21
src/ts/@overflow/probe/redux/reducer/read.ts
Normal file
|
@ -0,0 +1,21 @@
|
|||
import Action from '@overflow/commons/redux/Action';
|
||||
import { ReducersMapObject } from 'redux';
|
||||
import Probe from '@overflow/probe/api/model/Probe';
|
||||
|
||||
import * as ReadActionTypes from '../action/read';
|
||||
import ReadState, { defaultState as readDefaultState } from '../state/Read';
|
||||
|
||||
const reducer: ReducersMapObject = {
|
||||
[ReadActionTypes.REQUEST_SUCCESS]:
|
||||
(state: ReadState = readDefaultState, action: Action<Probe>):
|
||||
ReadState => {
|
||||
return state;
|
||||
},
|
||||
[ReadActionTypes.REQUEST_FAILURE]:
|
||||
(state: ReadState = readDefaultState, action: Action<Error>):
|
||||
ReadState => {
|
||||
return state;
|
||||
},
|
||||
};
|
||||
|
||||
export default reducer;
|
9
src/ts/@overflow/probe/redux/state/Read.ts
Normal file
9
src/ts/@overflow/probe/redux/state/Read.ts
Normal file
|
@ -0,0 +1,9 @@
|
|||
export interface State {
|
||||
readonly error?: Error;
|
||||
}
|
||||
|
||||
export const defaultState: State = {
|
||||
error: undefined,
|
||||
};
|
||||
|
||||
export default State;
|
|
@ -1,8 +1,10 @@
|
|||
export interface State {
|
||||
readonly temp?: any;
|
||||
readonly error?: Error;
|
||||
}
|
||||
|
||||
export const defaultState: State = {
|
||||
temp: null,
|
||||
error: undefined,
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user