Sfoglia il codice sorgente

Merge branch 'master' of http://gogs.ioobot.com:6680/xy/online

wly 7 anni fa
parent
commit
ca6df2f347

+ 1 - 0
src/app/common/deploy/tencent/DeployCard.js

@@ -167,6 +167,7 @@ class DeployCard extends Component {
                             deploy_id: id,
                             cloud_id: this.props.cloudID
                         }).then(data => {
+                            console.log('write back',data);
                             if(data.update_project !== null)
                                 this.props.stepByStep(1);
                         })

+ 42 - 15
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,16 +69,11 @@ class TencentConfig extends Component {
         console.log('group', group);
         if (schema && deploy && api && group) {
             console.log('deploying');
+            this.setState({
+                deploying: 'deploying'
+            });
             axios.get(`${deployUrl}`,
-                // axios.get(`http://localhost:8999/graphql/deployall`,
                 {
-                    // params: {
-                    //     'cloud-name': 'tencent',
-                    //     schema: "ecommerce_schemaID",
-                    //     deploy: "deploy_1544504304478_57468453",
-                    //     api: "path_1544504334478_82625598",
-                    //     group: "group_1544504325443_46750115"
-                    // }
                     params: {
                         'cloud-id': 'tencent_CloudID',
                         'cloud-name': 'tencent',
@@ -88,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);
@@ -186,6 +189,7 @@ class TencentConfig extends Component {
                                                                     cloudID={cloudID}
                                                                     trialcase={this.props.trialcase}
                                                                     pass={this.pass}
+                                                                    projectID={projectID}
                                                                 />
                                                             </Card>
                                                     }
@@ -202,6 +206,7 @@ class TencentConfig extends Component {
                                                                     cloudID={cloudID}
                                                                     trialcase={this.props.trialcase}
                                                                     pass={this.pass}
+                                                                    projectID={projectID}
                                                                 />
                                                             </Card>
                                                     }
@@ -248,6 +253,7 @@ class TencentConfig extends Component {
                                                                     userID={this.props.userID}
                                                                     defalutName={defaultName}
                                                                     trialcase={this.props.trialcase}
+                                                                    projectID={projectID}
                                                                 />
                                                             </Card>
                                                     }
@@ -323,6 +329,7 @@ class TencentConfig extends Component {
                                                                             trialcase={this.props.trialcase}
                                                                             pass={this.pass}
                                                                             stepByStep={this.stepByStep}
+                                                                            projectID={projectID}
                                                                         />
                                                                     </Card>
                                                             }
@@ -346,6 +353,7 @@ class TencentConfig extends Component {
                                                                             trialcase={this.props.trialcase}
                                                                             pass={this.pass}
                                                                             stepByStep={this.stepByStep}
+                                                                            projectID={projectID}
                                                                         />
                                                                     </Card>
                                                             }
@@ -405,6 +413,7 @@ class TencentConfig extends Component {
                                                                             defalutName={defaultName}
                                                                             trialcase={this.props.trialcase}
                                                                             stepByStep={this.stepByStep}
+                                                                            projectID={projectID}
                                                                         />
                                                                     </Card>
                                                             }
@@ -422,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';