diff --git a/src/ts/@overflow/history/api/model/History.ts b/src/ts/@overflow/history/api/model/History.ts index 964f5c0..0370a91 100644 --- a/src/ts/@overflow/history/api/model/History.ts +++ b/src/ts/@overflow/history/api/model/History.ts @@ -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; diff --git a/src/ts/@overflow/history/react/HistoryList.tsx b/src/ts/@overflow/history/react/HistoryList.tsx index b6e2574..0c44b07 100644 --- a/src/ts/@overflow/history/react/HistoryList.tsx +++ b/src/ts/@overflow/history/react/HistoryList.tsx @@ -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, ownProps?: any): HistoryDispatchProps { +export function mapDispatchToProps(dispatch: Dispatch, 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, 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))); + }, }; } diff --git a/src/ts/@overflow/history/react/components/HistoryFilter.tsx b/src/ts/@overflow/history/react/components/HistoryFilter.tsx new file mode 100644 index 0000000..57cd153 --- /dev/null +++ b/src/ts/@overflow/history/react/components/HistoryFilter.tsx @@ -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 { + + constructor(props: any, context: any) { + super(props, context); + this.state = { + }; + + } + + public render(): JSX.Element { + return ( + + + ); + } + + +} diff --git a/src/ts/@overflow/history/react/components/HistoryList.tsx b/src/ts/@overflow/history/react/components/HistoryList.tsx index addb9f3..f21ead6 100644 --- a/src/ts/@overflow/history/react/components/HistoryList.tsx +++ b/src/ts/@overflow/history/react/components/HistoryList.tsx @@ -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 { @@ -32,10 +38,15 @@ export class HistoryList extends React.Component { 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 { } 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 { 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 { } public render(): JSX.Element { + if (this.props.probes !== undefined) { + console.log(this.props.probes); + } let historyList: JSX.Element = ( @@ -132,12 +152,11 @@ export class HistoryList extends React.Component { - +
-
); @@ -147,9 +166,7 @@ export class HistoryList extends React.Component { data={this.props.histories} /> ); - } - }