xy 7 سال پیش
والد
کامیت
2f767e4695
2فایلهای تغییر یافته به همراه38 افزوده شده و 9 حذف شده
  1. 36 7
      src/app/common/deploy/tencent/TencentConfig.js
  2. 2 2
      src/config.js

+ 36 - 7
src/app/common/deploy/tencent/TencentConfig.js

@@ -1,5 +1,5 @@
 import React, {Component} from 'react';
-import {Row, Col, Card, Button, Spin, Alert, Steps} from 'antd';
+import {Row, Col, Card, Button, Spin, Alert, Steps, Progress} from 'antd';
 import axios from 'axios';
 import APIGroupCard from './APIGroupCard';
 import APIPathCard from './APIPathCard';
@@ -23,7 +23,8 @@ class TencentConfig extends Component {
             deployIdPassToPath: '',
             groupIdPassToPath: '',
             pathIdPassToConfig: '',
-            currentStep: 0
+            currentStep: 0,
+            deploying: ''
         };
     }
 
@@ -33,7 +34,8 @@ class TencentConfig extends Component {
             region: '',
             deployIdPassToPath: '',
             groupIdPassToPath: '',
-            currentStep: 0
+            currentStep: 0,
+            deploying: ''
         });
     }
 
@@ -67,6 +69,9 @@ class TencentConfig extends Component {
         console.log('group', group);
         if (schema && deploy && api && group) {
             console.log('deploying');
+            this.setState({
+                deploying: 'deploying'
+            });
             axios.get(`${deployUrl}`,
                 {
                     params: {
@@ -80,8 +85,14 @@ class TencentConfig extends Component {
                 })
                 .then((res) => {
                     console.log('deploy res', res);
+                    this.setState({
+                        deploying: 'finished'
+                    })
                 })
                 .catch((err) => {
+                    this.setState({
+                        deploying: 'error'
+                    });
                     console.log('err', err);
                     console.log('err.response', err.response);
                     console.log('err.response.data', err.response.data);
@@ -420,19 +431,37 @@ class TencentConfig extends Component {
                                                             this.props.trialcase ?
                                                                 ''
                                                                 :
+
                                                                 projectType === 'graphql' ?
+
                                                                     schema_id.schemaState === 'ok' ?
-                                                                        <Button type='primary'
-                                                                                onClick={() => this.deployFC(schemaID, deploy ? deploy.id : this.state.deployIdPassToPath, this.state.pathIdPassToConfig, group ? group.id : this.state.groupIdPassToPath)}><FormattedMessage
-                                                                            id="deploy"/>!</Button>
+
+                                                                            this.state.deploying === '' ?
+                                                                                <Button type='primary' onClick={() => this.deployFC(schemaID, deploy ? deploy.id : this.state.deployIdPassToPath, this.state.pathIdPassToConfig, group ? group.id : this.state.groupIdPassToPath)}><FormattedMessage id="deploy"/>!</Button>
+                                                                                :
+                                                                                ''
                                                                         :
                                                                         <Button type='primary'
-                                                                                disabled><FormattedMessage id="deploy"/>!</Button>
+                                                                                disabled><FormattedMessage
+                                                                            id="deploy"/>!</Button>
                                                                     :
                                                                     <Button type='primary' onClick={() => {
                                                                     }}><FormattedMessage id="deploy"/>!</Button>
 
                                                         }
+                                                        {
+                                                            this.state.deploying === 'deploying' ?
+                                                                <Spin size="large"/>
+                                                                :
+                                                                this.state.deploying === 'finished' ?
+                                                                    <Progress type="circle" percent={100} />
+                                                                    :
+                                                                    this.state.deploying === 'error' ?
+                                                                        <Progress type="circle" percent={99} status="exception" />
+                                                                        :
+                                                                        ''
+
+                                                        }
                                                     </Col>
                                                     :
                                                     ''

+ 2 - 2
src/config.js

@@ -1,9 +1,9 @@
 // 全局配置
-const environment = 'development';
+const environment = 'production';
 
 // 全局差异化配置,无需配置请留空
 const faasEnvironment = '';
-const graphqlEnvironment = 'production';
+const graphqlEnvironment = '';
 
 // 基础配置
 const localIP = 'http://localhost';