history
This commit is contained in:
parent
5dd9b8668c
commit
36cd2f96d7
|
@ -1,6 +1,7 @@
|
|||
import MetaHistoryType from '@overflow/meta/api/model/MetaHistoryType';
|
||||
import Probe from '@overflow/probe/api/model/Probe';
|
||||
import Member from '@overflow/member/api/model/Member';
|
||||
import Domain from '@overflow/domain/api/model/Domain';
|
||||
|
||||
interface History {
|
||||
id: number;
|
||||
|
@ -9,6 +10,7 @@ interface History {
|
|||
message: string;
|
||||
probe: Probe;
|
||||
member: Member;
|
||||
domain: Domain;
|
||||
}
|
||||
|
||||
export default History;
|
||||
|
|
|
@ -3,24 +3,31 @@ import {
|
|||
HistoryList,
|
||||
StateProps as HistoryStateProps,
|
||||
DispatchProps as HistoryDispatchProps,
|
||||
Props as SignInProps,
|
||||
Props as HistoryProps,
|
||||
} from './components/HistoryList';
|
||||
import { push as routerPush } from 'react-router-redux';
|
||||
import * as asyncRequestActions from '@overflow/commons/redux/action/asyncRequest';
|
||||
import Domain from '@overflow/domain/api/model/Domain';
|
||||
import Probe from '@overflow/probe/api/model/Probe';
|
||||
import MetaHistoryType from '@overflow/meta/api/model/MetaHistoryType';
|
||||
import * as readAllByProbeActions from '../redux/action/read_all_by_probe';
|
||||
import * as readAllByProbeAndTypeActions from '../redux/action/read_all_by_probe_and_type';
|
||||
import * as probeListActions from '@overflow/probe/redux/action/read_all_by_domain';
|
||||
|
||||
export function mapStateToProps(state: any, ownProps?: any): HistoryStateProps {
|
||||
return {
|
||||
path: ownProps.params,
|
||||
probes: state.probeList,
|
||||
histories: state.historyPage,
|
||||
};
|
||||
}
|
||||
|
||||
export function mapDispatchToProps(dispatch: Dispatch<any>, ownProps?: any): HistoryDispatchProps {
|
||||
export function mapDispatchToProps(dispatch: Dispatch<HistoryDispatchProps>, ownProps?: HistoryDispatchProps): HistoryDispatchProps {
|
||||
return {
|
||||
onReadAllByDomain: (domain: Domain, pageNo: string, countPerPage: string) => {
|
||||
dispatch(asyncRequestActions.request('HistoryService', 'readAllByDomain', readAllByProbeActions.REQUEST,
|
||||
JSON.stringify(domain), pageNo, countPerPage));
|
||||
},
|
||||
onReadAllByProbe: (probe: Probe, pageNo: string, countPerPage: string) => {
|
||||
dispatch(asyncRequestActions.request('HistoryService', 'readAllByProbe', readAllByProbeActions.REQUEST,
|
||||
JSON.stringify(probe), pageNo, countPerPage));
|
||||
|
@ -29,6 +36,9 @@ export function mapDispatchToProps(dispatch: Dispatch<any>, ownProps?: any): His
|
|||
dispatch(asyncRequestActions.request('HistoryService', 'readAllByProbeAndType', readAllByProbeAndTypeActions.REQUEST,
|
||||
JSON.stringify(probe), JSON.stringify(type), pageNo, countPerPage));
|
||||
},
|
||||
onReadAllProbeByDomain: (domain: Domain) => {
|
||||
dispatch(asyncRequestActions.request('ProbeService', 'readAllByDomain', probeListActions.REQUEST, JSON.stringify(domain)));
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
33
src/ts/@overflow/history/react/components/HistoryFilter.tsx
Normal file
33
src/ts/@overflow/history/react/components/HistoryFilter.tsx
Normal file
|
@ -0,0 +1,33 @@
|
|||
import * as React from 'react';
|
||||
import { Table, Button, Header, Container, Menu, Icon } from 'semantic-ui-react';
|
||||
|
||||
|
||||
export interface StateProps {
|
||||
}
|
||||
|
||||
export interface DispatchProps {
|
||||
}
|
||||
|
||||
export type Props = StateProps & DispatchProps;
|
||||
|
||||
export interface State {
|
||||
}
|
||||
|
||||
export class HistoryFilter extends React.Component<Props, State> {
|
||||
|
||||
constructor(props: any, context: any) {
|
||||
super(props, context);
|
||||
this.state = {
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
public render(): JSX.Element {
|
||||
return (
|
||||
<Container>
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -2,6 +2,7 @@ import * as React from '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 Domain from '@overflow/domain/api/model/Domain';
|
||||
import History from '@overflow/history/api/model/History';
|
||||
import Page from '@overflow/commons/api/model/Page';
|
||||
import MetaHistoryType from '@overflow/meta/api/model/MetaHistoryType';
|
||||
|
@ -9,11 +10,15 @@ import { Pager } from '@overflow/commons/react/component/Pager';
|
|||
|
||||
|
||||
export interface StateProps {
|
||||
probes: Probe[];
|
||||
histories: Page;
|
||||
path: any;
|
||||
}
|
||||
|
||||
export interface DispatchProps {
|
||||
onReadAllProbeByDomain?(domain: Domain): void;
|
||||
|
||||
onReadAllByDomain?(domain: Domain, pageNo: string, countPerPage: string): void;
|
||||
onReadAllByProbe?(probe: Probe, pageNo: string, countPerPage: string): void;
|
||||
onReadAllByProbeAndType?(probe: Probe, type: MetaHistoryType, pageNo: string, countPerPage: string): void;
|
||||
}
|
||||
|
@ -22,6 +27,7 @@ export type Props = StateProps & DispatchProps;
|
|||
|
||||
export interface State {
|
||||
isTypedHistory: boolean;
|
||||
selectedProbeId: number;
|
||||
}
|
||||
|
||||
export class HistoryList extends React.Component<Props, State> {
|
||||
|
@ -32,10 +38,15 @@ export class HistoryList extends React.Component<Props, State> {
|
|||
super(props, context);
|
||||
this.state = {
|
||||
isTypedHistory: false,
|
||||
selectedProbeId: 0,
|
||||
};
|
||||
}
|
||||
|
||||
public componentWillMount(): void {
|
||||
let domain: Domain = {
|
||||
id: 1,
|
||||
};
|
||||
this.props.onReadAllProbeByDomain(domain);
|
||||
if (this.props.path === '/histories') {
|
||||
this.setState({
|
||||
isTypedHistory: false,
|
||||
|
@ -50,10 +61,17 @@ export class HistoryList extends React.Component<Props, State> {
|
|||
}
|
||||
|
||||
public getAllHistory(pageNo: number): void {
|
||||
let probe: Probe = {
|
||||
id: Number(1),
|
||||
};
|
||||
this.props.onReadAllByProbe(probe, String(pageNo), String(this.countPerPage));
|
||||
if (this.state.selectedProbeId === 0) {
|
||||
let domain: Domain = {
|
||||
id: Number(1),
|
||||
};
|
||||
this.props.onReadAllByDomain(domain, String(pageNo), String(this.countPerPage));
|
||||
} else {
|
||||
let probe: Probe = {
|
||||
id: Number(this.state.selectedProbeId),
|
||||
};
|
||||
this.props.onReadAllByProbe(probe, String(pageNo), String(this.countPerPage));
|
||||
}
|
||||
}
|
||||
|
||||
public getTypedHistory(pageNo: number): void {
|
||||
|
@ -61,7 +79,6 @@ export class HistoryList extends React.Component<Props, State> {
|
|||
id: Number(1),
|
||||
};
|
||||
let type = this.props.path.split('/')[1];
|
||||
console.log(type + '!!!!!!!!!');
|
||||
this.props.onReadAllByProbeAndType(probe, this.getMetaType(type), String(pageNo), String(this.countPerPage));
|
||||
}
|
||||
|
||||
|
@ -96,6 +113,9 @@ export class HistoryList extends React.Component<Props, State> {
|
|||
}
|
||||
|
||||
public render(): JSX.Element {
|
||||
if (this.props.probes !== undefined) {
|
||||
console.log(this.props.probes);
|
||||
}
|
||||
let historyList: JSX.Element = (
|
||||
<Container fluid>
|
||||
<Table celled selectable striped>
|
||||
|
@ -132,12 +152,11 @@ export class HistoryList extends React.Component<Props, State> {
|
|||
<Table.Footer>
|
||||
<Table.Row>
|
||||
<Table.HeaderCell colSpan='3'>
|
||||
<Pager page={this.props.histories} onPageChange={this.handlePaging} />
|
||||
<Pager page={this.props.histories} onPageChange={this.handlePaging} />
|
||||
</Table.HeaderCell>
|
||||
</Table.Row>
|
||||
</Table.Footer>
|
||||
</Table>
|
||||
|
||||
</Container>
|
||||
);
|
||||
|
||||
|
@ -147,9 +166,7 @@ export class HistoryList extends React.Component<Props, State> {
|
|||
data={this.props.histories}
|
||||
/>
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user