From 6c89e0bcad886855c64eb00bff376877928c85ee Mon Sep 17 00:00:00 2001 From: insanity Date: Thu, 20 Jul 2017 16:52:34 +0900 Subject: [PATCH] probe --- .../app/views/monitoring/probe/List.tsx | 26 ++++++++++++++++++ src/ts/@overflow/probe/react/ProbeList.tsx | 27 +++++++++++++++++++ .../{ProbeDetails.tsx => ProbeDetail.tsx} | 2 +- .../components/{Probes.tsx => ProbeList.tsx} | 16 +++++++---- .../probe/redux/state/ProbeRegist.ts | 10 +++++++ 5 files changed, 75 insertions(+), 6 deletions(-) create mode 100644 src/ts/@overflow/probe/react/ProbeList.tsx rename src/ts/@overflow/probe/react/components/{ProbeDetails.tsx => ProbeDetail.tsx} (98%) rename src/ts/@overflow/probe/react/components/{Probes.tsx => ProbeList.tsx} (93%) diff --git a/src/ts/@overflow/app/views/monitoring/probe/List.tsx b/src/ts/@overflow/app/views/monitoring/probe/List.tsx index e69de29..345de7a 100644 --- a/src/ts/@overflow/app/views/monitoring/probe/List.tsx +++ b/src/ts/@overflow/app/views/monitoring/probe/List.tsx @@ -0,0 +1,26 @@ +import * as React from 'react'; +import { RouteComponentProps } from 'react-router'; +import ProbeListContainer from '@overflow/probe/react/ProbeList'; +import WebSocketRPC from '@overflow/commons/websocket/WebSocketRPC'; +import AppContext from '@overflow/commons/context'; +import inject from '@overflow/commons/context/decorator/inject'; + +class ProbeList extends React.Component, object> { + @inject() + private client: WebSocketRPC; + + public constructor(props?: RouteComponentProps, context?: object) { + super(props, context); + + let con = AppContext.get(); + } + + public render(): JSX.Element { + return ( + + ); + } +} + + +export default ProbeList; diff --git a/src/ts/@overflow/probe/react/ProbeList.tsx b/src/ts/@overflow/probe/react/ProbeList.tsx new file mode 100644 index 0000000..63412af --- /dev/null +++ b/src/ts/@overflow/probe/react/ProbeList.tsx @@ -0,0 +1,27 @@ +import { connect, Dispatch } from 'react-redux'; +import { + ProbeList, + StateProps as ProbeListStateProps, + DispatchProps as ProbeListDispatchProps, +} from './components/ProbeList'; +import Domain from '@overflow/domain/api/model/Domain'; + +import State from '../redux/state/ProbeRegist'; +import * as probeListActions from '../redux/action/read_all_by_domain'; + + +export function mapStateToProps(state: any): ProbeListStateProps { + return { + + }; +} + +export function mapDispatchToProps(dispatch: Dispatch): ProbeListDispatchProps { + return { + onReadAllByDomain: (domain: Domain) => { + dispatch(probeListActions.request(domain)); + }, + }; +} + +export default connect(mapStateToProps, mapDispatchToProps)(ProbeList); diff --git a/src/ts/@overflow/probe/react/components/ProbeDetails.tsx b/src/ts/@overflow/probe/react/components/ProbeDetail.tsx similarity index 98% rename from src/ts/@overflow/probe/react/components/ProbeDetails.tsx rename to src/ts/@overflow/probe/react/components/ProbeDetail.tsx index cd62ccd..83fd171 100644 --- a/src/ts/@overflow/probe/react/components/ProbeDetails.tsx +++ b/src/ts/@overflow/probe/react/components/ProbeDetail.tsx @@ -16,7 +16,7 @@ export interface Props { export interface State { } -export class ProbeDetails extends React.Component { +export class ProbeDetail extends React.Component { constructor(props: Props, context: State) { super(props, context); diff --git a/src/ts/@overflow/probe/react/components/Probes.tsx b/src/ts/@overflow/probe/react/components/ProbeList.tsx similarity index 93% rename from src/ts/@overflow/probe/react/components/Probes.tsx rename to src/ts/@overflow/probe/react/components/ProbeList.tsx index c8c7584..d58afe7 100644 --- a/src/ts/@overflow/probe/react/components/Probes.tsx +++ b/src/ts/@overflow/probe/react/components/ProbeList.tsx @@ -1,20 +1,26 @@ import * as React from 'react'; import { Table, Header, Container, Form, Checkbox, Button } from 'semantic-ui-react'; -import { ProbeDetails } from './ProbeDetails'; +import { ProbeDetail } from './ProbeDetail'; import { ListContainer } from '@overflow/commons/react/component/ListContainer'; import Probe from '@overflow/probe/api/model/Probe'; +import Domain from '@overflow/domain/api/model/Domain'; -export interface Props { - +export interface StateProps { } +export interface DispatchProps { + onReadAllByDomain(domain: Domain): void; +} + +export type Props = StateProps & DispatchProps; + export interface State { selected: Probe; isDetail: boolean; list: Probe[]; } -export class Probes extends React.Component { +export class ProbeList extends React.Component { private data: any; @@ -121,7 +127,7 @@ export class Probes extends React.Component { public render(): JSX.Element { if (this.state.isDetail) { - return ; + return ; } let probeList = diff --git a/src/ts/@overflow/probe/redux/state/ProbeRegist.ts b/src/ts/@overflow/probe/redux/state/ProbeRegist.ts index e69de29..d957af4 100644 --- a/src/ts/@overflow/probe/redux/state/ProbeRegist.ts +++ b/src/ts/@overflow/probe/redux/state/ProbeRegist.ts @@ -0,0 +1,10 @@ + +export interface State { + readonly test: boolean; +} + +export const defaultState: State = { + test: undefined, +}; + +export default State;