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