|
|
@@ -2,9 +2,10 @@ import React, {Component} from 'react';
|
|
|
import {Row, Col, Input, Spin, Button} from 'antd';
|
|
|
|
|
|
import {Mutation, Query} from "react-apollo";
|
|
|
-import {SHOW_CLOUD, SHOW_DEPLOY} from "../../gql";
|
|
|
+import {SHOW_CLOUD, SHOW_DEPLOY, SHOW_APIGWGROUP} from "../../gql";
|
|
|
import './index.css';
|
|
|
-import TencentConfig from './tencent/TencentConfig';
|
|
|
+import TencentDeploy from './tencent/TencentDeploy';
|
|
|
+import TencentAPIGroup from './tencent/TencentAPIGroup';
|
|
|
|
|
|
const Search = Input.Search;
|
|
|
|
|
|
@@ -13,7 +14,9 @@ class Deploy extends Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
this.state = {
|
|
|
- deploy: ''
|
|
|
+ show: 'all',
|
|
|
+ deploy: '',
|
|
|
+ apiGroup: ''
|
|
|
};
|
|
|
}
|
|
|
|
|
|
@@ -21,14 +24,24 @@ class Deploy extends Component {
|
|
|
findDeploy = (id, data) => {
|
|
|
return () => {
|
|
|
this.setState({
|
|
|
+ show: 'deploy',
|
|
|
deploy: data.deploy_by_props.find(deploy => deploy.id === id)
|
|
|
})
|
|
|
};
|
|
|
};
|
|
|
|
|
|
+ findApiGroup = (id, data) => {
|
|
|
+ return () => {
|
|
|
+ this.setState({
|
|
|
+ show: 'api',
|
|
|
+ apiGroup: data.apiGWGroup_by_props.find(group => group.id === id)
|
|
|
+ })
|
|
|
+ };
|
|
|
+ };
|
|
|
+
|
|
|
reDisplayChoose = () => {
|
|
|
this.setState({
|
|
|
- deploy: ''
|
|
|
+ show: 'all'
|
|
|
})
|
|
|
};
|
|
|
|
|
|
@@ -39,9 +52,8 @@ class Deploy extends Component {
|
|
|
<div>
|
|
|
|
|
|
{
|
|
|
- this.state.deploy === '' ?
|
|
|
+ this.state.show === 'all' ?
|
|
|
<Query query={SHOW_CLOUD} variables={{user_id: userID}}>
|
|
|
-
|
|
|
{
|
|
|
({loading, error, data}) => {
|
|
|
if (loading) {
|
|
|
@@ -53,37 +65,73 @@ class Deploy extends Component {
|
|
|
return (
|
|
|
data.cloud_by_props.map(cloud => (
|
|
|
<div key={cloud.id} style={{marginBottom: 30}}>
|
|
|
- <b>{cloud.cloudName}: {cloud.id}.</b>
|
|
|
- <div>
|
|
|
+ <span className='cloud-name'>{cloud.cloudName}: {cloud.id}.</span>
|
|
|
+ <div style={{marginBottom: 15}}>
|
|
|
<div>
|
|
|
- <b>ID: </b><Input style={{width: 250}} value={cloud.secretId}/>
|
|
|
- <b>Key: </b><Input style={{width: 250}}
|
|
|
- value={cloud.secretKey}/>
|
|
|
+ ID: <Input style={{width: 250}} value={cloud.secretId}/>
|
|
|
+ Key: <Input style={{width: 250}}
|
|
|
+ value={cloud.secretKey}/>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <Query query={SHOW_DEPLOY} variables={{cloud_id: cloud.id}}>
|
|
|
- {
|
|
|
- ({loading, error, data}) => {
|
|
|
- if (loading) {
|
|
|
- return <Spin style={{marginLeft: 3}}/>
|
|
|
+
|
|
|
+ <Row>
|
|
|
+ <Col span={12}>
|
|
|
+ <b>DEPLOY</b>
|
|
|
+ <Query query={SHOW_DEPLOY} variables={{cloud_id: cloud.id}}>
|
|
|
+ {
|
|
|
+ ({loading, error, data}) => {
|
|
|
+ if (loading) {
|
|
|
+ return <Spin style={{marginLeft: 3}}/>
|
|
|
+ }
|
|
|
+ if (error) {
|
|
|
+ return 'error!';
|
|
|
+ }
|
|
|
+ return (
|
|
|
+ data.deploy_by_props.map(deploy => (
|
|
|
+ <div key={deploy.id}>
|
|
|
+ <div>
|
|
|
+ {deploy.id} - {deploy.functionName}
|
|
|
+ <Button size="small"
|
|
|
+ onClick={this.findDeploy(deploy.id, data)}
|
|
|
+ type='primary'>Show
|
|
|
+ me</Button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ ))
|
|
|
+ )
|
|
|
+ }
|
|
|
}
|
|
|
- if (error) {
|
|
|
- return 'error!';
|
|
|
+ </Query>
|
|
|
+ </Col>
|
|
|
+ <Col span={12}>
|
|
|
+ <b>API</b>
|
|
|
+ <Query query={SHOW_APIGWGROUP} variables={{cloud_id: cloud.id}}>
|
|
|
+ {
|
|
|
+ ({loading, error, data}) => {
|
|
|
+ if (loading) {
|
|
|
+ return <Spin style={{marginLeft: 3}}/>
|
|
|
+ }
|
|
|
+ if (error) {
|
|
|
+ return 'error!';
|
|
|
+ }
|
|
|
+ return (
|
|
|
+ data.apiGWGroup_by_props.map(apiGroup => (
|
|
|
+ <div key={apiGroup.id}>
|
|
|
+ <div>
|
|
|
+ {apiGroup.id} - {apiGroup.groupName}
|
|
|
+ <Button size="small"
|
|
|
+ onClick={this.findApiGroup(apiGroup.id, data)}
|
|
|
+ type='primary'>Show
|
|
|
+ me</Button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ ))
|
|
|
+ )
|
|
|
+ }
|
|
|
}
|
|
|
- return (
|
|
|
- data.deploy_by_props.map(deploy => (
|
|
|
- <div key={deploy.id}>
|
|
|
- <div>
|
|
|
- {deploy.id} - {deploy.functionName}
|
|
|
- <Button size="small" onClick={this.findDeploy(deploy.id, data)} type='primary'>Show me</Button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- ))
|
|
|
- )
|
|
|
- }
|
|
|
- }
|
|
|
- </Query>
|
|
|
-
|
|
|
+ </Query>
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
</div>
|
|
|
))
|
|
|
);
|
|
|
@@ -92,7 +140,10 @@ class Deploy extends Component {
|
|
|
|
|
|
</Query>
|
|
|
:
|
|
|
- <TencentConfig reDisplayChoose={this.reDisplayChoose} deploy={this.state.deploy}/>
|
|
|
+ this.state.show === 'deploy' ?
|
|
|
+ <TencentDeploy reDisplayChoose={this.reDisplayChoose} deploy={this.state.deploy}/>
|
|
|
+ :
|
|
|
+ <TencentAPIGroup reDisplayChoose={this.reDisplayChoose} apiGroup={this.state.apiGroup}/>
|
|
|
}
|
|
|
</div>
|
|
|
|