xy 7 rokov pred
rodič
commit
fe8a3f1a8c

+ 32 - 26
src/app/common/deploy/tencent/TencentConfig.js

@@ -1,5 +1,5 @@
 import React, {Component} from 'react';
-import {Row, Col, Card, Button, Spin} from 'antd';
+import {Row, Col, Card, Button, Spin, Alert} from 'antd';
 import axios from 'axios';
 import APIGroupCard from './APIGroupCard';
 import APIPathCard from './APIPathCard';
@@ -40,7 +40,7 @@ class TencentConfig extends Component {
     };
 
     pass = (value, kind) => {
-        if(kind === 'deploy')
+        if (kind === 'deploy')
             this.setState({
                 deployIdPassToPath: value
             });
@@ -54,23 +54,23 @@ class TencentConfig extends Component {
         let _this = this;
 
         axios.get(`${deployUrl}`,
-        // axios.get(`http://localhost:8999/graphql/deployall`,
+            // 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"
+                    schema: "ecommerce_schemaID",
+                    deploy: "deploy_1544504304478_57468453",
+                    api: "path_1544504334478_82625598",
+                    group: "group_1544504325443_46750115"
                 }
             })
             .then((res) => {
                 console.log('deploy res', res);
             })
             .catch((err) => {
-                console.log('err',err);
-                console.log('err.response',err.response);
-                console.log('err.response.data',err.response.data);
+                console.log('err', err);
+                console.log('err.response', err.response);
+                console.log('err.response.data', err.response.data);
             });
     };
 
@@ -91,9 +91,9 @@ class TencentConfig extends Component {
                         let group = '',
                             deploy = '',
                             path = '',
-                            cloudID= 'tencent_CloudID';
+                            cloudID = 'tencent_CloudID';
 
-                        if(data.project_by_id.cloud_id !== null && data.project_by_id.cloud_id.cloudName === 'tencent') {
+                        if (data.project_by_id.cloud_id !== null && data.project_by_id.cloud_id.cloudName === 'tencent') {
                             group = data.project_by_id.apiGWGroup_id;
                             deploy = data.project_by_id.deploy_id;
                             cloudID = data.project_by_id.cloud_id.id;
@@ -104,6 +104,16 @@ class TencentConfig extends Component {
                                 <div style={{padding: '30px'}}>
                                     <Row gutter={16}>
                                         <Col span={14}>
+
+                                            {
+                                                data.project_by_id.schema_id.schemaState === 'ok' ?
+                                                    ''
+                                                    :
+                                                    <div style={{marginBottom: 10}}>
+                                                        <Alert message="schema 不符合规范,暂不能部署,请修改 schema " type="warning"
+                                                               banner closable/>
+                                                    </div>
+                                            }
                                             <FormattedMessage id="fc Deploy">
                                                 {
                                                     msg =>
@@ -137,7 +147,8 @@ class TencentConfig extends Component {
                                                         </Card>
                                                 }
                                             </FormattedMessage>
-                                            <Query query={gql(SHOW_APIGWPATH)} variables={{apiGWGroup_id: data.project_by_id.apiGWGroup_id? data.project_by_id.apiGWGroup_id.id : ''}}>
+                                            <Query query={gql(SHOW_APIGWPATH)}
+                                                   variables={{apiGWGroup_id: data.project_by_id.apiGWGroup_id ? data.project_by_id.apiGWGroup_id.id : ''}}>
                                                 {
                                                     ({loading, error, data}) => {
                                                         if (loading) {
@@ -146,7 +157,7 @@ class TencentConfig extends Component {
                                                         if (error) {
                                                             return 'error!';
                                                         }
-                                                        if(data.apiGWPath_by_props.length>0)
+                                                        if (data.apiGWPath_by_props.length > 0)
                                                             path = data.apiGWPath_by_props[0];
                                                         return (
                                                             <FormattedMessage id="API Path">
@@ -158,12 +169,12 @@ class TencentConfig extends Component {
                                                                                 defalutName={defaultName}
                                                                                 userID={this.props.userID}
                                                                                 trialcase={this.props.trialcase}
-                                                                                deployID={deploy? deploy.id : this.state.deployIdPassToPath}
-                                                                                groupID={group? group.id : this.state.groupIdPassToPath}
+                                                                                deployID={deploy ? deploy.id : this.state.deployIdPassToPath}
+                                                                                groupID={group ? group.id : this.state.groupIdPassToPath}
                                                                             />
                                                                         </Card>
                                                                 }
-                                                                </FormattedMessage>
+                                                            </FormattedMessage>
                                                         )
                                                     }
                                                 }
@@ -181,15 +192,10 @@ class TencentConfig extends Component {
                                             </FormattedMessage>
                                         </Col>
                                         <Col offset={2} span={6}>
-                                            <Button type='primary' disabled={data.project_by_id.schema_id.schemaState === 'ok'? '': 'disabled'} onClick={()=>this.deployFC()}><FormattedMessage id="deploy"/>!</Button>
-                                            {
-                                                data.project_by_id.schema_id.schemaState === 'ok'?
-                                                    ''
-                                                    :
-                                                    <div>
-                                                        <span>if button is disabled, check your schema</span>
-                                                    </div>
-                                            }
+                                            <Button type='primary'
+                                                    disabled={data.project_by_id.schema_id.schemaState === 'ok' ? '' : 'disabled'}
+                                                    onClick={() => this.deployFC()}><FormattedMessage
+                                                id="deploy"/>!</Button>
                                         </Col>
                                     </Row>
                                 </div>

+ 0 - 6
src/app/graphqlService/component/graphql/Graphql.jsx

@@ -9,13 +9,7 @@ class Graphql extends Component {
     constructor(props) {
         super(props);
         this.state = {
-            // api: 'http://service-hnqzcew1-1254337200.ap-beijing.apigateway.myqcloud.com/release/graphql',
-            // api: 'http://service-4i9xdoqo-1254337200.ap-guangzhou.apigateway.myqcloud.com/release/graphql',
-            // api: 'http://service-ci2tk8iu-1254337200.ap-guangzhou.apigateway.myqcloud.com/release/graphql',
-            // 便于开发调试,请删除并换成上面
             api: props.api ? props.api : 'http://service-cbcf74bl-1254337200.ap-shanghai.apigateway.myqcloud.com/test/graphql'
-            // api: 'http://service-28dm054z-1254337200.ap-shanghai.apigateway.myqcloud.com/release/graphql'
-            // api: 'http://service-acb8p44v-1254337200.ap-beijing.apigateway.myqcloud.com/release/graphql'
 
         }
     };