Bladeren bron

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

wly 7 jaren geleden
bovenliggende
commit
d94dfba890

+ 1 - 0
package.json

@@ -41,6 +41,7 @@
     "graphql-tag": "^2.10.0",
     "html-webpack-plugin": "4.0.0-alpha.2",
     "identity-obj-proxy": "3.0.0",
+    "intro.js": "^2.9.3",
     "isomorphic-fetch": "^2.2.1",
     "jest": "23.6.0",
     "jest-pnp-resolver": "1.0.1",

+ 2 - 2
src/app/App.jsx

@@ -364,7 +364,7 @@ class GraphqlSidebar extends Component {
                     ({loading, error, data}) => {
                         if (loading) return <Spin style={{marginLeft: 3}}/>;
                         if (error) return 'error!';
-                        // console.log('CASE_SCHEMA_AND_PROJECT data', data);
+                        // console.log('CASE_AND_PROJECT data', data);
                         data.caseProject.forEach((project) => {
                             switch (project.schema_id.schemaName) {
                                 case 'ecommerce' :
@@ -478,7 +478,7 @@ class WxConfigSiderbar extends Component {
             <Query query={gql(CASE_AND_PROJECT)} variables={{projectType: 'wx', user_id: this.state.userID}}>
                 {
                     ({loading, error, data}) => {
-                        console.log('CASE_WXCONFIG_AND_PROJECT data', data);
+                        // console.log('CASE_WXCONFIG_AND_PROJECT data', data);
                         if (loading) return <Spin style={{marginLeft: 3}}/>;
                         if (error) return 'error!';
                         return (

+ 45 - 8
src/app/common/deploy/tencent/APIGroupCard.js

@@ -36,7 +36,7 @@ const youMustFill = {
     'environmentName': true,
     'defaultDomain': true,
     'frontType': true,
-    'userDomain': true,
+    'userDomain': false,
     'userStatus': true,
     'region': true,
 };
@@ -138,7 +138,8 @@ class APIGroupCard extends Component {
                     if (data.create_apiGWGroup !== null) {
                         this.setState({
                             showOK: true
-                        })
+                        });
+                        this.props.stepByStep(2);
                     }
                     setTimeout(()=>{
                         this.setState({
@@ -165,7 +166,8 @@ class APIGroupCard extends Component {
                     if (data.update_apiGWGroup !== null) {
                         this.setState({
                             showOK: true
-                        })
+                        });
+                        this.props.stepByStep(2);
                     }
                     setTimeout(()=>{
                         this.setState({
@@ -189,7 +191,14 @@ class APIGroupCard extends Component {
         return (
             <div>
                 <div style={{marginBottom: 10}}>
-                            <span className='vice-title'><FormattedMessage id={valueToKey['groupName']}/>
+                            <span className='vice-title'>
+                                {
+                                    youMustFill['groupName']?
+                                        <span style={{color: 'red', display: 'inline', marginRight: 10}}>*</span>
+                                        :
+                                        ''
+                                }
+                                <FormattedMessage id={valueToKey['groupName']}/>
                                 &nbsp;
                                 <Tooltip placement="top" title={toolTipTitle['groupName']}>
                                     <Icon type="question-circle"/>
@@ -200,7 +209,14 @@ class APIGroupCard extends Component {
                 </div>
 
                 <div style={{marginBottom: 10}}>
-                            <span className='vice-title'><FormattedMessage id={valueToKey['region']}/>
+                            <span className='vice-title'>
+                                {
+                                    youMustFill['region']?
+                                        <span style={{color: 'red', display: 'inline', marginRight: 10}}>*</span>
+                                        :
+                                        ''
+                                }
+                                <FormattedMessage id={valueToKey['region']}/>
                                 &nbsp;
                                 <Tooltip placement="top" title={toolTipTitle['region']}>
                                     <Icon type="question-circle"/>
@@ -219,7 +235,14 @@ class APIGroupCard extends Component {
                 </div>
 
                 <div style={{marginBottom: 10}}>
-                            <span className='vice-title'><FormattedMessage id={valueToKey['environmentName']}/>
+                            <span className='vice-title'>
+                                {
+                                    youMustFill['environmentName']?
+                                        <span style={{color: 'red', display: 'inline', marginRight: 10}}>*</span>
+                                        :
+                                        ''
+                                }
+                                <FormattedMessage id={valueToKey['environmentName']}/>
                                 &nbsp;
                                 <Tooltip placement="top" title={toolTipTitle['environmentName']}>
                                     <Icon type="question-circle"/>
@@ -236,7 +259,14 @@ class APIGroupCard extends Component {
                     <Panel header=<FormattedMessage id="Want more options?"/> style={customPanelStyle}>
 
                         <div style={{marginBottom: 10}}>
-                            <span className='vice-title'><FormattedMessage id={valueToKey['frontType']}/>
+                            <span className='vice-title'>
+                                {
+                                    youMustFill['frontType']?
+                                        <span style={{color: 'red', display: 'inline', marginRight: 10}}>*</span>
+                                        :
+                                        ''
+                                }
+                                <FormattedMessage id={valueToKey['frontType']}/>
                                 &nbsp;
                                 <Tooltip placement="top" title={toolTipTitle['frontType']}>
                                     <Icon type="question-circle"/>
@@ -260,7 +290,14 @@ class APIGroupCard extends Component {
                         {/*</div>*/}
 
                         <div style={{marginBottom: 10}}>
-                            <span className='vice-title'><FormattedMessage id={valueToKey['userDomain']}/>
+                            <span className='vice-title'>
+                                {
+                                    youMustFill['userDomain']?
+                                        <span style={{color: 'red', display: 'inline', marginRight: 10}}>*</span>
+                                        :
+                                        ''
+                                }
+                                <FormattedMessage id={valueToKey['userDomain']}/>
                                 &nbsp;
                                 <Tooltip placement="top" title={toolTipTitle['userDomain']}>
                                     <Icon type="question-circle"/>

+ 33 - 9
src/app/common/deploy/tencent/APIPathCard.js

@@ -26,7 +26,7 @@ const toolTipTitle = {
 
 const youMustFill = {
     'apiGWName': true,
-    'apiGWDesc': true,
+    'apiGWDesc': false,
     'requestMethod': true
 };
 
@@ -79,10 +79,10 @@ class APIPathCard extends Component {
         };
     };
 
-    ok = () => {
+    ok = (id) => {
         let {apiGWName, apiGWDesc, requestMethod} = this.state;
         let varObj = {
-            id: idGen('path'),
+            id,
             user_id: this.props.userID,
             apiGWGroup_id: this.props.groupID,
             deploy_id: this.props.deployID,
@@ -103,7 +103,8 @@ class APIPathCard extends Component {
                         if (data.create_apiGWPath !== null) {
                             this.setState({
                                 showOK: true
-                            })
+                            });
+                            this.props.stepByStep(3);
                         }
                         setTimeout(()=>{
                             this.setState({
@@ -127,7 +128,8 @@ class APIPathCard extends Component {
                     if (data.update_apiGWPath !== null) {
                         this.setState({
                             showOK: true
-                        })
+                        });
+                        this.props.stepByStep(3);
                     }
                     setTimeout(()=>{
                         this.setState({
@@ -155,7 +157,14 @@ class APIPathCard extends Component {
                         {
                             this.state.configs.map(config => (
                                 <div key={config} style={{marginBottom: 10}}>
-                                    <span className='vice-title'><FormattedMessage id={valueToKey[config]}/>
+                                    <span className='vice-title'>
+                                        {
+                                            youMustFill[config]?
+                                                <span style={{color: 'red', display: 'inline', marginRight: 10}}>*</span>
+                                                :
+                                                ''
+                                        }
+                                        <FormattedMessage id={valueToKey[config]}/>
                                         &nbsp;
                                         <Tooltip placement="top" title={toolTipTitle[config]}>
                                             <Icon type="question-circle"/>
@@ -167,7 +176,14 @@ class APIPathCard extends Component {
                             ))
                         }
                         <div style={{marginBottom: 10}}>
-                            <span className='vice-title'><FormattedMessage id={valueToKey['requestMethod']}/>
+                            <span className='vice-title'>
+                                {
+                                    youMustFill['requestMethod']?
+                                        <span style={{color: 'red', display: 'inline', marginRight: 10}}>*</span>
+                                        :
+                                        ''
+                                }
+                                <FormattedMessage id={valueToKey['requestMethod']}/>
                                 &nbsp;
                                 <Tooltip placement="top" title={toolTipTitle['requestMethod']}>
                                     <Icon type="question-circle"/>
@@ -185,7 +201,11 @@ class APIPathCard extends Component {
                 {
                     manageUsers.includes(this.props.userID) ?
                         <div>
-                            <Button onClick={this.ok} type='primary'><FormattedMessage id="save"/></Button>
+                            <Button onClick={()=>{
+                                const id = idGen('path');
+                                this.ok(id);
+                                this.props.pass(id, 'path');
+                            }} type='primary'><FormattedMessage id="save"/></Button>
                             {
                                 this.state.showOK === true?
                                     <Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a"/>
@@ -198,7 +218,11 @@ class APIPathCard extends Component {
                             ''
                             :
                             <div>
-                                <Button onClick={this.ok} type='primary'><FormattedMessage id="save"/></Button>
+                                <Button onClick={()=>{
+                                    const id = idGen('path');
+                                    this.ok(id);
+                                    this.props.pass(id, 'path');
+                                }} type='primary'><FormattedMessage id="save"/></Button>
                                 {
                                     this.state.showOK === true?
                                         <Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a"/>

+ 36 - 6
src/app/common/deploy/tencent/DeployCard.js

@@ -159,7 +159,8 @@ class DeployCard extends Component {
                     if (data.create_deploy !== null) {
                         this.setState({
                             showOK: true
-                        })
+                        });
+                        this.props.stepByStep(1);
                     }
                     setTimeout(() => {
                         this.setState({
@@ -189,7 +190,8 @@ class DeployCard extends Component {
                     if (data.update_deploy !== null) {
                         this.setState({
                             showOK: true
-                        })
+                        });
+                        this.props.stepByStep(1);
                     }
                     setTimeout(() => {
                         this.setState({
@@ -220,7 +222,14 @@ class DeployCard extends Component {
         return (
             <div>
                 <div style={{marginBottom: 10}}>
-                    <span className='vice-title'><FormattedMessage id={valueToKey['functionName']}/>
+                    <span className='vice-title'>
+                        {
+                            youMustFill['functionName']?
+                                <span style={{color: 'red', display: 'inline', marginRight: 10}}>*</span>
+                                :
+                                ''
+                        }
+                        <FormattedMessage id={valueToKey['functionName']}/>
                         &nbsp;
                         <Tooltip placement="top" title={toolTipTitle['functionName']}>
                             <Icon type="question-circle"/>
@@ -230,7 +239,14 @@ class DeployCard extends Component {
                            onChange={this.switchConfig('functionName')}/>
                 </div>
                 <div style={{marginBottom: 10}}>
-                    <span className='vice-title'><FormattedMessage id={valueToKey['region']}/>
+                    <span className='vice-title'>
+                        {
+                            youMustFill['region']?
+                                <span style={{color: 'red', display: 'inline', marginRight: 10}}>*</span>
+                                :
+                                ''
+                        }
+                        <FormattedMessage id={valueToKey['region']}/>
                         &nbsp;
                         <Tooltip placement="top" title={toolTipTitle['region']}>
                             <Icon type="question-circle"/>
@@ -249,7 +265,14 @@ class DeployCard extends Component {
                 <Collapse bordered={false}>
                     <Panel header=<FormattedMessage id="Want more options?"/> style={customPanelStyle}>
                         <div style={{marginBottom: 10}}>
-                            <span className='vice-title'><FormattedMessage id={valueToKey['cosBucketRegion']}/>
+                            <span className='vice-title'>
+                                {
+                                    youMustFill['cosBucketRegion']?
+                                        <span style={{color: 'red', display: 'inline', marginRight: 10}}>*</span>
+                                        :
+                                        ''
+                                }
+                                <FormattedMessage id={valueToKey['cosBucketRegion']}/>
                                 &nbsp;
                                 <Tooltip placement="top" title={toolTipTitle['cosBucketRegion']}>
                                     <Icon type="question-circle"/>
@@ -281,7 +304,14 @@ class DeployCard extends Component {
                         {
                             this.state.configs.map(config => (
                                 <div key={config} style={{marginBottom: 10}}>
-                                    <span className='vice-title'><FormattedMessage id={valueToKey[config]}/>
+                                    <span className='vice-title'>
+                                        {
+                                            youMustFill[config]?
+                                                <span style={{color: 'red', display: 'inline', marginRight: 10}}>*</span>
+                                                :
+                                                ''
+                                        }
+                                        <FormattedMessage id={valueToKey[config]}/>
                                         &nbsp;
                                         <Tooltip placement="top" title={toolTipTitle[config]}>
                                             <Icon type="question-circle"/>

+ 40 - 8
src/app/common/deploy/tencent/NotificationCard.js

@@ -3,10 +3,24 @@ import {FormattedMessage} from 'react-intl';
 import {Input, Tooltip, Icon, Button} from 'antd';
 import {manageUsers} from "../../../../config";
 
-class NotificationCard extends Component {
 
+const valueToKey = {
+    'dingding webhook': 'dingding webhook',
+    'notification name': 'requestMethod'
+};
+
+const toolTipTitle = {
+    'dingding webhook': 'its dingding webhook',
+    'notification name': 'its notification name'
+};
 
+const youMustFill = {
+    'dingding webhook': false,
+    'notification name': false
+};
 
+
+class NotificationCard extends Component {
     render() {
         return (
             <div>
@@ -15,8 +29,17 @@ class NotificationCard extends Component {
                     <div className='item'>
                         <p style={{marginBottom: 10}}>
                             <span className='item-title'>
-                                <span><FormattedMessage id="Web hook"/>  </span>
-                                <Tooltip placement="top" title='dingding webhook'>
+                                <span>
+                                    {
+                                        youMustFill['dingding webhook']?
+                                            <span style={{color: 'red', display: 'inline', marginRight: 10}}>*</span>
+                                            :
+                                            ''
+                                    }
+                                    <FormattedMessage id="Web hook"/>
+                                    &nbsp;
+                                </span>
+                                <Tooltip placement="top" title={toolTipTitle['dingding webhook']}>
                                     <Icon type="question-circle"/>
                                 </Tooltip>
                             </span>
@@ -24,12 +47,21 @@ class NotificationCard extends Component {
                         </p>
                         <p style={{marginBottom: 10}}>
                             <span className='item-title'>
-                                <span><FormattedMessage id="Notification Name"/>  </span>
-                                <Tooltip placement="top" title='notification name'>
+                                <span>
+                                    {
+                                        youMustFill['notification name']?
+                                            <span style={{color: 'red', display: 'inline', marginRight: 10}}>*</span>
+                                            :
+                                            ''
+                                    }
+                                    <FormattedMessage id="Notification Name"/>
+                                    &nbsp;
+                                </span>
+                                <Tooltip placement="top" title={toolTipTitle['notification name']}>
                                     <Icon type="question-circle"/>
                                 </Tooltip>
                             </span>
-                            <Input style={{width: 300}} value={this.props.defaultValue}/></p>
+                            <Input style={{width: 300}} value={this.props.defalutName} onChange={()=>{}}/></p>
                     </div>
                 </div>
 
@@ -59,14 +91,14 @@ class NotificationCard extends Component {
                 {
                     manageUsers.includes(this.props.userID) ?
                         <Button type="primary" onClick={() => {
-                            console.log('hello');
+                            this.props.stepByStep(4);
                         }}><FormattedMessage id="save"/></Button>
                         :
                         this.props.trialcase?
                             ''
                             :
                             <Button type="primary" onClick={() => {
-                                console.log('hello');
+                                this.props.stepByStep(4);
                             }}><FormattedMessage id="save"/></Button>
                 }
 

+ 360 - 128
src/app/common/deploy/tencent/TencentConfig.js

@@ -1,5 +1,5 @@
 import React, {Component} from 'react';
-import {Row, Col, Card, Button, Spin, Alert} from 'antd';
+import {Row, Col, Card, Button, Spin, Alert, Steps} from 'antd';
 import axios from 'axios';
 import APIGroupCard from './APIGroupCard';
 import APIPathCard from './APIPathCard';
@@ -12,6 +12,8 @@ import {FormattedMessage} from 'react-intl';
 import gql from "graphql-tag";
 import {Query} from "react-apollo";
 
+const Step = Steps.Step;
+
 class TencentConfig extends Component {
     constructor(props) {
         super(props);
@@ -19,7 +21,9 @@ class TencentConfig extends Component {
             region: '',
             couldDeploy: false,
             deployIdPassToPath: '',
-            groupIdPassToPath: ''
+            groupIdPassToPath: '',
+            pathIdPassToConfig: '',
+            currentStep: 0
         };
     }
 
@@ -28,7 +32,8 @@ class TencentConfig extends Component {
             couldDeploy: false,
             region: '',
             deployIdPassToPath: '',
-            groupIdPassToPath: ''
+            groupIdPassToPath: '',
+            currentStep: 0
         });
     }
 
@@ -44,34 +49,67 @@ class TencentConfig extends Component {
             this.setState({
                 deployIdPassToPath: value
             });
-        else
+        else if (kind === 'group')
             this.setState({
                 groupIdPassToPath: value
+            });
+        else {
+            this.setState({
+                pathIdPassToConfig: value
             })
+        }
     };
 
-    deployFC = () => {
-        let _this = this;
-
-        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"
-                }
-            })
-            .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);
-            });
+    deployFC = (schema, deploy, api, group) => {
+        console.log('schema', schema);
+        console.log('deploy', deploy);
+        console.log('api', api);
+        console.log('group', group);
+        if (schema && deploy && api && group) {
+            console.log('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-name': 'tencent',
+                        schema,
+                        deploy,
+                        api,
+                        group
+                    }
+                })
+                .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);
+                });
+        }
+
+    };
+
+    stepByStep = (stepNum) => {
+        this.setState({
+            currentStep: stepNum
+        })
+    };
+
+    stepStatus = (value) => {
+        if (this.state.currentStep === value)
+            return '进行中';
+        else if (this.state.currentStep > value)
+            return '完成';
+        else
+            return '等待';
     };
 
     render() {
@@ -91,127 +129,321 @@ class TencentConfig extends Component {
                         let group = '',
                             deploy = '',
                             path = '',
+                            schemaID = '',
+                            configID = '',
+                            api = '',
                             cloudID = 'tencent_CloudID';
 
-                        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;
-                        }
-                        let defaultName = data.project_by_id.projectName;
-                        return (
-                            <div>
-                                {
-                                    data.project_by_id.schema_id.schemaState === 'ok' ?
-                                        ''
-                                        :
-                                        this.props.trialcase ?
+                        let dataProject = data.project_by_id;
+                        let {cloud_id, apiGWGroup_id, deploy_id, projectType, schema_id, wxConfig_id, projectName} = dataProject;
+
+                        let defaultName = projectName;
+
+                        if (projectType === 'graphql')
+                            schemaID = schema_id.id;
+                        else
+                            configID = wxConfig_id.id;
+
+                        // 如果 cloud_id 没有存储,说明尚未部署,即新的 project,使用 '视图 2'
+                        // 旧的 project 使用 '视图 1'
+
+                        if (cloud_id !== null && cloud_id.cloudName === 'tencent') {
+                            group = apiGWGroup_id;
+                            deploy = deploy_id;
+                            cloudID = cloud_id.id;
+
+                            return (
+                                <div>
+                                    {
+                                        projectType === 'graphql' ?
+                                            schema_id.schemaState === 'ok' ?
+                                                ''
+                                                :
+                                                this.props.trialcase ?
+                                                    ''
+                                                    :
+                                                    <div style={{marginBottom: 10}}>
+                                                        <Alert message="数据表结构不符合规范,暂不能部署,请修改" type="warning"
+                                                               banner closable/>
+                                                    </div>
+                                            :
                                             ''
+                                    }
+                                    <div style={{padding: '30px'}}>
+                                        <Row gutter={16}>
+                                            <Col span={14}>
+                                                <FormattedMessage id="fc Deploy">
+                                                    {
+                                                        msg =>
+                                                            <Card title={msg} style={{marginBottom: 10}}>
+                                                                <DeployCard
+                                                                    deploy={deploy}
+                                                                    switchRegion={this.switchRegion}
+                                                                    region={this.state.region}
+                                                                    defalutName={defaultName}
+                                                                    userID={this.props.userID}
+                                                                    cloudID={cloudID}
+                                                                    trialcase={this.props.trialcase}
+                                                                    pass={this.pass}
+                                                                />
+                                                            </Card>
+                                                    }
+                                                </FormattedMessage>
+                                                <FormattedMessage id="API Group">
+                                                    {
+                                                        msg =>
+                                                            <Card title={msg} style={{marginBottom: 10}}>
+                                                                <APIGroupCard
+                                                                    group={group}
+                                                                    userID={this.props.userID}
+                                                                    switchRegion={this.switchRegion}
+                                                                    region={this.state.region}
+                                                                    cloudID={cloudID}
+                                                                    trialcase={this.props.trialcase}
+                                                                    pass={this.pass}
+                                                                />
+                                                            </Card>
+                                                    }
+                                                </FormattedMessage>
+                                                <Query query={gql(SHOW_APIGWPATH)}
+                                                       variables={{apiGWGroup_id: apiGWGroup_id ? apiGWGroup_id.id : ''}}>
+                                                    {
+                                                        ({loading, error, data}) => {
+                                                            if (loading) {
+                                                                return <Spin style={{marginLeft: 3}}/>
+                                                            }
+                                                            if (error) {
+                                                                return 'error!';
+                                                            }
+                                                            if (data.apiGWPath_by_props.length > 0)
+                                                                path = data.apiGWPath_by_props[0];
+                                                            return (
+                                                                <FormattedMessage id="API Path">
+                                                                    {
+                                                                        msg =>
+                                                                            <Card title={msg}
+                                                                                  style={{marginBottom: 10}}>
+                                                                                <APIPathCard
+                                                                                    path={path}
+                                                                                    defalutName={defaultName}
+                                                                                    userID={this.props.userID}
+                                                                                    trialcase={this.props.trialcase}
+                                                                                    deployID={deploy ? deploy.id : this.state.deployIdPassToPath}
+                                                                                    groupID={group ? group.id : this.state.groupIdPassToPath}
+                                                                                    pass={this.pass}
+                                                                                />
+                                                                            </Card>
+                                                                    }
+                                                                </FormattedMessage>
+                                                            )
+                                                        }
+                                                    }
+                                                </Query>
+                                                <FormattedMessage id="Notification">
+                                                    {
+                                                        msg =>
+                                                            <Card title={msg}>
+                                                                <NotificationCard
+                                                                    userID={this.props.userID}
+                                                                    defalutName={defaultName}
+                                                                    trialcase={this.props.trialcase}
+                                                                />
+                                                            </Card>
+                                                    }
+                                                </FormattedMessage>
+                                            </Col>
+                                            <Col offset={2} span={6}>
+                                                {
+                                                    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>
+                                                                :
+                                                                <Button type='primary' disabled><FormattedMessage
+                                                                    id="deploy"/>!</Button>
+                                                            :
+                                                            <Button type='primary' onClick={() => {
+                                                            }}><FormattedMessage id="deploy"/>!</Button>
+
+                                                }
+                                            </Col>
+                                        </Row>
+                                    </div>
+                                </div>
+                            )
+
+                        } else {
+
+                            return (
+                                <div>
+                                    {
+                                        projectType === 'graphql' ?
+                                            schema_id.schemaState === 'ok' ?
+                                                ''
+                                                :
+                                                this.props.trialcase ?
+                                                    ''
+                                                    :
+                                                    <div style={{marginBottom: 10}}>
+                                                        <Alert message="数据表结构不符合规范,暂不能部署,请修改" type="warning"
+                                                               banner closable/>
+                                                    </div>
                                             :
-                                            <div style={{marginBottom: 10}}>
-                                                <Alert message="数据表结构不符合规范,暂不能部署,请修改" type="warning"
-                                                       banner closable/>
-                                            </div>
-                                }
-                                <div style={{padding: '30px'}}>
-                                    <Row gutter={16}>
-                                        <Col span={14}>
+                                            ''
+                                    }
+                                    <div style={{padding: '30px'}}>
+                                        <Row gutter={16}>
+                                            <Col span={14}>
 
+                                                <Steps current={this.state.currentStep} style={{marginBottom: 30}}>
+                                                    <Step title={this.stepStatus(0)} description="云函数配置"/>
+                                                    <Step title={this.stepStatus(1)} description="服务配置"/>
+                                                    <Step title={this.stepStatus(2)} description="API 配置"/>
+                                                    <Step title={this.stepStatus(3)} description="通知配置"/>
+                                                </Steps>
 
-                                            <FormattedMessage id="fc Deploy">
                                                 {
-                                                    msg =>
-                                                        <Card title={msg} style={{marginBottom: 10}}>
-                                                            <DeployCard
-                                                                deploy={deploy}
-                                                                switchRegion={this.switchRegion}
-                                                                region={this.state.region}
-                                                                defalutName={defaultName}
-                                                                userID={this.props.userID}
-                                                                cloudID={cloudID}
-                                                                trialcase={this.props.trialcase}
-                                                                pass={this.pass}
-                                                            />
-                                                        </Card>
+                                                    this.state.currentStep === 0 ?
+                                                        <FormattedMessage id="fc Deploy">
+                                                            {
+                                                                msg =>
+                                                                    <Card title={msg} style={{marginBottom: 10}}>
+                                                                        <DeployCard
+                                                                            deploy={deploy}
+                                                                            switchRegion={this.switchRegion}
+                                                                            region={this.state.region}
+                                                                            defalutName={defaultName}
+                                                                            userID={this.props.userID}
+                                                                            cloudID={cloudID}
+                                                                            trialcase={this.props.trialcase}
+                                                                            pass={this.pass}
+                                                                            stepByStep={this.stepByStep}
+                                                                        />
+                                                                    </Card>
+                                                            }
+                                                        </FormattedMessage>
+                                                        :
+                                                        ''
                                                 }
-                                            </FormattedMessage>
-                                            <FormattedMessage id="API Group">
+
                                                 {
-                                                    msg =>
-                                                        <Card title={msg} style={{marginBottom: 10}}>
-                                                            <APIGroupCard
-                                                                group={group}
-                                                                userID={this.props.userID}
-                                                                switchRegion={this.switchRegion}
-                                                                region={this.state.region}
-                                                                cloudID={cloudID}
-                                                                trialcase={this.props.trialcase}
-                                                                pass={this.pass}
-                                                            />
-                                                        </Card>
+                                                    this.state.currentStep === 1 ?
+                                                        <FormattedMessage id="API Group">
+                                                            {
+                                                                msg =>
+                                                                    <Card title={msg} style={{marginBottom: 10}}>
+                                                                        <APIGroupCard
+                                                                            group={group}
+                                                                            userID={this.props.userID}
+                                                                            switchRegion={this.switchRegion}
+                                                                            region={this.state.region}
+                                                                            cloudID={cloudID}
+                                                                            trialcase={this.props.trialcase}
+                                                                            pass={this.pass}
+                                                                            stepByStep={this.stepByStep}
+                                                                        />
+                                                                    </Card>
+                                                            }
+                                                        </FormattedMessage>
+                                                        :
+                                                        ''
                                                 }
-                                            </FormattedMessage>
-                                            <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) {
-                                                            return <Spin style={{marginLeft: 3}}/>
-                                                        }
-                                                        if (error) {
-                                                            return 'error!';
-                                                        }
-                                                        if (data.apiGWPath_by_props.length > 0)
-                                                            path = data.apiGWPath_by_props[0];
-                                                        return (
-                                                            <FormattedMessage id="API Path">
-                                                                {
-                                                                    msg =>
-                                                                        <Card title={msg} style={{marginBottom: 10}}>
-                                                                            <APIPathCard
-                                                                                path={path}
-                                                                                defalutName={defaultName}
-                                                                                userID={this.props.userID}
-                                                                                trialcase={this.props.trialcase}
-                                                                                deployID={deploy ? deploy.id : this.state.deployIdPassToPath}
-                                                                                groupID={group ? group.id : this.state.groupIdPassToPath}
-                                                                            />
-                                                                        </Card>
+                                                    this.state.currentStep === 2 ?
+                                                        <Query query={gql(SHOW_APIGWPATH)}
+                                                               variables={{apiGWGroup_id: apiGWGroup_id ? apiGWGroup_id.id : ''}}>
+                                                            {
+                                                                ({loading, error, data}) => {
+                                                                    if (loading) {
+                                                                        return <Spin style={{marginLeft: 3}}/>
+                                                                    }
+                                                                    if (error) {
+                                                                        return 'error!';
+                                                                    }
+                                                                    if (data.apiGWPath_by_props.length > 0)
+                                                                        path = data.apiGWPath_by_props[0];
+                                                                    return (
+                                                                        <FormattedMessage id="API Path">
+                                                                            {
+                                                                                msg =>
+                                                                                    <Card title={msg}
+                                                                                          style={{marginBottom: 10}}>
+                                                                                        <APIPathCard
+                                                                                            path={path}
+                                                                                            defalutName={defaultName}
+                                                                                            userID={this.props.userID}
+                                                                                            trialcase={this.props.trialcase}
+                                                                                            deployID={deploy ? deploy.id : this.state.deployIdPassToPath}
+                                                                                            groupID={group ? group.id : this.state.groupIdPassToPath}
+                                                                                            pass={this.pass}
+                                                                                            stepByStep={this.stepByStep}
+                                                                                        />
+                                                                                    </Card>
+                                                                            }
+                                                                        </FormattedMessage>
+                                                                    )
                                                                 }
-                                                            </FormattedMessage>
-                                                        )
-                                                    }
+                                                            }
+                                                        </Query>
+                                                        :
+                                                        ''
                                                 }
-                                            </Query>
-                                            <FormattedMessage id="Notification">
+
                                                 {
-                                                    msg =>
-                                                        <Card title={msg}>
-                                                            <NotificationCard
-                                                                userID={this.props.userID}
-                                                                defalutName={defaultName}
-                                                                trialcase={this.props.trialcase}
-                                                            />
-                                                        </Card>
+                                                    this.state.currentStep === 3 ?
+                                                        <FormattedMessage id="Notification">
+                                                            {
+                                                                msg =>
+                                                                    <Card title={msg}>
+                                                                        <NotificationCard
+                                                                            userID={this.props.userID}
+                                                                            defalutName={defaultName}
+                                                                            trialcase={this.props.trialcase}
+                                                                            stepByStep={this.stepByStep}
+                                                                        />
+                                                                    </Card>
+                                                            }
+                                                        </FormattedMessage>
+                                                        :
+                                                        ''
                                                 }
-                                            </FormattedMessage>
-                                        </Col>
-                                        <Col offset={2} span={6}>
+
+                                            </Col>
+
                                             {
-                                                this.props.trialcase ?
-                                                    ''
-                                                    :
-                                                    data.project_by_id.schema_id.schemaState === 'ok' ?
-                                                        <Button type='primary' onClick={() => this.deployFC()}><FormattedMessage id="deploy"/>!</Button>
-                                                        :
-                                                        <Button type='primary' disabled><FormattedMessage id="deploy"/>!</Button>
+                                                this.state.currentStep === 4 ?
+                                                    <Col offset={2} span={6}>
+                                                        {
+                                                            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>
+                                                                        :
+                                                                        <Button type='primary'
+                                                                                disabled><FormattedMessage id="deploy"/>!</Button>
+                                                                    :
+                                                                    <Button type='primary' onClick={() => {
+                                                                    }}><FormattedMessage id="deploy"/>!</Button>
 
+                                                        }
+                                                    </Col>
+                                                    :
+                                                    ''
                                             }
-                                        </Col>
-                                    </Row>
+
+                                        </Row>
+                                    </div>
                                 </div>
-                            </div>
-                        )
+                            )
+                        }
                     }
                 }
             </Query>

+ 1 - 1
src/app/common/manage/Manage.jsx

@@ -36,7 +36,7 @@ class Manage extends Component {
 
     render() {
         const contentListNoTitle = {
-            tencent: <TencentResult userID={this.props.userID} projectID={this.props.projectID} trialcase={this.props.trialcase} switchMenu={this.props.switchMenu} switchAPI={this.props.switchAPI}/>,
+            tencent: <TencentResult userID={this.props.userID} projectID={this.props.projectID} trialcase={this.props.trialcase} switchMenu={this.props.switchMenu}/>,
             aliyun: <AliyunResult/>,
             amazon: <AmazonResult/>,
         };

+ 36 - 24
src/app/common/manage/TencentResult.js

@@ -1,4 +1,5 @@
 import React, {Component} from 'react';
+import {FormattedMessage} from 'react-intl';
 import {Switch, Input, Icon, Spin, Row, Col, message} from 'antd';
 import {GET_PROJECT, SHOW_APIGWPATH, UPDATE_APIGROUP} from "../../../gql";
 import gql from "graphql-tag";
@@ -24,19 +25,20 @@ class TencentResult extends Component {
                             return 'error!';
                         }
                         let group = data.project_by_id.apiGWGroup_id || {};
+                        let projectType = data.project_by_id.projectType || 'graphql';
                         return (
                             <div>
                                 {
                                     Object.keys(group).length !== 0 ?
                                         <div>
-                                            <div className={'schema-name'}>服务管理</div>
+                                            <div className={'schema-name'}><FormattedMessage id='service manage'/></div>
                                             <div className={'schema-table-list-title'}>
                                                 <Row>
-                                                    <Col span={4}><span className={'schema-table-title'}>服务名</span></Col>
-                                                    <Col span={10}><span className={'schema-table-title'}>默认域名</span></Col>
-                                                    <Col span={3}><span className={'schema-table-title'}>前端类型</span></Col>
-                                                    <Col span={4}><span className={'schema-table-title'}>发布状态</span></Col>
-                                                    <Col span={3}><span className={'schema-table-title'}>操作</span></Col>
+                                                    <Col span={4}><span className={'schema-table-title'}><FormattedMessage id='groupName'/></span></Col>
+                                                    <Col span={10}><span className={'schema-table-title'}><FormattedMessage id='defaultDomain'/></span></Col>
+                                                    <Col span={3}><span className={'schema-table-title'}><FormattedMessage id='frontType'/></span></Col>
+                                                    <Col span={4}><span className={'schema-table-title'}><FormattedMessage id='environmentName'/></span></Col>
+                                                    <Col span={3}><span className={'schema-table-title'}><FormattedMessage id='operation'/></span></Col>
                                                 </Row>
                                             </div>
                                             <div className={'schema-table-list-content'}>
@@ -59,23 +61,28 @@ class TencentResult extends Component {
                                                     </Col>
                                                     <Col span={3}>
                                                     <span className={'schema-table-content'}>
-                                                        <SwitchStatus group={group}/>
+                                                        {
+                                                            this.props.trialcase?
+                                                                <Switch checked={true} disabled/>
+                                                                :
+                                                                <SwitchStatus group={group}/>
+                                                        }
                                                         {/*<span className={'schema-table-content name'}>删除</span>*/}
                                                     </span>
                                                     </Col>
                                                 </Row>
                                             </div>
                                             <div style={{marginTop: 30}}>
-                                                <div className={'schema-name'}>API 管理</div>
+                                                <div className={'schema-name'}><FormattedMessage id='API manage'/></div>
                                                 <APIGWPathResult
                                                     group={group}
+                                                    projectType={projectType}
                                                     switchMenu={this.props.switchMenu}
-                                                    switchAPI={this.props.switchAPI}
                                                 />
                                             </div>
                                         </div>
                                         :
-                                        '尚未部署'
+                                        <FormattedMessage id='No deploy'/>
                                 }
                             </div>
                         )
@@ -151,7 +158,7 @@ class APIGWPathResult extends Component {
     }
 
     render() {
-        let {group} = this.props;
+        let {group, projectType} = this.props;
         let {id, frontType, defaultDomain, environmentName} = group;
         return (
             <Query query={gql(SHOW_APIGWPATH)} variables={{apiGWGroup_id: id}}>
@@ -171,11 +178,11 @@ class APIGWPathResult extends Component {
                                         <div>
                                             <div className={'schema-table-list-title'}>
                                                 <Row>
-                                                    <Col span={6}><span className={'schema-table-title'}>名称</span></Col>
-                                                    <Col span={6}><span className={'schema-table-title'}>路径</span></Col>
-                                                    <Col span={3}><span className={'schema-table-title'}>方法</span></Col>
-                                                    <Col span={6}><span className={'schema-table-title'}>描述</span></Col>
-                                                    <Col span={3}><span className={'schema-table-title'}>操作</span></Col>
+                                                    <Col span={6}><span className={'schema-table-title'}><FormattedMessage id='name'/></span></Col>
+                                                    <Col span={6}><span className={'schema-table-title'}><FormattedMessage id='path'/></span></Col>
+                                                    <Col span={3}><span className={'schema-table-title'}><FormattedMessage id='method'/></span></Col>
+                                                    <Col span={6}><span className={'schema-table-title'}><FormattedMessage id='description'/></span></Col>
+                                                    <Col span={3}><span className={'schema-table-title'}><FormattedMessage id='operation'/></span></Col>
                                                 </Row>
                                             </div>
                                             {
@@ -196,14 +203,19 @@ class APIGWPathResult extends Component {
                                                             </Col>
                                                             <Col span={3}>
                                                                 {/*<span className={'schema-table-content name'}>删除</span>*/}
-                                                                {/*<span> </span>*/}
-                                                                <span className={'schema-table-content name'}
-                                                                      onClick={() => {
-                                                                          this.props.switchMenu('menuLevel2', {key: 'graphiql'});
-                                                                          this.props.switchAPI(frontType.slice(0, 4) + '://' + defaultDomain +'/'+ environmentName +path.apiGWPath)
-                                                                      }}>
-                                                                    调试
-                                                                </span>
+                                                                {/*&nbsp;*/}
+                                                                {
+                                                                    projectType === 'graphql'?
+                                                                        <span className={'schema-table-content name'}
+                                                                              onClick={() => {
+                                                                                  this.props.switchMenu('menuLevel2', {key: 'graphiql'});
+                                                                              }}>
+                                                                            <FormattedMessage id='try'/>
+                                                                        </span>
+                                                                        :
+                                                                        ''
+                                                                }
+
                                                             </Col>
                                                         </Row>
                                                     </div>

+ 1 - 1
src/app/graphqlService/TrialCase.jsx

@@ -89,7 +89,7 @@ class TrialCase extends Component {
                                     case 'deploy':
                                         return <Deploy trialcase={true} userID={this.state.userID} projectID={projectID}/>;
                                     case 'manage':
-                                        return <Manage trialcase={true} userID={this.state.userID} projectID={projectID} switchMenu={this.switchMenu} switchAPI={this.switchAPI}/>;
+                                        return <Manage trialcase={true} userID={this.state.userID} projectID={projectID} switchMenu={this.switchMenu}/>;
                                     case 'graphiql':
                                         return <Graphql api={this.state.api} projectID={projectID}/>;
                                     case 'template':

+ 3 - 2
src/app/graphqlService/UserCreate.jsx

@@ -10,6 +10,7 @@ import Graphql from "./component/graphql/Graphql";
 import CaseMetabase from "./component/caseMetabase/CaseMetabase";
 import axios from 'axios';
 import {getIdUrl} from "../../config";
+import Application from "./component/application/Application";
 
 axios.defaults.withCredentials = true;
 
@@ -84,7 +85,7 @@ class UserCreate extends Component {
                                     case 'deploy':
                                         return <Deploy trialcase={false} userID={this.state.userID} projectID={projectID}/>;
                                     case 'manage':
-                                        return <Manage trialcase={false} userID={this.state.userID} projectID={projectID} switchMenu={this.switchMenu} switchAPI={this.switchAPI}/>;
+                                        return <Manage trialcase={false} userID={this.state.userID} projectID={projectID} switchMenu={this.switchMenu}/>;
                                     case 'graphiql':
                                         return <Graphql api={this.state.api} projectID={projectID}/>;
                                     case 'template':
@@ -92,7 +93,7 @@ class UserCreate extends Component {
                                     case 'metabase':
                                         return <CaseMetabase/>;
                                     default:
-                                        return <Graphql/>;
+                                        return <Application location={this.props.location}/>;
                                 }
                             })()
                         }

+ 2 - 2
src/app/graphqlService/component/graphql/Graphql.jsx

@@ -46,9 +46,10 @@ class Graphql extends Component {
                         }
                         let group = data.project_by_id.apiGWGroup_id;
                         if (this.state.api === '') {
+                            let domain = group.userDomain? group.userDomain : group.defaultDomain;
                             this.setState({
                                 // 多路径没做
-                                api: group.frontType.slice(0, 4) + '://' + group.defaultDomain +'/'+ group.environmentName + '/graphql',
+                                api: group.frontType.slice(0, 4) + '://' + domain + '/graphql',
                                 show: true
                             })
                         }
@@ -74,7 +75,6 @@ class Graphql extends Component {
             </Query>
         )
     }
-
 }
 
 export default Graphql;

+ 6 - 3
src/app/graphqlService/component/schema/Schema.jsx

@@ -138,6 +138,7 @@ class Schema extends Component {
             currentTable: next.location.state === undefined ? '' : next.location.state.create ? 'add' : '',
             schemaID: next.schemaID,
             schemaName: next.schemaName,
+            projectID:next.projectID,
             data: '',
             once: 0
         });
@@ -188,6 +189,7 @@ class Schema extends Component {
                                             {
                                                 this.state.editSchemaName ?
                                                     <ModifySchemaNameInput
+                                                        projectID={this.state.projectID}
                                                         editSchemaName={this.state.editSchemaName}
                                                         changeEditSchemaName={this.changeEditSchemaName}
                                                         clearEditSchemaName={this.clearEditSchemaName}
@@ -726,7 +728,7 @@ class ModifySchemaNameInput extends Component {
     render() {
         let userID = this.props.userID;
         let schemaName = this.props.schemaName;
-        console.log('schemaId',this.props.schemaID);
+
         return (
             <Mutation mutation={gql(UPDATE_SCHEMA_PROJECT_NAME)}>
                 {(update_schema_project_name, {loading, error}) => {
@@ -747,12 +749,13 @@ class ModifySchemaNameInput extends Component {
                                         onSearch={value => {
                                             update_schema_project_name({
                                                 variables: {
-                                                    id: this.props.schemaID,
+                                                    schemaID: this.props.schemaID,
+                                                    projectID:this.props.projectID,
                                                     schemaName: value,
                                                     updateAt: new Date().getTime()
                                                 }
                                             }).then((res)=>{
-                                                console.log('update_schema_project_name res',res)
+                                                // console.log('update_schema_project_name res',res)
                                             });
                                             this.props.history.push({
                                                 pathname: `/graphql-service/my-create/${value}`,

+ 1 - 0
src/app/graphqlService/component/schema/index.css

@@ -124,6 +124,7 @@ p.show {
 
 .name {
     color: #006eff;
+    cursor: pointer;
 }
 
 .schema-table-list-content:last-child {

+ 3 - 3
src/app/wechatService/WxTrialCase.js

@@ -53,11 +53,11 @@ class WxTrialCase extends Component {
                         {(() => {
                             switch (this.state.menuLevel3) {
                                 case 'wechat-config':
-                                    return <WxConfig projectID={projectID} defaultAppName={'ecommerce'} defaultConfigID={'ecommerce_wxConfigID'} trialcase={true} history={this.props.history} location={this.props.location}/>;
+                                    return <WxConfig trialcase={true} userID={this.state.userID} projectID={projectID} defaultAppName={'ecommerce'} defaultConfigID={'ecommerce_wxConfigID'} history={this.props.history} location={this.props.location}/>;
                                 case 'wechat-deploy':
-                                    return <WxDeploy trialcase={true} userID={this.state.userID} configID={configID}/>;
+                                    return <WxDeploy trialcase={true} userID={this.state.userID} projectID={projectID}/>;
                                 case 'wechat-manage':
-                                    return <Manage trialcase={true} userID={this.state.userID} configID={configID} switchMenu={this.switchMenu}/>;
+                                    return <Manage trialcase={true} userID={this.state.userID} projectID={projectID}/>;
                                 default:
                                     return <WxConfig/>
                             }

+ 3 - 3
src/app/wechatService/WxUserCreate.js

@@ -75,11 +75,11 @@ class WxUserCreate extends Component {
                         {(() => {
                             switch (this.state.menuLevel3) {
                                 case 'wechat-config':
-                                    return <WxConfig projectID={projectID}  userID={this.state.userID} history={this.props.history} location={this.props.location}/>;
+                                    return <WxConfig trialcase={false} userID={this.state.userID} projectID={projectID} history={this.props.history} location={this.props.location}/>;
                                 case 'wechat-deploy':
-                                    return <WxDeploy trialcase={false} userID={this.state.userID} configID={configID}/>;
+                                    return <WxDeploy trialcase={false} userID={this.state.userID} projectID={projectID}/>;
                                 case 'wechat-manage':
-                                    return <Manage trialcase={false} userID={this.state.userID} configID={configID} switchMenu={this.switchMenu}/>;
+                                    return <Manage trialcase={false} userID={this.state.userID} projectID={projectID}/>;
                                 default:
                                     return <WxConfig/>
                             }

+ 128 - 16
src/app/wechatService/wxConfig/WxConfig.jsx

@@ -1,18 +1,65 @@
 import React, {Component} from 'react';
-import {Input, Spin, Button, Icon, Modal} from 'antd';
+import {Input, Spin, Button, Icon, Modal, Tooltip} from 'antd';
 import './index.css';
 import {UPDATE_WXCONFIG, SHOW_WXCONTENT, DELETE_WXCONFIG, SHOW_WXCONFIG,DELETE_PROJECT,SHOW_PROJECT} from "../../../gql";
 import gql from "graphql-tag";
 import {Mutation, Query} from "react-apollo";
 import {getCookie} from "../../../cookie";
-
+import {FormattedMessage} from 'react-intl';
 const confirm = Modal.confirm;
 
+const valueToKey = {
+    'appName': 'appName',
+    'appID': 'appID',
+    'appSecret': 'appSecret',
+    'enter_url': 'enter_url',
+    'token': 'token',
+    'welcome_words': 'welcome_words',
+    'pay_api_key': 'pay_api_key',
+    'attach': 'attach',
+    'mch_id': 'mch_id',
+    'body': 'body',
+    'spbill_create_ip': 'spbill_create_ip',
+    'notify_url': 'notify_url',
+};
+
+const toolTipTitle = {
+    'appName': 'its appName',
+    'appID': 'its appID',
+    'appSecret': 'its appSecret',
+    'enter_url': 'its enter_url',
+    'token': 'its token',
+    'welcome_words': 'its welcome_words',
+    'pay_api_key': 'its pay_api_key',
+    'attach': 'its attach',
+    'mch_id': 'its mch_id',
+    'body': 'its body',
+    'spbill_create_ip': 'its spbill_create_ip',
+    'notify_url': 'its notify_url',
+};
+
+const youMustFill = {
+    'appName': true,
+    'appID': true,
+    'appSecret': true,
+    'enter_url': true,
+    'token': true,
+    'welcome_words': true,
+    'pay_api_key': true,
+    'attach': true,
+    'mch_id': true,
+    'body': true,
+    'spbill_create_ip': true,
+    'notify_url': true,
+};
+
 class WxConfig extends Component {
     constructor(props) {
         super(props);
         this.state = {
-            configs: ['appName', 'appID', 'appSecret', 'enter_url', 'token', 'welcome_words', 'pay_api_key', 'attach', 'mch_id', 'body', 'spbill_create_ip', 'notify_url'],
+            config1s: ['appName', 'appID', 'appSecret'],
+            config2s: ['enter_url', 'token', 'welcome_words'],
+            config3s: ['pay_api_key', 'attach', 'mch_id', 'body', 'spbill_create_ip', 'notify_url'],
             configID: props.location.state === undefined ? props.defaultConfigID : props.location.state.configID,
             appName: props.location.state === undefined ? props.defaultAppName : props.location.state.appName,
             projectID: props.location.state === undefined ? props.projectID : props.location.state.projectID,
@@ -41,10 +88,12 @@ class WxConfig extends Component {
                             return 'error!';
                         }
                         let {history, location, trialcase} = this.props;
-                        let {appName, configID, configs,projectID,userID} = this.state;
+                        let {appName, configID, config1s, config2s, config3s, projectID,userID} = this.state;
                         return (
                             <Display
-                                configs={configs}
+                                config1s={config1s}
+                                config2s={config2s}
+                                config3s={config3s}
                                 userID={userID}
                                 projectID={projectID}
                                 configID={configID}
@@ -116,14 +165,77 @@ class Display extends Component {
     };
 
     render() {
-        let {configs} = this.props;
+        let {config1s, config2s, config3s} = this.props;
         let {userID,configID, appName,projectID, mch_id, notify_url, appSecret, appID, token, spbill_create_ip, enter_url, pay_api_key, body, welcome_words, attach} = this.state;
         return (
             <div>
+                <div className={'schema-name'}>
+                    <FormattedMessage id="WeChat Subscription Data"/>
+                </div>
                 {
-                    configs.map(config => (
+                    config1s.map(config => (
                         <div key={config} style={{marginBottom: 10}}>
-                            <span className='vice-title'>{config}: </span>
+                            <span className='vice-title'>
+                                {
+                                    youMustFill[config]?
+                                        <span style={{color: 'red', display: 'inline', marginRight: 10}}>*</span>
+                                        :
+                                        ''
+                                }
+                                <FormattedMessage id={valueToKey[config]}/>
+                                &nbsp;
+                                <Tooltip placement="top" title={toolTipTitle[config]}>
+                                    <Icon type="question-circle"/>
+                                </Tooltip>
+                            </span>
+                            <Input value={this.state[config]} style={{width: 200}}
+                                   onChange={this.switchConfig(config)}/>
+                        </div>
+                    ))
+                }
+                <div className={'schema-name'}>
+                    <FormattedMessage id="Server configurations"/>
+                </div>
+                {
+                    config2s.map(config => (
+                        <div key={config} style={{marginBottom: 10}}>
+                            <span className='vice-title'>
+                                {
+                                    youMustFill[config]?
+                                        <span style={{color: 'red', display: 'inline', marginRight: 10}}>*</span>
+                                        :
+                                        ''
+                                }
+                                <FormattedMessage id={valueToKey[config]}/>
+                                &nbsp;
+                                <Tooltip placement="top" title={toolTipTitle[config]}>
+                                    <Icon type="question-circle"/>
+                                </Tooltip>
+                            </span>
+                            <Input value={this.state[config]} style={{width: 200}}
+                                   onChange={this.switchConfig(config)}/>
+                        </div>
+                    ))
+                }
+                <div className={'schema-name'}>
+                    <FormattedMessage id="Pay configurations"/>
+                </div>
+                {
+                    config3s.map(config => (
+                        <div key={config} style={{marginBottom: 10}}>
+                            <span className='vice-title'>
+                                {
+                                    youMustFill[config]?
+                                        <span style={{color: 'red', display: 'inline', marginRight: 10}}>*</span>
+                                        :
+                                        ''
+                                }
+                                <FormattedMessage id={valueToKey[config]}/>
+                                &nbsp;
+                                <Tooltip placement="top" title={toolTipTitle[config]}>
+                                    <Icon type="question-circle"/>
+                                </Tooltip>
+                            </span>
                             <Input value={this.state[config]} style={{width: 200}}
                                    onChange={this.switchConfig(config)}/>
                         </div>
@@ -149,12 +261,12 @@ class Display extends Component {
                                 welcome_words={welcome_words}
                                 attach={attach}
                             />
-                            <DeleteWXProjectButton
-                                id={configID}
-                                userID={userID}
-                                projectID={projectID}
-                                history={this.props.history}
-                            />
+                            {/*<DeleteWXProjectButton*/}
+                                {/*id={configID}*/}
+                                {/*userID={userID}*/}
+                                {/*projectID={projectID}*/}
+                                {/*history={this.props.history}*/}
+                            {/*/>*/}
                         </div>
 
                 }
@@ -198,7 +310,7 @@ class UpdateWXConfigButton extends Component {
                                     updatedAt: new Date().getTime()
                                 }
                             });
-                        }}>save</Button>
+                        }}><FormattedMessage id="save"/></Button>
                     )
                 }}
             </Mutation>
@@ -249,7 +361,7 @@ class DeleteWXProjectButton extends Component {
                             type={'danger'}
                             onClick={() => {
                                 this.showConfirm(delete_wx_project, projectID, userID);
-                            }}>delete</Button>
+                            }}><FormattedMessage id="delete"/></Button>
                     )
                 }}
             </Mutation>

+ 12 - 2
src/config.js

@@ -1,11 +1,21 @@
+// 全局配置
+const faasEnvironment = 'development';
+const graphqlEnvironment = 'production';
+
 // 基础配置
+const localIP = 'http://localhost';
 const serverIP = 'http://123.206.193.98';
+
+const faasIp = faasEnvironment === 'development' ? localIP : serverIP;
+const graphqlIP = graphqlEnvironment === 'development' ? localIP : serverIP;
+
 const backendPort = '8999';
 const graphqlPort = '3000';
-const backend = serverIP + ':' + backendPort;
+
+const backend = faasIp + ':' + backendPort;
 
 // graphql 配置
-const graphqlUrl = serverIP + ':' + graphqlPort + '/graphql';
+const graphqlUrl = graphqlIP + ':' + graphqlPort + '/graphql';
 
 // api 配置
 const getIdUrl = backend + '/getuserid';

+ 120 - 61
src/gql.js

@@ -190,9 +190,9 @@ const UPDATE_SCHEMA = `
         `;
 
 const UPDATE_SCHEMA_PROJECT_NAME = `
-            mutation UPDATE_SCHEMA_PROJECT_NAME($id: ID!, $schemaName: String, $updatedAt: String) {
+            mutation UPDATE_SCHEMA_PROJECT_NAME($schemaID: ID!, $projectID: ID, $schemaName: String, $updatedAt: String) {
                 update_schema(
-                    id: $id,
+                    id: $schemaID,
                     updatedAt: $updatedAt,
                     schemaName: $schemaName,
                 ) {
@@ -202,7 +202,7 @@ const UPDATE_SCHEMA_PROJECT_NAME = `
                 }
                 
                 update_project(
-                    schema_id: $id,
+                    id: $projectID,
                     updatedAt: $updatedAt,
                     projectName: $schemaName,
                 ){
@@ -489,25 +489,6 @@ const UPDATE_CLOUD = `
     `;
 
 
-const SHOW_DEPLOY = `
-            query DEPLOY($cloud_id: ID!) {
-                deploy_by_props(cloud_id: $cloud_id) {
-                    id
-                    functionName
-                    region
-                    description
-                    cosBucketName
-                    cosObjectName
-                    cosBucketRegion
-                    handler
-                    memorySize
-                    timeout
-                    vpcId
-                    subnetId
-                }
-            }
-        `;
-
 const ADD_DEPLOY = `
             mutation DEPLOY($serviceName:String, $description: String, $updatedAt: String, $cosBucketName: String, $memorySize: Int, $fc_id: ID, $createdAt: String, $subnetId: String, $cosObjectName: String, $region: String, $vpcId: String, $cosBucketRegion: String, $id: ID!, $cloud_id: ID, $user_id: ID, $timeout: Int, $handler: String, $functionName: String) {
                 create_deploy(
@@ -555,19 +536,6 @@ const UPDATE_DEPLOY = `
             }
         `;
 
-const SHOW_APIGWGROUP = `
-            query GROUP($schema_id: ID!) {
-                apiGWGroup_by_props(schema_id: $schema_id) {
-                    id
-                    groupName
-                    region
-                    frontType
-                    defaultDomain
-                    userStatus
-                    userDomain
-                }
-            }
-        `;
 
 const ADD_APIGROUP = `
             mutation GROUP($serviceId: String, $environmentName: String, $userStatus: String, $defaultDomain: String, $updatedAt: String, $userDomain: String, $groupName: String, $createdAt: String, $frontType: String, $region: String, $status: String, $id: ID!, $cloud_id: ID, $user_id: ID) {
@@ -659,27 +627,6 @@ const UPDATE_APIGWPATH = `
         `;
 
 
-const SHOW_FC_SCHEMA = `
-            query FC($schema_id: ID!) {
-                fc_by_props(schema_id: $schema_id) {
-                    cloud_id {
-                        id
-                        cloudName
-                    }
-                }
-            }
-        `;
-
-const SHOW_FC_CONFIG = `
-            query FC($wxConfig_id: ID!) {
-                fc_by_props(wxConfig_id: $wxConfig_id) {
-                    cloud_id {
-                        id
-                        cloudName
-                    }
-                }
-            }
-        `;
 
 const SHOW_ALL_WXCONFIG = `
             query WXCONFIG($user_id: ID) {
@@ -885,6 +832,7 @@ const GET_PROJECT = `
                         id
                     }
                     wxConfig_id {
+                      id
                       updatedAt
                       mch_id
                       appName
@@ -914,6 +862,120 @@ const GET_PROJECT = `
                 }
         `;
 
+const UPDATE_PROJECT = `
+            mutation updateproject($id: ID, $updatedAt: String, $database_id: ID, $apiGWGroup_id: ID, $createdAt: String, $projectName: String, $deploy_id: ID, $projectType: String, $cloud_id: ID, $user_id: ID, $wxConfig_id: ID, $schema_id: ID) {
+              update_project(id: $id updatedAt: $updatedAt database_id: $database_id apiGWGroup_id: $apiGWGroup_id createdAt: $createdAt projectName: $projectName deploy_id: $deploy_id projectType: $projectType cloud_id: $cloud_id user_id: $user_id wxConfig_id: $wxConfig_id schema_id: $schema_id) {
+                updatedAt
+                database_id {
+                  dbPort
+                  updatedAt
+                  dbHost
+                  dbUsername
+                  dbPassword
+                  createdAt
+                  id
+            
+            
+                  dbName
+                }
+                apiGWGroup_id {
+                  environmentName
+                  userStatus
+                  defaultDomain
+                  updatedAt
+                  userDomain
+                  groupName
+                  createdAt
+                  frontType
+                  region
+                  serviceId
+                  status
+                  id
+            
+                }
+                createdAt
+                projectName
+                deploy_id {
+                  description
+                  updatedAt
+                  cosBucketName
+                  memorySize
+            
+                  createdAt
+                  subnetId
+                  cosObjectName
+                  region
+                  vpcId
+                  cosBucketRegion
+                  id
+            
+            
+                  serviceName
+                  timeout
+                  handler
+                  functionName
+                }
+                id
+                projectType
+                cloud_id {
+                  id
+            
+                  cloudName
+                  secretId
+                  secretKey
+                  appId
+                  createdAt
+                  updatedAt
+                }
+                user_id {
+                  email
+                  updatedAt
+                  password
+                  telephone
+                  nickname
+                  username
+                  createdAt
+                  openid
+                  id
+                  avatar
+                }
+                wxConfig_id {
+                  updatedAt
+                  mch_id
+                  appName
+                  notify_url
+                  appSecret
+                  createdAt
+                  appID
+                  token
+                  spbill_create_ip
+                  enter_url
+                  id
+                  pay_api_key
+            
+                  body
+                  welcome_words
+                  attach
+                }
+                schema_id {
+                  updatedAt
+                  schemaState
+                  authWrite
+                  authReadObjects
+                  createdAt
+                  authRead
+                  schemaName
+                  reference
+                  id
+                  schemaData
+                  authReadWrite
+            
+                  authWriteObjects
+                }
+              }
+            }
+        `;
+
 export {
     ADD_USER,
     GET_USER,
@@ -935,17 +997,13 @@ export {
     ADD_CLOUD,
     SHOW_CLOUD,
     UPDATE_CLOUD,
-    SHOW_DEPLOY,
     ADD_DEPLOY,
     UPDATE_DEPLOY,
-    SHOW_APIGWGROUP,
     ADD_APIGROUP,
     UPDATE_APIGROUP,
     SHOW_APIGWPATH,
     ADD_APIGWPATH,
     UPDATE_APIGWPATH,
-    SHOW_FC_SCHEMA,
-    SHOW_FC_CONFIG,
     ADD_PROJECT_AND_WX,
     SHOW_ALL_WXCONFIG,
     SHOW_WXCONFIG,
@@ -953,5 +1011,6 @@ export {
     SHOW_WXCONTENT,
     UPDATE_WXCONFIG,
     DELETE_WXCONFIG,
-    GET_PROJECT
+    GET_PROJECT,
+    UPDATE_PROJECT
 }

+ 27 - 1
src/language/en_US.js

@@ -53,12 +53,19 @@ const en_US = {
     'subnetId': 'subnetId',
     'vpcId': 'vpcId',
 
+    'service manage':'Service manage',
+    'API manage':'API manage',
     'groupName': 'group name',
     'environmentName': 'deploy environment',
     'defaultDomain': 'default domain',
     'frontType': 'front type',
     'userDomain': 'custom domain',
     'userStatus': 'open/close',
+    'operation':'operation',
+    'No deploy':'No deploy',
+    'method':'method',
+    'path':'path',
+    'try':'try',
 
     'apiGWName': 'api gateway group name',
     'apiGWDesc': 'api gateway group description',
@@ -116,6 +123,25 @@ const en_US = {
     'login failed': 'login filed',
     'relogin': 'relogin',
     'nickname': 'nickname',
-    'username has been used': 'username has been used, please change one'
+    'username has been used': 'username has been used, please change one',
+
+
+    // 微信
+    'WeChat Subscription Data': 'WeChat Subscription Data',
+    'Server configurations': 'Server configurations',
+    'Pay configurations': 'Pay configurations',
+
+    'appName': 'App Name',
+    'appID': 'App ID',
+    'appSecret': 'App Secret',
+    'enter_url': 'Server URL',
+    'token': 'token',
+    'welcome_words': 'welcome words',
+    'pay_api_key': 'pay api key',
+    'attach': 'attach',
+    'mch_id': 'mch id',
+    'body': 'body',
+    'spbill_create_ip': 'spbill_create ip',
+    'notify_url': 'notify url',
 };
 export default en_US;

+ 25 - 0
src/language/zh_CN.js

@@ -53,12 +53,19 @@ const zh_CN = {
     'subnetId': '所在子网',
     'vpcId': '所属网络',
 
+    'service manage':'服务管理',
+    'API manage':'API管理',
     'groupName': '服务名称',
     'environmentName': '发布环境',
     'defaultDomain': '默认域名',
     'frontType': '前端类型',
     'userDomain': '自定义域名',
     'userStatus': '开启状态',
+    'operation':'操作',
+    'No deploy':'尚未部署',
+    'method':'方法',
+    'path':'路径',
+    'try':'调试',
 
     'apiGWName': 'API名称',
     'apiGWDesc': 'API描述',
@@ -118,5 +125,23 @@ const zh_CN = {
     'relogin': '重新登录',
     'nickname': '昵称',
     'username has been used': '用户名已被占用,请更换',
+
+    // 微信
+    'WeChat Subscription Data': '公众号开发信息',
+    'Server configurations': '服务器配置',
+    'Pay configurations': '支付配置',
+
+    'appName': 'APP 名称',
+    'appID': 'App ID',
+    'appSecret': 'App Secret',
+    'enter_url': '服务器地址',
+    'token': '令牌',
+    'welcome_words': '关注回复语',
+    'pay_api_key': '商户平台 API key',
+    'attach': '附加数据',
+    'mch_id': '商户号',
+    'body': '商品描述',
+    'spbill_create_ip': '终端 IP',
+    'notify_url': '支付通知地址',
 };
 export default zh_CN;