diff --git a/src/ts/@overflow/target/react/components/TargetDetail.tsx b/src/ts/@overflow/target/react/components/TargetDetail.tsx index 0f6c65c..21abb20 100644 --- a/src/ts/@overflow/target/react/components/TargetDetail.tsx +++ b/src/ts/@overflow/target/react/components/TargetDetail.tsx @@ -15,6 +15,7 @@ export type Props = StateProps & DispatchProps; export interface State { target: any; // todo. fix to Target + infra: any; } @@ -24,6 +25,7 @@ export class TargetDetail extends React.Component { super(props, context); this.state = { target: null, + infra: null, }; } @@ -35,8 +37,17 @@ export class TargetDetail extends React.Component { 'description': '', 'sensorCount': 'todo.', }; + let infra = { + 'id': '1', + 'createDate': '2017-01-01', + 'childId': '111', + 'type': 'Host', + }; - this.setState({ target: data }); + this.setState({ + target: data, + infra: infra, + }); } public handleRemoveTarget(): void { @@ -46,9 +57,9 @@ export class TargetDetail extends React.Component { public render(): JSX.Element { return ( - +
- +
@@ -59,10 +70,10 @@ export class TargetDetail extends React.Component { export interface TargetBasicInfoProps { target?: any; // todo. fix to Target + infra: any; } export interface TargetBasicInfoState { - infra: any; } export class TargetBasicInfo extends React.Component { @@ -70,22 +81,9 @@ export class TargetBasicInfo extends React.Component @@ -132,7 +130,7 @@ export class TargetBasicInfo extends React.ComponentType - {this.state.infra.type} + {this.props.infra.type} diff --git a/src/ts/@overflow/target/react/components/TargetDetailInfra.tsx b/src/ts/@overflow/target/react/components/TargetDetailInfra.tsx index db71352..00e3d46 100644 --- a/src/ts/@overflow/target/react/components/TargetDetailInfra.tsx +++ b/src/ts/@overflow/target/react/components/TargetDetailInfra.tsx @@ -8,6 +8,7 @@ import Target from '@overflow/target/api/model/Target'; export interface StateProps { target: any; + infra: any; } export interface DispatchProps { @@ -16,7 +17,6 @@ export interface DispatchProps { export type Props = StateProps & DispatchProps; export interface State { - infra: any; // todo. fix to Infra childInfra: any; // todo. fix to InfraTypes } @@ -26,7 +26,6 @@ export class TargetDetailInfra extends React.Component { constructor(props: Props, context: State) { super(props, context); this.state = { - infra: null, childInfra: null, }; } @@ -52,7 +51,6 @@ export class TargetDetailInfra extends React.Component { }; this.setState({ - infra: infra, childInfra: child, }); } @@ -62,7 +60,7 @@ export class TargetDetailInfra extends React.Component { } public renderInfra(): JSX.Element { - let type = this.state.infra.type; + let type = this.props.infra.type; switch (type) { case 'Host': { return ;