|
@@ -1,155 +1,60 @@
|
|
|
import React, {Component} from 'react';
|
|
import React, {Component} from 'react';
|
|
|
-import {Row, Col, Input, Spin, Button} from 'antd';
|
|
|
|
|
|
|
+import {Card} from 'antd';
|
|
|
|
|
+
|
|
|
|
|
+import TencentConfig from './tencent/TencentConfig';
|
|
|
|
|
+import AliConfig from './ali/AliConfig';
|
|
|
|
|
+import AmazonConfig from './amazon/AmazonConfig';
|
|
|
|
|
+import HuaweiConfig from './huawei/HuaweiConfig';
|
|
|
|
|
|
|
|
-import {Mutation, Query} from "react-apollo";
|
|
|
|
|
-import {SHOW_CLOUD, SHOW_DEPLOY, SHOW_APIGWGROUP} from "../../gql";
|
|
|
|
|
-import gql from "graphql-tag";
|
|
|
|
|
import './index.css';
|
|
import './index.css';
|
|
|
-import TencentDeploy from './tencent/TencentDeploy';
|
|
|
|
|
-import TencentAPIGroup from './tencent/TencentAPIGroup';
|
|
|
|
|
|
|
|
|
|
-const Search = Input.Search;
|
|
|
|
|
|
|
+const tabListNoTitle = [{
|
|
|
|
|
+ key: 'tencent',
|
|
|
|
|
+ tab: 'Tencent',
|
|
|
|
|
+}, {
|
|
|
|
|
+ key: 'aliyun',
|
|
|
|
|
+ tab: 'Aliyun',
|
|
|
|
|
+}, {
|
|
|
|
|
+ key: 'amazon',
|
|
|
|
|
+ tab: 'AWS',
|
|
|
|
|
+}];
|
|
|
|
|
+
|
|
|
|
|
+const contentListNoTitle = {
|
|
|
|
|
+ tencent: <TencentConfig/>,
|
|
|
|
|
+ aliyun: <AliConfig/>,
|
|
|
|
|
+ amazon: <AmazonConfig/>,
|
|
|
|
|
+};
|
|
|
|
|
|
|
|
|
|
|
|
|
class Deploy extends Component {
|
|
class Deploy extends Component {
|
|
|
constructor(props) {
|
|
constructor(props) {
|
|
|
super(props);
|
|
super(props);
|
|
|
this.state = {
|
|
this.state = {
|
|
|
- show: 'all',
|
|
|
|
|
- deploy: '',
|
|
|
|
|
- apiGroup: ''
|
|
|
|
|
|
|
+ cloud: 'tencent',
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
- 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({
|
|
|
|
|
- show: 'all'
|
|
|
|
|
- })
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
render() {
|
|
render() {
|
|
|
let userID = this.props.userID;
|
|
let userID = this.props.userID;
|
|
|
return (
|
|
return (
|
|
|
<div>
|
|
<div>
|
|
|
- {
|
|
|
|
|
- this.state.show === 'all' ?
|
|
|
|
|
- <Query query={gql(SHOW_CLOUD)} variables={{user_id: userID}}>
|
|
|
|
|
- {
|
|
|
|
|
- ({loading, error, data}) => {
|
|
|
|
|
- if (loading) {
|
|
|
|
|
- return <Spin style={{marginLeft: 3}}/>
|
|
|
|
|
- }
|
|
|
|
|
- if (error) {
|
|
|
|
|
- return 'error!';
|
|
|
|
|
- }
|
|
|
|
|
- return (
|
|
|
|
|
- data.cloud_by_props.map(cloud => (
|
|
|
|
|
- <div key={cloud.id} style={{marginBottom: 30}}>
|
|
|
|
|
- <span className='cloud-name'>{cloud.cloudName}: {cloud.id}.</span>
|
|
|
|
|
- <div style={{marginBottom: 15}}>
|
|
|
|
|
- <div>
|
|
|
|
|
- ID: <Input style={{width: 250}} value={cloud.secretId}/>
|
|
|
|
|
- Key: <Input style={{width: 250}}
|
|
|
|
|
- value={cloud.secretKey}/>
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
-
|
|
|
|
|
- <Row>
|
|
|
|
|
- <Col span={12}>
|
|
|
|
|
- <b>DEPLOY</b>
|
|
|
|
|
- <Query query={gql(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>
|
|
|
|
|
- ))
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- </Query>
|
|
|
|
|
- </Col>
|
|
|
|
|
- <Col span={12}>
|
|
|
|
|
- <b>API</b>
|
|
|
|
|
- <Query query={gql(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>
|
|
|
|
|
- ))
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- </Query>
|
|
|
|
|
- </Col>
|
|
|
|
|
- </Row>
|
|
|
|
|
- </div>
|
|
|
|
|
- ))
|
|
|
|
|
- );
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- </Query>
|
|
|
|
|
- :
|
|
|
|
|
- this.state.show === 'deploy' ?
|
|
|
|
|
- <TencentDeploy reDisplayChoose={this.reDisplayChoose} deploy={this.state.deploy}/>
|
|
|
|
|
- :
|
|
|
|
|
- <TencentAPIGroup reDisplayChoose={this.reDisplayChoose} apiGroup={this.state.apiGroup}/>
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <Card
|
|
|
|
|
+ style={{width: '100%'}}
|
|
|
|
|
+ tabList={tabListNoTitle}
|
|
|
|
|
+ activeTabKey={this.state.cloud}
|
|
|
|
|
+ onTabChange={(cloud) => {
|
|
|
|
|
+ this.setState({
|
|
|
|
|
+ cloud
|
|
|
|
|
+ })
|
|
|
|
|
+ }}
|
|
|
|
|
+ >
|
|
|
|
|
+ {contentListNoTitle[this.state.cloud]}
|
|
|
|
|
+ </Card>
|
|
|
|
|
+ </div>
|
|
|
</div>
|
|
</div>
|
|
|
-
|
|
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export default Deploy;
|
|
export default Deploy;
|