diff --git a/src/ts/@overflow/app/config/index.ts b/src/ts/@overflow/app/config/index.ts index 2344217..4aea2a2 100644 --- a/src/ts/@overflow/app/config/index.ts +++ b/src/ts/@overflow/app/config/index.ts @@ -37,6 +37,8 @@ import MetaSensorItemTypeReadAllReducer from '@overflow/meta/redux/reducer/senso import DiscoveryInfraTargetRegistAllReducer from '@overflow/discovery/redux/reducer/infra_target_regist_all'; +import HistoryReadAllByProbeReducer from '@overflow/history/redux/reducer/read_all_by_probe'; + import AsyncRequest from '@overflow/app/redux/saga/AsyncRequest'; // Container Configuration @@ -52,7 +54,7 @@ export interface RPCConfig { url: string; } const rpcConfig: RPCConfig = { - url: 'ws://192.168.1.103:18081/rpc', + url: 'ws://127.0.0.1:18081/rpc', }; // Redux Configuration @@ -98,6 +100,7 @@ const reduxConfig: ReduxConfig = { noauthDenyReducer, modifyProbeReducer, DiscoveryInfraTargetRegistAllReducer, + HistoryReadAllByProbeReducer, ], sagaWatchers: [ AsyncRequest, diff --git a/src/ts/@overflow/history/api/model/History.ts b/src/ts/@overflow/history/api/model/History.ts index 42f80c1..964f5c0 100644 --- a/src/ts/@overflow/history/api/model/History.ts +++ b/src/ts/@overflow/history/api/model/History.ts @@ -1,8 +1,14 @@ +import MetaHistoryType from '@overflow/meta/api/model/MetaHistoryType'; +import Probe from '@overflow/probe/api/model/Probe'; +import Member from '@overflow/member/api/model/Member'; interface History { - id?: number; - createDate?: Date; + id: number; + createDate: Date; + type: MetaHistoryType; + message: string; + probe: Probe; + member: Member; } - export default History; diff --git a/src/ts/@overflow/history/react/HistoryList.tsx b/src/ts/@overflow/history/react/HistoryList.tsx index f57f2ff..7ce0599 100644 --- a/src/ts/@overflow/history/react/HistoryList.tsx +++ b/src/ts/@overflow/history/react/HistoryList.tsx @@ -5,23 +5,23 @@ import { DispatchProps as HistoryDispatchProps, Props as SignInProps, } from './components/HistoryList'; -// import SignInState from '../redux/state/SignIn'; - -// import * as signinActions from '../redux/action/signIn'; import { push as routerPush } from 'react-router-redux'; import * as asyncRequestActions from '@overflow/commons/redux/action/asyncRequest'; +import Probe from '@overflow/probe/api/model/Probe'; +import * as readAllByProbeActions from '../redux/action/read_all_by_probe'; export function mapStateToProps(state: any, ownProps?: any): HistoryStateProps { return { - + probeId: '1', + histories: state.historyList, }; } export function mapDispatchToProps(dispatch: Dispatch, ownProps?: any): HistoryDispatchProps { return { - // onSignIn: (signinId: string, signinPw: string) => { - // dispatch(asyncRequestActions.request('MemberService', 'signin', signinActions.REQUEST, signinId, signinPw)); - // }, + onReadAllByProbe: (probe: Probe) => { + dispatch(asyncRequestActions.request('HistoryService', 'readAllByProbe', readAllByProbeActions.REQUEST, JSON.stringify(probe))); + }, // onRedirectHome: () => { // dispatch(routerPush('/')); // }, diff --git a/src/ts/@overflow/history/react/components/HistoryList.tsx b/src/ts/@overflow/history/react/components/HistoryList.tsx index 4541942..b1f2591 100644 --- a/src/ts/@overflow/history/react/components/HistoryList.tsx +++ b/src/ts/@overflow/history/react/components/HistoryList.tsx @@ -1,23 +1,23 @@ import * as React from 'react'; -import { Table, Button, Header, Container } from 'semantic-ui-react'; +import { Table, Button, Header, Container, Menu, Icon } from 'semantic-ui-react'; import { ListContainer } from '@overflow/commons/react/component/ListContainer'; - +import Probe from '@overflow/probe/api/model/Probe'; import History from '@overflow/history/api/model/History'; export interface StateProps { - + probeId: string; + histories: History[]; } export interface DispatchProps { - + onReadAllByProbe?(probe: Probe): void; } export type Props = StateProps & DispatchProps; export interface State { - sampleList: History[]; -} +} export class HistoryList extends React.Component { @@ -25,12 +25,14 @@ export class HistoryList extends React.Component { constructor(props: Props, context: State) { super(props, context); this.state = { - sampleList: sampleHistory, }; } public componentWillMount(): void { - console.log('HistoryList'); + let probe: Probe = { + id: Number(1), + }; + this.props.onReadAllByProbe(probe); } public render(): JSX.Element { @@ -41,27 +43,50 @@ export class HistoryList extends React.Component { No. - Status Type Message - CreateDate + Created At + Created By - {this.state.sampleList ? this.state.sampleList.map((history: History, index: number) => ( + {this.props.histories ? this.props.histories.map((history: History, index: number) => ( {index + 1} - SP - PROCESS + {history.type.name} + + + {history.message} + + + {history.createDate} + + + {history.member.name} -
SP - Target
- Create Target - {history.createDate}
)) : ''}
- 1 2 3 ... + + + + + + + + 1 + 2 + 3 + 4 + + + + + + + @@ -70,7 +95,7 @@ export class HistoryList extends React.Component { return ( ); @@ -79,37 +104,3 @@ export class HistoryList extends React.Component { } -const sampleHistory: any = [ - { - 'id':'1', - 'createDate':'1503287950244', - }, - { - 'id':'2', - 'createDate':'1503287950344', - }, - { - 'id':'3', - 'createDate':'1503287950444', - }, - { - 'id':'4', - 'createDate':'1503287950544', - }, - { - 'id':'5', - 'createDate':'1503287950644', - }, - { - 'id':'6', - 'createDate':'1503287950744', - }, - { - 'id':'7', - 'createDate':'1503287950844', - }, - { - 'id':'8', - 'createDate':'1503287950944', - }, -]; diff --git a/src/ts/@overflow/history/redux/action/_ b/src/ts/@overflow/history/redux/action/_ deleted file mode 100644 index e69de29..0000000 diff --git a/src/ts/@overflow/history/redux/action/read_all_by_probe.ts b/src/ts/@overflow/history/redux/action/read_all_by_probe.ts new file mode 100644 index 0000000..7335750 --- /dev/null +++ b/src/ts/@overflow/history/redux/action/read_all_by_probe.ts @@ -0,0 +1,7 @@ +export type REQUEST = '@overflow/history/read_all_by_probe/REQUEST'; +export type REQUEST_SUCCESS = '@overflow/history/read_all_by_probe/REQUEST/SUCCESS'; +export type REQUEST_FAILURE = '@overflow/history/read_all_by_probe/REQUEST/FAILURE'; + +export const REQUEST: REQUEST = '@overflow/history/read_all_by_probe/REQUEST'; +export const REQUEST_SUCCESS: REQUEST_SUCCESS = '@overflow/history/read_all_by_probe/REQUEST/SUCCESS'; +export const REQUEST_FAILURE: REQUEST_FAILURE = '@overflow/history/read_all_by_probe/REQUEST/FAILURE'; diff --git a/src/ts/@overflow/history/redux/reducer/_ b/src/ts/@overflow/history/redux/reducer/_ deleted file mode 100644 index e69de29..0000000 diff --git a/src/ts/@overflow/history/redux/reducer/read_all_by_probe.ts b/src/ts/@overflow/history/redux/reducer/read_all_by_probe.ts new file mode 100644 index 0000000..1c3a214 --- /dev/null +++ b/src/ts/@overflow/history/redux/reducer/read_all_by_probe.ts @@ -0,0 +1,25 @@ +import Action from '@overflow/commons/redux/Action'; +import { ReducersMapObject } from 'redux'; +import Probe from '@overflow/probe/api/model/Probe'; +import History from '../../api/model/History'; + +import * as ReadAllByProbeActionTypes from '../action/read_all_by_probe'; +import ReadAllByProbeState, { defaultState as ReadAllByProbeDefaultState } from '../state/ReadAllByProbe'; + +const reducer: ReducersMapObject = { + [ReadAllByProbeActionTypes.REQUEST_SUCCESS]: + (state: ReadAllByProbeState = ReadAllByProbeDefaultState, action: Action): + ReadAllByProbeState => { + return { + ...state, + historyList: action.payload, + }; + }, + [ReadAllByProbeActionTypes.REQUEST_FAILURE]: + (state: ReadAllByProbeState = ReadAllByProbeDefaultState, action: Action): + ReadAllByProbeState => { + return state; + }, +}; + +export default reducer; diff --git a/src/ts/@overflow/history/redux/state/ReadAllByProbe.ts b/src/ts/@overflow/history/redux/state/ReadAllByProbe.ts new file mode 100644 index 0000000..da909bb --- /dev/null +++ b/src/ts/@overflow/history/redux/state/ReadAllByProbe.ts @@ -0,0 +1,13 @@ +import History from '../../api/model/History'; + +export interface State { + readonly historyList?: History[]; + readonly error?: Error; +} + +export const defaultState: State = { + historyList: undefined, + error: undefined, +}; + +export default State; diff --git a/src/ts/@overflow/history/redux/state/_ b/src/ts/@overflow/history/redux/state/_ deleted file mode 100644 index e69de29..0000000 diff --git a/src/ts/@overflow/meta/api/model/MetaHistoryType.ts b/src/ts/@overflow/meta/api/model/MetaHistoryType.ts new file mode 100644 index 0000000..a950f9b --- /dev/null +++ b/src/ts/@overflow/meta/api/model/MetaHistoryType.ts @@ -0,0 +1,17 @@ +export interface MetaHistoryType { + id: number; + name: string; + createDate: Date; +} + +export enum MetaHistoryType_ID { + Member = 1, + Probe = 2, + Discovery = 3, + Target = 4, + Crawler = 5, + Sensor = 6, +} + + +export default MetaHistoryType;