|
@@ -1,18 +1,58 @@
|
|
|
import React, {Component} from 'react';
|
|
import React, {Component} from 'react';
|
|
|
-
|
|
|
|
|
-import {Layout, Button} from 'antd';
|
|
|
|
|
-
|
|
|
|
|
|
|
+import {Layout, Button, notification} from 'antd';
|
|
|
|
|
+import {getCookie} from "../../../cookie";
|
|
|
|
|
+import {graphqlUrl} from "../../../config";
|
|
|
|
|
+import {SHOW_CLOUD} from "../../../gql";
|
|
|
|
|
+import {request} from 'graphql-request'
|
|
|
const {Content} = Layout;
|
|
const {Content} = Layout;
|
|
|
|
|
|
|
|
class DeployCloudChoose extends Component{
|
|
class DeployCloudChoose extends Component{
|
|
|
constructor(){
|
|
constructor(){
|
|
|
super();
|
|
super();
|
|
|
this.state={
|
|
this.state={
|
|
|
|
|
+ userID: 'demo',
|
|
|
|
|
+ secretId: '',
|
|
|
|
|
+ secretKey: '',
|
|
|
|
|
+ appId: ''
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ componentWillMount() {
|
|
|
|
|
+ let userID = getCookie('user_id') || this.state.userID;
|
|
|
|
|
+ if (userID !== undefined && userID !== '') {
|
|
|
|
|
+ this.setState({
|
|
|
|
|
+ userID
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
|
|
+ // 查询是否设置 cloud
|
|
|
|
|
+ request(graphqlUrl, SHOW_CLOUD, {user_id: userID}).then(data => {
|
|
|
|
|
+ console.log(data.cloud_by_props);
|
|
|
|
|
+ data.cloud_by_props.forEach(cloud => {
|
|
|
|
|
+ switch (cloud.cloudName) {
|
|
|
|
|
+ case 'tencent':
|
|
|
|
|
+ this.setState({
|
|
|
|
|
+ secretId: cloud.secretId,
|
|
|
|
|
+ secretKey: cloud.secretKey,
|
|
|
|
|
+ appId: cloud.appId
|
|
|
|
|
+ });
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 'aliyun':
|
|
|
|
|
+ // 没写
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 'amazon':
|
|
|
|
|
+ // 没写
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ )
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
render(){
|
|
render(){
|
|
|
|
|
+ let {userID} = this.state;
|
|
|
return(
|
|
return(
|
|
|
<div className={'deploy-choose-cloud'}>
|
|
<div className={'deploy-choose-cloud'}>
|
|
|
<Layout style={{ padding: '24px',minHeight:'300px' }}>
|
|
<Layout style={{ padding: '24px',minHeight:'300px' }}>
|
|
@@ -24,8 +64,23 @@ class DeployCloudChoose extends Component{
|
|
|
<span className={'choose-cloud-title'}>自定义设置</span><span className={'choose-cloud-content'}>部署在自有云服务商,部署成功后返回结果,可登陆云服务商后台查看部署结果</span>
|
|
<span className={'choose-cloud-title'}>自定义设置</span><span className={'choose-cloud-content'}>部署在自有云服务商,部署成功后返回结果,可登陆云服务商后台查看部署结果</span>
|
|
|
</div>
|
|
</div>
|
|
|
<div className={'choose-cloud-button-group'}>
|
|
<div className={'choose-cloud-button-group'}>
|
|
|
- <Button className={'choose-cloud-button'} type='primary'>系统默认部署</Button>
|
|
|
|
|
- <Button className={'choose-cloud-button'} type='primary'>自定义参数设置</Button>
|
|
|
|
|
|
|
+ <Button className={'choose-cloud-button'} type='primary' onClick={()=>{
|
|
|
|
|
+ console.log('默认')
|
|
|
|
|
+ }}>系统默认部署</Button>
|
|
|
|
|
+ <Button className={'choose-cloud-button'} type='primary' onClick={()=>{
|
|
|
|
|
+ if(userID === 'demo') {
|
|
|
|
|
+ notification['warning']({
|
|
|
|
|
+ message: '需要登录',
|
|
|
|
|
+ description: '后续使用,需要先登录',
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ this.props.history.push({
|
|
|
|
|
+ pathname: `/login`
|
|
|
|
|
+ })
|
|
|
|
|
+ } else {
|
|
|
|
|
+ console.log('已经登录')
|
|
|
|
|
+ }
|
|
|
|
|
+ }}>自定义参数设置</Button>
|
|
|
</div>
|
|
</div>
|
|
|
</Content>
|
|
</Content>
|
|
|
</Layout>
|
|
</Layout>
|