histories
This commit is contained in:
parent
653dcf6354
commit
5c5cf2fa13
|
@ -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,
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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<any>, 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('/'));
|
||||
// },
|
||||
|
|
|
@ -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<Props, State> {
|
||||
|
||||
|
@ -25,12 +25,14 @@ export class HistoryList extends React.Component<Props, State> {
|
|||
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<Props, State> {
|
|||
<Table.Header>
|
||||
<Table.Row>
|
||||
<Table.HeaderCell textAlign={'center'}>No.</Table.HeaderCell>
|
||||
<Table.HeaderCell textAlign={'center'}>Status</Table.HeaderCell>
|
||||
<Table.HeaderCell textAlign={'center'}>Type</Table.HeaderCell>
|
||||
<Table.HeaderCell textAlign={'center'}>Message</Table.HeaderCell>
|
||||
<Table.HeaderCell textAlign={'center'}>CreateDate</Table.HeaderCell>
|
||||
<Table.HeaderCell textAlign={'center'}>Created At</Table.HeaderCell>
|
||||
<Table.HeaderCell textAlign={'center'}>Created By</Table.HeaderCell>
|
||||
</Table.Row>
|
||||
</Table.Header>
|
||||
|
||||
<Table.Body>
|
||||
{this.state.sampleList ? this.state.sampleList.map((history: History, index: number) => (
|
||||
{this.props.histories ? this.props.histories.map((history: History, index: number) => (
|
||||
<Table.Row key={index} >
|
||||
<Table.Cell textAlign={'center'}>{index + 1}</Table.Cell>
|
||||
<Table.Cell textAlign={'center'}>
|
||||
SP - PROCESS
|
||||
{history.type.name}
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
{history.message}
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
{history.createDate}
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
{history.member.name}
|
||||
</Table.Cell>
|
||||
<Table.Cell><Header size='small'>SP - Target</Header></Table.Cell>
|
||||
<Table.Cell>Create Target</Table.Cell>
|
||||
<Table.Cell collapsing>{history.createDate}</Table.Cell>
|
||||
</Table.Row>
|
||||
)) : ''}
|
||||
</Table.Body>
|
||||
<Table.Footer>1 2 3 ...</Table.Footer>
|
||||
<Table.Footer>
|
||||
<Table.Row>
|
||||
<Table.HeaderCell colSpan='3'>
|
||||
<Menu floated='right' pagination>
|
||||
<Menu.Item as='a' icon>
|
||||
<Icon name='left chevron' />
|
||||
</Menu.Item>
|
||||
<Menu.Item as='a'>1</Menu.Item>
|
||||
<Menu.Item as='a'>2</Menu.Item>
|
||||
<Menu.Item as='a'>3</Menu.Item>
|
||||
<Menu.Item as='a'>4</Menu.Item>
|
||||
<Menu.Item as='a' icon>
|
||||
<Icon name='right chevron' />
|
||||
</Menu.Item>
|
||||
</Menu>
|
||||
</Table.HeaderCell>
|
||||
</Table.Row>
|
||||
</Table.Footer>
|
||||
</Table>
|
||||
|
||||
</Container>
|
||||
|
@ -70,7 +95,7 @@ export class HistoryList extends React.Component<Props, State> {
|
|||
return (
|
||||
<ListContainer
|
||||
contents={historyList}
|
||||
data={this.state.sampleList}
|
||||
data={this.props.histories}
|
||||
/>
|
||||
);
|
||||
|
||||
|
@ -79,37 +104,3 @@ export class HistoryList extends React.Component<Props, State> {
|
|||
}
|
||||
|
||||
|
||||
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',
|
||||
},
|
||||
];
|
||||
|
|
|
@ -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';
|
25
src/ts/@overflow/history/redux/reducer/read_all_by_probe.ts
Normal file
25
src/ts/@overflow/history/redux/reducer/read_all_by_probe.ts
Normal file
|
@ -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<History[]>):
|
||||
ReadAllByProbeState => {
|
||||
return {
|
||||
...state,
|
||||
historyList: <History[]>action.payload,
|
||||
};
|
||||
},
|
||||
[ReadAllByProbeActionTypes.REQUEST_FAILURE]:
|
||||
(state: ReadAllByProbeState = ReadAllByProbeDefaultState, action: Action<Error>):
|
||||
ReadAllByProbeState => {
|
||||
return state;
|
||||
},
|
||||
};
|
||||
|
||||
export default reducer;
|
13
src/ts/@overflow/history/redux/state/ReadAllByProbe.ts
Normal file
13
src/ts/@overflow/history/redux/state/ReadAllByProbe.ts
Normal file
|
@ -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;
|
17
src/ts/@overflow/meta/api/model/MetaHistoryType.ts
Normal file
17
src/ts/@overflow/meta/api/model/MetaHistoryType.ts
Normal file
|
@ -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;
|
Loading…
Reference in New Issue
Block a user