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