wly il y a 7 ans
Parent
commit
6e64d9c590

+ 38 - 16
src/app/App.jsx

@@ -23,7 +23,7 @@ import WxCreate from "./wechatService/wxCreate/WxCreate";
 
 import {SHOW_ALL_SCHEMA, SHOW_ALL_WXCONFIG} from "../gql";
 import axios from 'axios';
-import {getCookie} from "../cookie";
+import {getCookie, setCookie} from "../cookie";
 
 axios.defaults.withCredentials = true;
 
@@ -56,6 +56,19 @@ class App extends Component {
                 this.setState({sideBar: urlList[3]});
             }
         }
+
+        let userID = getCookie('user_id');
+        if (userID === undefined || '') {
+            axios.get(this.state.getIdUrl)
+                .then((res) => {
+                    if (res.data !== '') {
+                        setCookie("user_id", res.data);
+                    }
+                })
+                .catch(function (err) {
+                    console.log(err);
+                });
+        }
     }
 
     onCollapse = (collapsed) => {
@@ -163,14 +176,15 @@ class App extends Component {
                                 <Link to="/wechat-service/trial-case/index"><FormattedMessage
                                     id="Wechat Service"/></Link>
                             </Menu.Item>
-                            <Menu.Item key="quant-service">
-                                <Link to="/quant-service/trial-case/index"><FormattedMessage id="Quantization Service"/></Link>
-                            </Menu.Item>
+                            {/*<Menu.Item key="quant-service">*/}
+                                {/*<Link to="/quant-service/trial-case/index"><FormattedMessage id="Quantization Service"/></Link>*/}
+                            {/*</Menu.Item>*/}
                         </Menu>
 
                         <Link to="/login">
                             <Button className='login-button' type='primary'
-                                    onClick={() => this.switchMenuLevel('menuLevel1', 'user')}>Login</Button>
+                                    onClick={() => this.switchMenuLevel('menuLevel1', 'user')}>
+                                <FormattedMessage id="Login"/></Button>
                         </Link>
 
                         <div className="change-locale">
@@ -248,7 +262,7 @@ class App extends Component {
                                                 <a href="https://ioobot-document.netlify.com/" title="instructions"
                                                    target="instructions">
                                                     <Icon type="file-text" theme="twoTone"/>
-                                                    <span>Instructions</span>
+                                                    <span><FormattedMessage id="Instructions"/></span>
                                                 </a>
                                             </Menu.Item>
                                         </Menu>
@@ -279,13 +293,13 @@ class App extends Component {
                                         >
                                             <Menu.Item key="account">
                                                 <Icon type="setting" theme="twoTone"/>
-                                                <span>Account center</span>
+                                                <span><FormattedMessage id="Account center"/></span>
                                                 <Link to="/login/account"/>
                                             </Menu.Item>
 
                                             <Menu.Item key="cloud-settings">
                                                 <Icon type="cloud" theme="twoTone"/>
-                                                <span>Cloud settings</span>
+                                                <span><FormattedMessage id="Cloud settings"/></span>
                                                 <Link to="/login/cloud"/>
                                             </Menu.Item>
                                         </Menu>
@@ -372,7 +386,9 @@ class GraphqlSidebar extends Component {
                                     position: 'fixed'
                                 }}
                             >
-                                <SubMenu key="trial-case" title={<span><Icon type="appstore" theme="twoTone"/><span>Case Show</span></span>}>
+                                <SubMenu key="trial-case" title={<span><Icon type="appstore" theme="twoTone"/><span>
+                                    <FormattedMessage id="Case Show"/>
+                                </span></span>}>
                                     {
                                         data.caseSchema.map((schema) =>
                                             <Menu.Item key={schema.schemaName}>
@@ -389,7 +405,7 @@ class GraphqlSidebar extends Component {
 
                                 <Menu.Item key="create-graphql" onClick={this.props.showModal}>
                                     <Icon type="edit" theme="twoTone"/>
-                                    <span>Create</span>
+                                    <span><FormattedMessage id="Create"/></span>
                                     <Icon type="plus" style={{
                                         position: 'absolute',
                                         top: '35%',
@@ -398,7 +414,9 @@ class GraphqlSidebar extends Component {
                                     }}/>
                                 </Menu.Item>
 
-                                <SubMenu key="my-create" title={<span><Icon type="user" theme="outlined"/><span>My Create</span></span>}>
+                                <SubMenu key="my-create" title={<span><Icon type="user" theme="outlined"/><span>
+                                    <FormattedMessage id="My Create"/>
+                                </span></span>}>
                                     {
                                         data.userSchema.map((schema) =>
                                             <Menu.Item key={schema.schemaName}>
@@ -417,7 +435,7 @@ class GraphqlSidebar extends Component {
                                     <a href="https://ioobot-document.netlify.com/" title="instructions" target="_blank"
                                        rel="noopener noreferrer">
                                         <Icon type="file-text" theme="twoTone"/>
-                                        <span>Instructions</span>
+                                        <span><FormattedMessage id="Instructions"/></span>
                                     </a>
                                 </Menu.Item>
 
@@ -465,7 +483,9 @@ class WxConfigSiderbar extends Component {
                                     position: 'fixed'
                                 }}
                             >
-                                <SubMenu key="trial-case" title={<span><Icon type="appstore" theme="twoTone"/><span>Case Show</span></span>}>
+                                <SubMenu key="trial-case" title={<span><Icon type="appstore" theme="twoTone"/>
+                                    <span><FormattedMessage id="Case Show"/></span>
+                                </span>}>
                                     {
                                         data.caseWxConfig.map((config) =>
                                             <Menu.Item key={config.appName}>
@@ -482,7 +502,7 @@ class WxConfigSiderbar extends Component {
 
                                 <Menu.Item key="create-config" onClick={this.props.wxShowModal}>
                                     <Icon type="edit" theme="twoTone"/>
-                                    <span>Create</span>
+                                    <span><FormattedMessage id="Create"/></span>
                                     <Icon type="plus" style={{
                                         position: 'absolute',
                                         top: '35%',
@@ -491,7 +511,9 @@ class WxConfigSiderbar extends Component {
                                     }}/>
                                 </Menu.Item>
 
-                                <SubMenu key="my-create" title={<span><Icon type="user" theme="outlined"/><span>My Create</span></span>}>
+                                <SubMenu key="my-create" title={<span><Icon type="user" theme="outlined"/>
+                                    <span><FormattedMessage id="My Create"/></span>
+                                </span>}>
                                     {
                                         data.userWxConfig.map((config) =>
                                             <Menu.Item key={config.appName}>
@@ -510,7 +532,7 @@ class WxConfigSiderbar extends Component {
                                     <a href="https://ioobot-document.netlify.com/" title="instructions" target="_blank"
                                        rel="noopener noreferrer">
                                         <Icon type="file-text" theme="twoTone"/>
-                                        <span>Instructions</span>
+                                        <span><FormattedMessage id="Instructions"/></span>
                                     </a>
                                 </Menu.Item>
 

+ 108 - 77
src/app/common/deploy/Deploy.jsx

@@ -1,5 +1,6 @@
 import React, {Component} from 'react';
-import {Card, Input} from 'antd';
+import {FormattedMessage} from 'react-intl';
+import {Card, Spin} from 'antd';
 
 import TencentConfig from './tencent/TencentConfig';
 import AliConfig from './ali/AliConfig';
@@ -8,20 +9,24 @@ import AmazonConfig from './amazon/AmazonConfig';
 import './index.css';
 import {SHOW_FC_SCHEMA, SHOW_FC_CONFIG, SEARCH_SCHEMA, SHOW_CLOUD, SHOW_WXCONTENT} from "../../../gql";
 import {request} from 'graphql-request'
-
 import {graphqlUrl} from "../../../config";
 
 const tabListNoTitle = [{
     key: 'tencent',
-    tab: 'Tencent',
-}, {
-    key: 'aliyun',
-    tab: 'Aliyun',
-}, {
-    key: 'amazon',
-    tab: 'AWS',
+    tab: <FormattedMessage id='Tencent'/>,
 }];
 
+// [{
+//     key: 'tencent',
+//     tab: <FormattedMessage id='Tencent'/>,
+// }, {
+//     key: 'aliyun',
+//     tab: <FormattedMessage id='Aliyun'/>,
+// }, {
+//     key: 'amazon',
+//     tab: <FormattedMessage id='AWS'/>,
+// }];
+
 
 class Deploy extends Component {
     constructor(props) {
@@ -50,6 +55,8 @@ class Deploy extends Component {
         }, this.fetch)
     }
 
+
+
     fetch = () => {
         if (this.state.schemaID !== '' && this.state.schemaID !== undefined) {
             request(graphqlUrl, SHOW_FC_SCHEMA, {schema_id: this.state.schemaID}).then(
@@ -62,39 +69,51 @@ class Deploy extends Component {
                                 // 如果没有 fc,根据 userID 查 cloudId
                                 request(graphqlUrl, SHOW_CLOUD, {user_id: this.props.userID}).then(
                                     __data => {
-                                        __data.cloud_by_props.forEach(cloud => {
-                                            switch (cloud.cloudName) {
-                                                case 'tencent':
-                                                    this.setState({
-                                                        tencentFC: false,
-                                                        tencentCloudID: cloud.id,
-                                                        defalutName: _data.schema_by_id.schemaName,
-                                                        show: true,
-                                                        kind: 'graphql'
-                                                    });
-                                                    break;
-                                                case 'aliyun':
-                                                    this.setState({
-                                                        aliyunFC: false,
-                                                        aliyunCloudID: cloud.id,
-                                                        defalutName: _data.schema_by_id.schemaName,
-                                                        show: true,
-                                                        kind: 'graphql'
-                                                    });
-                                                    break;
-                                                case 'amazon':
-                                                    this.setState({
-                                                        amazonFC: false,
-                                                        amazonCloudID: cloud.id,
-                                                        defalutName: _data.schema_by_id.schemaName,
-                                                        show: true,
-                                                        kind: 'graphql'
-                                                    });
-                                                    break;
-                                                default:
-                                                    break;
-                                            }
-                                        })
+                                        // 如果 user 未设置 cloudID
+                                        if(__data.cloud_by_props.length === 0) {
+                                            this.setState({
+                                                tencentFC: false,
+                                                aliyunFC: false,
+                                                amazonFC: false,
+                                                defalutName: _data.schema_by_id.schemaName,
+                                                show: true,
+                                                kind: 'graphql'
+                                            });
+                                        } else {
+                                            __data.cloud_by_props.forEach(cloud => {
+                                                switch (cloud.cloudName) {
+                                                    case 'tencent':
+                                                        this.setState({
+                                                            tencentFC: false,
+                                                            tencentCloudID: cloud.id,
+                                                            defalutName: _data.schema_by_id.schemaName,
+                                                            show: true,
+                                                            kind: 'graphql'
+                                                        });
+                                                        break;
+                                                    case 'aliyun':
+                                                        this.setState({
+                                                            aliyunFC: false,
+                                                            aliyunCloudID: cloud.id,
+                                                            defalutName: _data.schema_by_id.schemaName,
+                                                            show: true,
+                                                            kind: 'graphql'
+                                                        });
+                                                        break;
+                                                    case 'amazon':
+                                                        this.setState({
+                                                            amazonFC: false,
+                                                            amazonCloudID: cloud.id,
+                                                            defalutName: _data.schema_by_id.schemaName,
+                                                            show: true,
+                                                            kind: 'graphql'
+                                                        });
+                                                        break;
+                                                    default:
+                                                        break;
+                                                }
+                                            })
+                                        }
                                     }
                                 );
                             } else {
@@ -145,39 +164,51 @@ class Deploy extends Component {
                                 // 如果没有 fc,根据 userID 查 cloudId
                                 request(graphqlUrl, SHOW_CLOUD, {user_id: this.props.userID}).then(
                                     __data => {
-                                        __data.cloud_by_props.forEach(cloud => {
-                                            switch (cloud.cloudName) {
-                                                case 'tencent':
-                                                    this.setState({
-                                                        tencentFC: false,
-                                                        tencentCloudID: cloud.id,
-                                                        defalutName: _data.wxConfig_by_id.appName,
-                                                        show: true,
-                                                        kind: 'wx'
-                                                    });
-                                                    break;
-                                                case 'aliyun':
-                                                    this.setState({
-                                                        aliyunFC: false,
-                                                        aliyunCloudID: cloud.id,
-                                                        defalutName: _data.wxConfig_by_id.appName,
-                                                        show: true,
-                                                        kind: 'wx'
-                                                    });
-                                                    break;
-                                                case 'amazon':
-                                                    this.setState({
-                                                        amazonFC: false,
-                                                        amazonCloudID: cloud.id,
-                                                        defalutName: _data.wxConfig_by_id.appName,
-                                                        show: true,
-                                                        kind: 'wx'
-                                                    });
-                                                    break;
-                                                default:
-                                                    break;
-                                            }
-                                        })
+                                        // 如果 user 未设置 cloudID
+                                        if(__data.cloud_by_props.length === 0) {
+                                            this.setState({
+                                                tencentFC: false,
+                                                aliyunFC: false,
+                                                amazonFC: false,
+                                                defalutName: _data.wxConfig_by_id.appName,
+                                                show: true,
+                                                kind: 'wx'
+                                            });
+                                        } else {
+                                            __data.cloud_by_props.forEach(cloud => {
+                                                switch (cloud.cloudName) {
+                                                    case 'tencent':
+                                                        this.setState({
+                                                            tencentFC: false,
+                                                            tencentCloudID: cloud.id,
+                                                            defalutName: _data.wxConfig_by_id.appName,
+                                                            show: true,
+                                                            kind: 'wx'
+                                                        });
+                                                        break;
+                                                    case 'aliyun':
+                                                        this.setState({
+                                                            aliyunFC: false,
+                                                            aliyunCloudID: cloud.id,
+                                                            defalutName: _data.wxConfig_by_id.appName,
+                                                            show: true,
+                                                            kind: 'wx'
+                                                        });
+                                                        break;
+                                                    case 'amazon':
+                                                        this.setState({
+                                                            amazonFC: false,
+                                                            amazonCloudID: cloud.id,
+                                                            defalutName: _data.wxConfig_by_id.appName,
+                                                            show: true,
+                                                            kind: 'wx'
+                                                        });
+                                                        break;
+                                                    default:
+                                                        break;
+                                                }
+                                            })
+                                        }
                                     }
                                 );
                             } else {
@@ -222,7 +253,7 @@ class Deploy extends Component {
 
     render() {
         const contentListNoTitle = {
-            tencent: <TencentConfig cloudID={this.state.tencentCloudID} fc={this.state.tencentFC} defalutName={this.state.defalutName} userID={this.props.userID} kind={this.state.kind}/>,
+            tencent: <TencentConfig configID={this.state.configID} schemaID={this.state.schemaID} cloudID={this.state.tencentCloudID} fc={this.state.tencentFC} defalutName={this.state.defalutName} userID={this.props.userID} kind={this.state.kind} trialcase={this.props.trialcase}/>,
             aliyun: <AliConfig/>,
             amazon: <AmazonConfig/>,
         };
@@ -244,7 +275,7 @@ class Deploy extends Component {
                             this.state.show ?
                                 contentListNoTitle[this.state.cloud]
                                 :
-                                "waiting, if long, checkout your internet or did u forget cloud id and secret config when login"
+                                <Spin/>
                         }
                     </Card>
                 </div>

+ 1 - 1
src/app/common/deploy/index.css

@@ -40,7 +40,7 @@ p.show {
 
 .cloud-name {
     font-weight: bold;
-    font-size: large;
+    font-size: medium;
     display: block;
     height: 35px;
 }

+ 53 - 19
src/app/common/deploy/tencent/APIGroupCard.js

@@ -4,10 +4,22 @@ import {ADD_APIGROUP, UPDATE_APIGROUP} from "../../../../gql";
 import {request} from 'graphql-request'
 import {idGen} from "../../../../func";
 import {graphqlUrl} from "../../../../config";
-
+import {manageUsers} from "../../../../config";
+import {FormattedMessage} from 'react-intl';
 const Panel = Collapse.Panel;
 
-
+// 如需改变显示,请在此处 value 处更改
+// 如需添加中文,请在此处 value 处添加
+// eg: 'xxxx': <F..  id='xxx'/>
+const valueToKey = {
+    'groupName': 'Name',
+    'environmentName': 'environmentName',
+    'defaultDomain': 'defaultDomain',
+    'frontType': 'frontType',
+    'userDomain': 'userDomain',
+    'userStatus': 'userStatus',
+    'region': 'region',
+};
 
 class APIGroupCard extends Component {
     constructor(props) {
@@ -27,7 +39,7 @@ class APIGroupCard extends Component {
             :
             this.state = {
                 showOK: false,
-                groupName: 'graphql-endpoint',
+                groupName: 'graphql_endpoint',
                 environmentName: 'test',
                 defaultDomain: '',
                 frontType: 'http&https',
@@ -51,7 +63,7 @@ class APIGroupCard extends Component {
             })
         } else {
             this.setState ( {
-                groupName: 'graphql-endpoint',
+                groupName: 'graphql_endpoint',
                 environmentName: 'test',
                 defaultDomain: '',
                 frontType: 'http&https',
@@ -146,12 +158,12 @@ class APIGroupCard extends Component {
                 <Collapse bordered={false}>
                     <Panel header="Want more options?" style={customPanelStyle}>
                         <div style={{marginBottom: 10}}>
-                            <span className='vice-title'>groupName: </span>
+                            <span className='vice-title'>{valueToKey['groupName']}: </span>
                             <Input value={this.state.groupName} style={{width: 400}}
                                    onChange={this.switchConfig('groupName')}/>
                         </div>
                         <div style={{marginBottom: 10}}>
-                            <span className='vice-title'>region: </span>
+                            <span className='vice-title'>{valueToKey['region']}: </span>
                             <Radio.Group onChange={this.switchConfig('groupRegion')} value={this.state.groupRegion} buttonStyle="solid">
                                 <Radio.Button value="guangzhou">Guangzhou</Radio.Button>
                                 <Radio.Button value="shanghai">Shanghai</Radio.Button>
@@ -160,7 +172,7 @@ class APIGroupCard extends Component {
                             </Radio.Group>
                         </div>
                         <div style={{marginBottom: 10}}>
-                            <span className='vice-title'>frontType: </span>
+                            <span className='vice-title'>{valueToKey['frontType']}: </span>
                             <Radio.Group onChange={this.switchConfig('frontType')} defaultValue={this.state.frontType}
                                          buttonStyle="solid">
                                 <Radio.Button value="http">http</Radio.Button>
@@ -169,11 +181,11 @@ class APIGroupCard extends Component {
                             </Radio.Group>
                         </div>
                         <div style={{marginBottom: 10}}>
-                            <span className='vice-title'>defaultDomain: </span>
+                            <span className='vice-title'>{valueToKey['defaultDomain']}: </span>
                             <Input value={this.state.defaultDomain} style={{width: 400}} disabled/>
                         </div>
                         <div style={{marginBottom: 10}}>
-                            <span className='vice-title'>environmentName: </span>
+                            <span className='vice-title'>{valueToKey['environmentName']}: </span>
                             <Radio.Group onChange={this.switchConfig('environmentName')} defaultValue={this.state.environmentName}
                                          buttonStyle="solid">
                                 <Radio.Button value="test">test</Radio.Button>
@@ -182,12 +194,12 @@ class APIGroupCard extends Component {
                             </Radio.Group>
                         </div>
                         <div style={{marginBottom: 10}}>
-                            <span className='vice-title'>userDomain: </span>
+                            <span className='vice-title'>{valueToKey['userDomain']}: </span>
                             <Input value={this.state.userDomain} style={{width: 400}}
                                    onChange={this.switchConfig('userDomain')}/>
                         </div>
                         <div style={{marginBottom: 10}}>
-                            <span className='vice-title'>userStatus: </span>
+                            <span className='vice-title'>{valueToKey['userStatus']}: </span>
                             <Radio.Group onChange={this.switchConfig('userStatus')} defaultValue={this.state.userStatus}
                                          buttonStyle="solid">
                                 <Radio.Button value="open">open</Radio.Button>
@@ -196,16 +208,38 @@ class APIGroupCard extends Component {
                         </div>
                     </Panel>
                 </Collapse>
-                <Button onClick={()=>{
-                    const id = idGen('group');
-                    this.ok(id);
-                    this.props.pass(id, 'group');
-                }} type='primary'>ok</Button>
                 {
-                    this.state.showOK === true?
-                        <Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a"/>
+                    manageUsers.includes(this.props.userID)?
+                        <div>
+                            <Button onClick={()=>{
+                                const id = idGen('group');
+                                this.ok(id);
+                                this.props.pass(id, 'group');
+                            }} type='primary'>save</Button>
+                            {
+                                this.state.showOK === true?
+                                    <Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a"/>
+                                    :
+                                    ''
+                            }
+                        </div>
                         :
-                        ''
+                        this.props.trialcase?
+                            ''
+                            :
+                            <div>
+                                <Button onClick={()=>{
+                                    const id = idGen('group');
+                                    this.ok(id);
+                                    this.props.pass(id, 'group');
+                                }} type='primary'>save</Button>
+                                {
+                                    this.state.showOK === true?
+                                        <Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a"/>
+                                        :
+                                        ''
+                                }
+                            </div>
                 }
             </div>
         )

+ 34 - 7
src/app/common/deploy/tencent/APIPathCard.js

@@ -4,10 +4,18 @@ import {request} from 'graphql-request'
 import {ADD_APIGWPATH, UPDATE_APIGWPATH} from "../../../../gql";
 import {idGen} from "../../../../func";
 import {graphqlUrl} from "../../../../config";
+import {manageUsers} from "../../../../config";
 
 const Panel = Collapse.Panel;
 
-
+// 如需改变显示,请在此处 value 处更改
+// 如需添加中文,请在此处 value 处添加
+// eg: 'xxxx': <F..  id='xxx'/>
+const valueToKey = {
+    'apiGWName': 'Name',
+    'apiGWDesc': 'Description',
+    'requestMethod': 'Method'
+};
 
 class APIPathCard extends Component {
     constructor(props) {
@@ -133,14 +141,14 @@ class APIPathCard extends Component {
                         {
                             this.state.configs.map(config => (
                                 <div key={config} style={{marginBottom: 10}}>
-                                    <span className='vice-title'>{config}: </span>
+                                    <span className='vice-title'>{valueToKey[config]}: </span>
                                     <Input value={this.state[config]} style={{width: 200}}
                                            onChange={this.switchConfig(config)}/>
                                 </div>
                             ))
                         }
                         <div style={{marginBottom: 10}}>
-                            <span className='vice-title'>requestMethod: </span>
+                            <span className='vice-title'>{valueToKey['requestMethod']}: </span>
                             <Radio.Group onChange={this.switchConfig('requestMethod')}
                                          defaultValue={this.state.requestMethod}
                                          buttonStyle="solid">
@@ -150,13 +158,32 @@ class APIPathCard extends Component {
                         </div>
                     </Panel>
                 </Collapse>
-                <Button onClick={this.ok} type='primary'>ok</Button>
                 {
-                    this.state.showOK === true?
-                        <Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a"/>
+                    manageUsers.includes(this.props.userID) ?
+                        <div>
+                            <Button onClick={this.ok} type='primary'>save</Button>
+                            {
+                                this.state.showOK === true?
+                                    <Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a"/>
+                                    :
+                                    ''
+                            }
+                        </div>
                         :
-                        ''
+                        this.props.trialcase?
+                            ''
+                            :
+                            <div>
+                                <Button onClick={this.ok} type='primary'>save</Button>
+                                {
+                                    this.state.showOK === true?
+                                        <Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a"/>
+                                        :
+                                        ''
+                                }
+                            </div>
                 }
+
             </div>
         )
     }

+ 56 - 19
src/app/common/deploy/tencent/DeployCard.js

@@ -4,19 +4,33 @@ import {ADD_DEPLOY, UPDATE_DEPLOY} from "../../../../gql";
 import {request} from 'graphql-request'
 import {idGen} from "../../../../func";
 import {graphqlUrl} from "../../../../config";
+import {manageUsers} from "../../../../config";
 
 const Panel = Collapse.Panel;
 
-
+// 如需改变显示,请在此处 value 处更改
+// 如需添加中文,请在此处 value 处添加
+// eg: 'xxxx': <F..  id='xxx'/>
+const valueToKey = {
+    'functionName': 'Name',
+    'cosBucketName': 'cosBucketName',
+    'cosObjectName': 'cosObjectName',
+    'cosBucketRegion': 'cosBucketRegion',
+    'serviceName': 'serviceName',
+    'subnetId': 'subnetId',
+    'vpcId': 'vpcId',
+    'region': 'region',
+    'description': 'description',
+};
 
 class DeployCard extends Component {
     constructor(props) {
         super(props);
-        let {functionName, cosBucketName, cosObjectName, cosBucketRegion, serviceName, vpcId, subnetId, region} = props.deploy;
+        let {functionName, cosBucketName, cosObjectName, cosBucketRegion, serviceName, vpcId, subnetId, region, description} = props.deploy;
         props.deploy !== '' ?
             this.state = {
                 configs: ['description', 'cosBucketName', 'cosObjectName', 'vpcId', 'subnetId'],
-                description: '',
+                description,
                 showOK: false,
                 functionName,
                 region,
@@ -45,8 +59,9 @@ class DeployCard extends Component {
 
     componentWillReceiveProps(next) {
         if (next.deploy !== '') {
-            let {functionName, cosBucketName, cosObjectName, cosBucketRegion, serviceName, vpcId, subnetId, region} = next.deploy;
+            let {functionName, cosBucketName, cosObjectName, cosBucketRegion, serviceName, vpcId, subnetId, region, description} = next.deploy;
             this.setState({
+                description,
                 functionName,
                 region,
                 cosBucketName,
@@ -108,7 +123,7 @@ class DeployCard extends Component {
                             showOK: true
                         })
                     }
-                    setTimeout(()=>{
+                    setTimeout(() => {
                         this.setState({
                             showOK: false
                         })
@@ -136,7 +151,7 @@ class DeployCard extends Component {
                             showOK: true
                         })
                     }
-                    setTimeout(()=>{
+                    setTimeout(() => {
                         this.setState({
                             showOK: false
                         })
@@ -158,12 +173,12 @@ class DeployCard extends Component {
         return (
             <div>
                 <div style={{marginBottom: 10}}>
-                    <span className='vice-title'>functionName: </span>
+                    <span className='vice-title'>{valueToKey['functionName']}: </span>
                     <Input value={this.state.functionName} style={{width: 400}}
                            onChange={this.switchConfig('functionName')}/>
                 </div>
                 <div style={{marginBottom: 10}}>
-                    <span className='vice-title'>region: </span>
+                    <span className='vice-title'>{valueToKey['region']}: </span>
                     <Radio.Group onChange={(e) => {
                         this.props.switchRegion(e);
                         this.setState({
@@ -179,7 +194,7 @@ class DeployCard extends Component {
                 <Collapse bordered={false}>
                     <Panel header="Want more options?" style={customPanelStyle}>
                         <div style={{marginBottom: 10}}>
-                            <span className='vice-title'>cosBucketRegion: </span>
+                            <span className='vice-title'>{valueToKey['cosBucketRegion']}: </span>
                             <Radio.Group onChange={this.switchConfig('cosBucketRegion')}
                                          value={this.state.cosBucketRegion} buttonStyle="solid">
                                 <Radio.Button value="guangzhou">Guangzhou</Radio.Button>
@@ -189,14 +204,14 @@ class DeployCard extends Component {
                             </Radio.Group>
                         </div>
                         <div style={{marginBottom: 10}}>
-                            <span className='vice-title'>serviceName: </span>
+                            <span className='vice-title'>{valueToKey['serviceName']}: </span>
                             <Input value={this.state.serviceName} style={{width: 200}} disabled
                                    onChange={this.switchConfig('serviceName')}/>
                         </div>
                         {
                             this.state.configs.map(config => (
                                 <div key={config} style={{marginBottom: 10}}>
-                                    <span className='vice-title'>{config}: </span>
+                                    <span className='vice-title'>{valueToKey[config]}: </span>
                                     <Input value={this.state[config]} style={{width: 200}}
                                            onChange={this.switchConfig(config)}/>
                                 </div>
@@ -204,16 +219,38 @@ class DeployCard extends Component {
                         }
                     </Panel>
                 </Collapse>
-                <Button onClick={()=>{
-                    const id = idGen('deploy');
-                    this.ok(id);
-                    this.props.pass(id, 'deploy');
-                }} type='primary'>ok</Button>
                 {
-                    this.state.showOK === true?
-                        <Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a"/>
+                    manageUsers.includes(this.props.userID) ?
+                        <div>
+                            <Button onClick={() => {
+                                const id = idGen('deploy');
+                                this.ok(id);
+                                this.props.pass(id, 'deploy');
+                            }} type='primary'>save</Button>
+                            {
+                                this.state.showOK === true ?
+                                    <Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a"/>
+                                    :
+                                    ''
+                            }
+                        </div>
                         :
-                        ''
+                        this.props.trialcase ?
+                            ''
+                            :
+                            <div>
+                                <Button onClick={() => {
+                                    const id = idGen('deploy');
+                                    this.ok(id);
+                                    this.props.pass(id, 'deploy');
+                                }} type='primary'>save</Button>
+                                {
+                                    this.state.showOK === true ?
+                                        <Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a"/>
+                                        :
+                                        ''
+                                }
+                            </div>
                 }
             </div>
         )

+ 15 - 3
src/app/common/deploy/tencent/NotificationCard.js

@@ -1,5 +1,6 @@
 import React, {Component} from 'react';
 import {Input, Tooltip, Icon, Button} from 'antd';
+import {manageUsers} from "../../../../config";
 
 class NotificationCard extends Component {
 
@@ -53,9 +54,20 @@ class NotificationCard extends Component {
                     {/*</div>*/}
                 {/*</div>*/}
 
-                <Button type="primary" onClick={() => {
-                    console.log('hello');
-                }}>save</Button>
+                {
+                    manageUsers.includes(this.props.userID) ?
+                        <Button type="primary" onClick={() => {
+                            console.log('hello');
+                        }}>save</Button>
+                        :
+                        this.props.trialcase?
+                            ''
+                            :
+                            <Button type="primary" onClick={() => {
+                                console.log('hello');
+                            }}>save</Button>
+                }
+
             </div>
         )
 

+ 59 - 10
src/app/common/deploy/tencent/TencentConfig.js

@@ -1,13 +1,16 @@
 import React, {Component} from 'react';
 import {Row, Col, Card, Button} from 'antd';
+import axios from 'axios';
 import APIGroupCard from './APIGroupCard';
 import APIPathCard from './APIPathCard';
 import DeployCard from './DeployCard';
 import NotificationCard from './NotificationCard';
 
-import {SHOW_DEPLOY, SHOW_APIGWGROUP, SHOW_APIGWPATH} from "../../../../gql";
+import {SHOW_DEPLOY, SHOW_APIGWGROUP, SHOW_APIGWPATH, SEARCH_SCHEMA} from "../../../../gql";
 import {request} from 'graphql-request'
-import {graphqlUrl} from "../../../../config";
+import {graphqlUrl,deployUrl} from "../../../../config";
+import {FormattedMessage} from 'react-intl';
+
 
 class TencentConfig extends Component {
     constructor(props) {
@@ -23,16 +26,20 @@ class TencentConfig extends Component {
             deployIdPassToPath: '',
             groupIdPassToPath: '',
             cloudID: props.cloudID,
-            fc: props.fc
+            fc: props.fc,
+            couldDeploy: false
         };
-        this.fetch();
     }
 
+    componentDidMount() {
+        this.fetch();
+    }
 
     componentWillReceiveProps(next) {
         this.setState({
             fc: next.fc,
-            cloudID: next.cloudID
+            cloudID: next.cloudID,
+            couldDeploy: false
         }, this.fetch);
     }
 
@@ -72,6 +79,22 @@ class TencentConfig extends Component {
                 currentPath: '',
             })
         }
+
+        if(this.props.schemaID === '' || this.props.schemaID === undefined) {
+            this.setState({
+                couldDeploy: true
+            });
+        } else {
+            request(graphqlUrl, SEARCH_SCHEMA, {id: this.props.schemaID}).then(
+                data => {
+                    if(data.schema_by_id.schemaState === 'ok')
+                        this.setState({
+                            couldDeploy: true
+                        });
+                }
+            );
+        }
+
     };
 
     pass = (value, kind) => {
@@ -91,19 +114,45 @@ class TencentConfig extends Component {
         });
     };
 
+    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);
+            });
+    };
+
     render() {
         return (
             <div>
                 <div style={{padding: '30px'}}>
                     <Row gutter={16}>
                         <Col span={14}>
-                            <Card title="Deploy" style={{marginBottom: 10}}><DeployCard deploy={this.state.currentDeploy} switchRegion={this.switchRegion} region={this.state.region} defalutName={this.props.defalutName} userID={this.props.userID} cloudID={this.props.cloudID} pass={this.pass} kind={this.props.kind}/></Card>
-                            <Card title="API Group" style={{marginBottom: 10}}><APIGroupCard group={this.state.currentGroup} switchRegion={this.switchRegion} region={this.state.region} userID={this.props.userID} cloudID={this.props.cloudID} pass={this.pass} kind={this.props.kind}/></Card>
-                            <Card title="API Path" style={{marginBottom: 10}}><APIPathCard path={this.state.currentPath} defalutName={this.props.defalutName} userID={this.props.userID} deployID={this.state.currentDeploy? this.state.currentDeploy.id : this.state.deployIdPassToPath} groupID={this.state.currentGroup? this.state.currentGroup.id : this.state.groupIdPassToPath}/></Card>
-                            <Card title="Notification"><NotificationCard userID={this.props.userID}/></Card>
+                            <FormattedMessage id="fc Deploy">{msg => <Card title={msg} style={{marginBottom: 10}}><DeployCard deploy={this.state.currentDeploy} switchRegion={this.switchRegion} region={this.state.region} defalutName={this.props.defalutName} userID={this.props.userID} cloudID={this.props.cloudID} pass={this.pass} kind={this.props.kind} trialcase={this.props.trialcase}/></Card>}</FormattedMessage>
+                            <FormattedMessage id="API Group">{msg => <Card title={msg} style={{marginBottom: 10}}><APIGroupCard group={this.state.currentGroup} switchRegion={this.switchRegion} region={this.state.region} userID={this.props.userID} cloudID={this.props.cloudID} pass={this.pass} kind={this.props.kind} trialcase={this.props.trialcase}/></Card>}</FormattedMessage>
+                            <FormattedMessage id="API Path">{msg => <Card title={msg} style={{marginBottom: 10}}><APIPathCard path={this.state.currentPath} defalutName={this.props.defalutName} userID={this.props.userID} deployID={this.state.currentDeploy? this.state.currentDeploy.id : this.state.deployIdPassToPath} groupID={this.state.currentGroup? this.state.currentGroup.id : this.state.groupIdPassToPath} trialcase={this.props.trialcase}/></Card>}</FormattedMessage>
+                            <FormattedMessage id="Notification">{msg => <Card title={msg}><NotificationCard userID={this.props.userID} trialcase={this.props.trialcase}/></Card>}</FormattedMessage>
+
+
                         </Col>
                         <Col offset={2} span={6}>
-                            <Button type='primary'>deploy it</Button>
+                            <Button type='primary' disabled={this.state.couldDeploy? '': 'disabled'} onClick={()=>this.deployFC()}><FormattedMessage id="deploy"/>!</Button>
                         </Col>
                     </Row>
                 </div>

+ 24 - 8
src/app/graphqlService/TrialCase.jsx

@@ -1,5 +1,6 @@
 import React, {Component} from 'react';
 import {Layout, Menu} from 'antd';
+import {FormattedMessage} from 'react-intl';
 
 import GenerateJs from "./component/generateJs/GenerateJs";
 import Deploy from '../common/deploy/Deploy';
@@ -8,6 +9,7 @@ import Graphql from "./component/graphql/Graphql";
 import CaseMetabase from "./component/caseMetabase/CaseMetabase";
 import Application from "./component/application/Application";
 import axios from 'axios';
+import {getIdUrl} from "../../config";
 
 axios.defaults.withCredentials = true;
 
@@ -29,6 +31,20 @@ class TrialCase extends Component {
         });
     };
 
+    componentWillMount() {
+        let _this = this;
+        axios.get(getIdUrl)
+            .then((res) => {
+                if (res.data !== '') {
+                    _this.setState({
+                        userID: res.data
+                    })
+                }
+            })
+            .catch(function (err) {
+                console.log(err);
+            });
+    }
 
     render() {
         let schemaID = this.props.history.location.state ? this.props.history.location.state.schemaID : "ecommerce_schemaID";
@@ -42,12 +58,12 @@ class TrialCase extends Component {
                     onClick={(e) => this.switchMenu('menuLevel2', e)}
                     selectedKeys={[this.state.menuLevel2]}
                 >
-                    <Menu.Item key="schema">schema</Menu.Item>
-                    <Menu.Item key="deploy">deploy</Menu.Item>
-                    <Menu.Item key="graphiql">graphql IDE</Menu.Item>
-                    <Menu.Item key="templeate">templeate</Menu.Item>
-                    <Menu.Item key="preview">preview</Menu.Item>
-                    <Menu.Item key="metabase">metabase</Menu.Item>
+                    <Menu.Item key="schema"><FormattedMessage id="schema"/></Menu.Item>
+                    <Menu.Item key="deploy"><FormattedMessage id="deploy"/></Menu.Item>
+                    <Menu.Item key="graphiql"><FormattedMessage id="graphql IDE"/></Menu.Item>
+                    <Menu.Item key="template"><FormattedMessage id="template"/></Menu.Item>
+                    <Menu.Item key="preview"><FormattedMessage id="preview"/></Menu.Item>
+                    <Menu.Item key="metabase"><FormattedMessage id="metabase"/></Menu.Item>
                 </Menu>
 
 
@@ -59,10 +75,10 @@ class TrialCase extends Component {
                                     case 'schema':
                                         return <Schema trialcase={true} userID={this.state.userID} schemaName={schemaName} schemaID={schemaID} history={this.props.history} location={this.props.location}/>;
                                     case 'deploy':
-                                        return <Deploy userID={this.state.userID} schemaID={schemaID}/>;
+                                        return <Deploy trialcase={true} userID={this.state.userID} schemaID={schemaID}/>;
                                     case 'graphiql':
                                         return <Graphql/>;
-                                    case 'templeate':
+                                    case 'template':
                                         return <GenerateJs schemaID={schemaID} schemaName={schemaName}/>;
                                     case 'preview':
                                         return <Application location={this.props.location}/>;

+ 7 - 6
src/app/graphqlService/UserCreate.jsx

@@ -1,5 +1,6 @@
 import React, {Component} from 'react';
 import {Layout, Menu} from 'antd';
+import {FormattedMessage} from 'react-intl';
 
 import GenerateJs from "./component/generateJs/GenerateJs";
 import Deploy from '../common/deploy/Deploy';
@@ -56,11 +57,11 @@ class UserCreate extends Component {
                     onClick={(e) => this.switchMenu('menuLevel2', e)}
                     selectedKeys={[this.state.menuLevel2]}
                 >
-                    <Menu.Item key="schema">schema</Menu.Item>
-                    <Menu.Item key="deploy">deploy</Menu.Item>
-                    <Menu.Item key="graphiql">graphql IDE</Menu.Item>
-                    <Menu.Item key="template">template</Menu.Item>
-                    <Menu.Item key="metabase">metabase</Menu.Item>
+                    <Menu.Item key="schema"><FormattedMessage id="schema"/></Menu.Item>
+                    <Menu.Item key="deploy"><FormattedMessage id="deploy"/></Menu.Item>
+                    <Menu.Item key="graphiql"><FormattedMessage id="graphql IDE"/></Menu.Item>
+                    <Menu.Item key="template"><FormattedMessage id="template"/></Menu.Item>
+                    <Menu.Item key="metabase"><FormattedMessage id="metabase"/></Menu.Item>
                 </Menu>
 
 
@@ -72,7 +73,7 @@ class UserCreate extends Component {
                                     case 'schema':
                                         return <Schema trialcase={false} userID={this.state.userID} schemaName={schemaName} schemaID={schemaID} history={this.props.history} location={this.props.location}/>;
                                     case 'deploy':
-                                        return <Deploy userID={this.state.userID} schemaID={schemaID}/>;
+                                        return <Deploy trialcase={false} userID={this.state.userID} schemaID={schemaID}/>;
                                     case 'graphiql':
                                         return <Graphql/>;
                                     case 'template':

+ 5 - 1
src/app/graphqlService/component/caseMetabase/CaseMetabase.jsx

@@ -1,4 +1,7 @@
 import React, {Component} from 'react';
+import {FormattedMessage} from 'react-intl';
+
+import './index.css';
 
 class CaseMetabase extends Component {
 
@@ -6,7 +9,8 @@ class CaseMetabase extends Component {
     render() {
         return (
             <div>
-                Only members to use this website.
+                <p><b><FormattedMessage id="It is under development, please look forward to it. Thank you for your attention"/></b></p>
+                {/*Only members to use this website.*/}
             </div>
         )
     }

+ 3 - 0
src/app/graphqlService/component/caseMetabase/index.css

@@ -0,0 +1,3 @@
+p {
+    font-size: 16px;
+}

+ 35 - 34
src/app/graphqlService/component/generateJs/GenerateJs.jsx

@@ -1,9 +1,10 @@
 import React, {Component} from 'react';
+import {FormattedMessage} from 'react-intl';
 import axios from 'axios';
 import {BackTop, Tabs, Button, Spin} from 'antd';
 import saveAs from 'file-saver';
 import beautify from 'js-beautify';
-import {requestUrl} from '../../../../config';
+import {genJsUrl} from '../../../../config';
 
 import './index.css';
 
@@ -25,7 +26,7 @@ class GenerateJs extends Component {
         this._isMounted = true;
         let _this = this;
         let {schemaID} = this.state;
-        axios.get(`${requestUrl}?schema=${schemaID}`)
+        axios.get(`${genJsUrl}?schema=${schemaID}`)
             .then((res) => {
                 if(this._isMounted){
                     if (res.data !== '') {
@@ -58,7 +59,7 @@ class GenerateJs extends Component {
         this._isMounted = true;
         let _this = this;
         let {schemaID} = this.state;
-        axios.get(`${requestUrl}?schema=${schemaID}`)
+        axios.get(`${genJsUrl}?schema=${schemaID}`)
             .then((res) => {
                 if(this._isMounted){
                     if (res.data !== '') {
@@ -111,7 +112,9 @@ class GenerateJs extends Component {
                 >
                     <TabPane tab="Query" key="query">
                         <div className='download-button'>
-                            <Button type="primary" style={{float:'right'}} onClick={()=>this.saveFile()}>Download</Button>
+                            <Button type="primary" style={{float:'right'}} onClick={()=>this.saveFile()}>
+                                <FormattedMessage id="Download"/>
+                            </Button>
                         </div>
                         <br/>
                         {this.state.show ?
@@ -123,7 +126,9 @@ class GenerateJs extends Component {
 
                     <TabPane tab="Mutation" key="mutation">
                         <div className='download-button'>
-                            <Button type="primary" style={{float:'right'}} onClick={()=>this.saveFile()}>Download</Button>
+                            <Button type="primary" style={{float:'right'}} onClick={()=>this.saveFile()}>
+                                <FormattedMessage id="Download"/>
+                            </Button>
                         </div>
                         <br/>
                         {this.state.show ?
@@ -143,33 +148,29 @@ class GenerateJs extends Component {
 
 export default GenerateJs;
 
-class GraphqlJs extends Component {
-    render() {
-        return (
-            <div>
-                 <pre>
-                     <code>
-                         {this.props.graphqlList}
-                     </code>
-                 </pre>
-            </div>
-        );
-    }
-}
+const GraphqlJs = (props) => {
+    return (
+        <div>
+            <pre>
+                <code>
+                    {props.graphqlList}
+                </code>
+            </pre>
+        </div>
+    );
+};
 
-class Loading extends Component {
-    render() {
-        return (
-            <div style={{width: '100%', height: window.innerHeight - 164}}>
-                <Spin
-                    tip={'loading...'}
-                    style={{
-                        position: 'relative',
-                        top: '50%',
-                        left: '50%',
-                        transform: 'translate(-50%,-50%)'
-                    }}/>
-            </div>
-        );
-    }
-}
+const Loading =() => {
+    return (
+        <div style={{width: '100%', height: window.innerHeight - 164}}>
+            <Spin
+                tip={'loading...'}
+                style={{
+                    position: 'relative',
+                    top: '50%',
+                    left: '50%',
+                    transform: 'translate(-50%,-50%)'
+                }}/>
+        </div>
+    );
+};

+ 3 - 1
src/app/graphqlService/component/graphql/Graphql.jsx

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

+ 10 - 0
src/app/graphqlService/component/schema/Create.js

@@ -21,6 +21,12 @@ class Create extends Component {
         };
     }
 
+    redirectToLogin = () => {
+        this.props.history.push({
+            pathname: `/login`,
+        });
+    };
+
     componentWillReceiveProps(nextProps) {
         this.setState({
             visible: nextProps.visible,
@@ -102,6 +108,10 @@ class Create extends Component {
                                             this.setState({
                                                 schemaName: e.target.value,
                                             });
+                                            if(userID === '' || undefined) {
+                                                this.redirectToLogin();
+                                                this.props.hideModal();
+                                            }
                                         }}
                                     />
                                 </div>

+ 151 - 70
src/app/graphqlService/component/schema/Schema.jsx

@@ -18,6 +18,8 @@ import {request} from 'graphql-request'
 import {getCookie} from "../../../../cookie";
 import {idGen} from "../../../../func";
 import {graphqlUrl} from "../../../../config";
+import {manageUsers} from "../../../../config";
+import {FormattedMessage} from 'react-intl';
 
 const confirm = Modal.confirm;
 const Search = Input.Search;
@@ -40,7 +42,7 @@ class Schema extends Component {
         };
     }
 
-    shouldComponentUpdate(nextProps,nextState) {
+    shouldComponentUpdate(nextProps, nextState) {
         return true;
     }
 
@@ -111,11 +113,10 @@ class Schema extends Component {
             return new Promise((resolve, reject) => {
                 request(graphqlUrl, SEARCH_SCHEMA, {id: referenceID}).then(
                     data => {
-                        console.log(data);
                         if (data.schema_by_id !== null) {
-                            localStorage.setItem('ecommerce', data.caseSchema.find(obj=>obj.schemaName==='ecommerce').schemaData);
-                            localStorage.setItem('subscribe', data.caseSchema.find(obj=>obj.schemaName==='subscribe').schemaData);
-                            localStorage.setItem('bills', data.caseSchema.find(obj=>obj.schemaName==='bills').schemaData);
+                            localStorage.setItem('ecommerce', data.caseSchema.find(obj => obj.schemaName === 'ecommerce').schemaData);
+                            localStorage.setItem('subscribe', data.caseSchema.find(obj => obj.schemaName === 'subscribe').schemaData);
+                            localStorage.setItem('bills', data.caseSchema.find(obj => obj.schemaName === 'bills').schemaData);
                             resolve(data.schema_by_id.schemaData);
                         }
                     }
@@ -126,9 +127,9 @@ class Schema extends Component {
     };
 
     receiveDataFromTable = (data) => {
-      this.setState({
-          data
-      })
+        this.setState({
+            data
+        })
     };
 
     componentWillReceiveProps(next) {
@@ -156,14 +157,12 @@ class Schema extends Component {
                             return 'error!';
                         }
 
-                        // let schemaName = data.schema_by_id.schemaName;
-
                         let copy;
-                        if(this.props.location.state)
+                        if (this.props.location.state)
                             copy = this.props.location.state.copy;
 
                         // 找到 copy 一定几率不显示的 问题原因,异步导致的未存先取
-                        if (data.schema_by_id === null && copy!==true) data = [];
+                        if (data.schema_by_id === null && copy !== true) data = [];
                         else {
                             let reference = data.schema_by_id ? data.schema_by_id.reference : this.props.location.state.reference;
                             data = data.schema_by_id ? JSON.parse(data.schema_by_id.schemaData) : [];
@@ -200,9 +199,7 @@ class Schema extends Component {
                                                     <div className={'schema'}>
                                                         <span className={'schema-name'}>{this.state.schemaName}</span>
                                                         {
-                                                            trialcase ?
-                                                                ''
-                                                                :
+                                                            userID.indexOf(manageUsers) > -1 ?
                                                                 <Icon style={{marginLeft: 15}}
                                                                       type="edit"
                                                                       theme="twoTone"
@@ -212,6 +209,19 @@ class Schema extends Component {
                                                                           }
                                                                       }
                                                                 />
+                                                                :
+                                                                trialcase ?
+                                                                    ''
+                                                                    :
+                                                                    <Icon style={{marginLeft: 15}}
+                                                                          type="edit"
+                                                                          theme="twoTone"
+                                                                          onClick={
+                                                                              () => {
+                                                                                  this.setState({editSchemaName: this.state.schemaName})
+                                                                              }
+                                                                          }
+                                                                    />
                                                         }
                                                     </div>
                                             }
@@ -219,14 +229,13 @@ class Schema extends Component {
                                             <div className={'schema-table-list-title'}>
                                                 <Row>
                                                     <Col span={10}><span
-                                                        className={'schema-table-title'}>Name</span></Col>
+                                                        className={'schema-table-title'}><FormattedMessage
+                                                        id="Name"/></span></Col>
                                                     <Col span={10}><span
-                                                        className={'schema-table-title'}>Remark</span></Col>
+                                                        className={'schema-table-title'}><FormattedMessage id="Remark"/></span></Col>
                                                     <Col span={2} offset={2}>
                                                         {
-                                                            trialcase ?
-                                                                ''
-                                                                :
+                                                            userID.indexOf(manageUsers) > -1 ?
                                                                 <span
                                                                     className={'schema-table-title'}
                                                                     onClick={() => {
@@ -236,6 +245,19 @@ class Schema extends Component {
                                                                     }}>
                                                                     <Icon type="plus"/>
                                                                 </span>
+                                                                :
+                                                                trialcase ?
+                                                                    ''
+                                                                    :
+                                                                    <span
+                                                                        className={'schema-table-title'}
+                                                                        onClick={() => {
+                                                                            this.setState({
+                                                                                currentTable: 'add'
+                                                                            })
+                                                                        }}>
+                                                                        <Icon type="plus" style={{color: '#096dd9',cursor: 'pointer'}}/>
+                                                                </span>
                                                         }
 
                                                     </Col>
@@ -263,9 +285,7 @@ class Schema extends Component {
 
                                                                         <span className={'schema-table-content'}>
                                                                             {
-                                                                                trialcase ?
-                                                                                    ''
-                                                                                    :
+                                                                                userID.indexOf(manageUsers) > -1 ?
                                                                                     <DeleteTableButton
                                                                                         currentTable={table.name}
                                                                                         schemaData={data}
@@ -277,8 +297,22 @@ class Schema extends Component {
                                                                                         fetchData={this.fetchData}
                                                                                         location={this.props.location}
                                                                                     />
+                                                                                    :
+                                                                                    trialcase ?
+                                                                                        ''
+                                                                                        :
+                                                                                        <DeleteTableButton
+                                                                                            currentTable={table.name}
+                                                                                            schemaData={data}
+                                                                                            schemaID={this.state.schemaID}
+                                                                                            userID={userID}
+                                                                                            showTablePagination={this.showTablePagination}
+                                                                                            page={this.state.page}
+                                                                                            pageSize={this.state.pageSize}
+                                                                                            fetchData={this.fetchData}
+                                                                                            location={this.props.location}
+                                                                                        />
                                                                             }
-
                                                                         </span>
                                                                     </Col>
                                                                 </Row>
@@ -303,9 +337,7 @@ class Schema extends Component {
                                                                     <Col span={2} offset={2}>
                                                                 <span className={'schema-table-content'}>
                                                                     {
-                                                                        trialcase ?
-                                                                            ''
-                                                                            :
+                                                                        userID.indexOf(manageUsers) > -1 ?
                                                                             <DeleteTableButton
                                                                                 currentTable={table.name}
                                                                                 schemaData={data}
@@ -317,6 +349,21 @@ class Schema extends Component {
                                                                                 fetchData={this.fetchData}
                                                                                 location={this.props.location}
                                                                             />
+                                                                            :
+                                                                            trialcase ?
+                                                                                ''
+                                                                                :
+                                                                                <DeleteTableButton
+                                                                                    currentTable={table.name}
+                                                                                    schemaData={data}
+                                                                                    schemaID={this.state.schemaID}
+                                                                                    showTablePagination={this.showTablePagination}
+                                                                                    page={this.state.page}
+                                                                                    pageSize={this.state.pageSize}
+                                                                                    userID={userID}
+                                                                                    fetchData={this.fetchData}
+                                                                                    location={this.props.location}
+                                                                                />
                                                                     }
                                                                 </span>
                                                                     </Col>
@@ -330,22 +377,51 @@ class Schema extends Component {
                                                 <Row>
                                                     <Col span={4}>
                                                         {
-                                                            trialcase ?
-                                                                <div className={'delete-schema'}>
-                                                                    <CopySchemaButton
-                                                                        userID={userID}
-                                                                        history={this.props.history}
-                                                                        schemaName={this.state.schemaName}
-                                                                    />
-                                                                </div>
+                                                            userID.indexOf(manageUsers) > -1 ?
+                                                                trialcase ?
+                                                                    <div>
+                                                                        <div style={{display: 'inline-block'}}
+                                                                             className={'delete-schema'}>
+                                                                            <CopySchemaButton
+                                                                                userID={userID}
+                                                                                history={this.props.history}
+                                                                                schemaName={this.state.schemaName}
+                                                                            />
+                                                                        </div>
+                                                                        <div style={{display: 'inline-block'}}
+                                                                             className={'delete-schema'}>
+                                                                            <DeleteSchemaButton
+                                                                                userID={userID}
+                                                                                schemaName={this.state.schemaName}
+                                                                                history={this.props.history}
+                                                                            />
+                                                                        </div>
+                                                                    </div>
+                                                                    :
+                                                                    <div className={'delete-schema'}>
+                                                                        <DeleteSchemaButton
+                                                                            userID={userID}
+                                                                            schemaName={this.state.schemaName}
+                                                                            history={this.props.history}
+                                                                        />
+                                                                    </div>
                                                                 :
-                                                                <div className={'delete-schema'}>
-                                                                    <DeleteSchemaButton
-                                                                        userID={userID}
-                                                                        schemaName={this.state.schemaName}
-                                                                        history={this.props.history}
-                                                                    />
-                                                                </div>
+                                                                trialcase ?
+                                                                    <div className={'delete-schema'}>
+                                                                        <CopySchemaButton
+                                                                            userID={userID}
+                                                                            history={this.props.history}
+                                                                            schemaName={this.state.schemaName}
+                                                                        />
+                                                                    </div>
+                                                                    :
+                                                                    <div className={'delete-schema'}>
+                                                                        <DeleteSchemaButton
+                                                                            userID={userID}
+                                                                            schemaName={this.state.schemaName}
+                                                                            history={this.props.history}
+                                                                        />
+                                                                    </div>
                                                         }
                                                     </Col>
                                                     <Col span={4} offset={16}>
@@ -387,8 +463,8 @@ class Schema extends Component {
                                             <Table
                                                 currentTable={this.state.currentTable}
                                                 schemaData={data}
-                                                columns={this.findColumns(data.length !== 0? data : this.state.data)}
-                                                remark={this.findRemark(data.length !== 0? data : this.state.data)}
+                                                columns={this.findColumns(data.length !== 0 ? data : this.state.data)}
+                                                remark={this.findRemark(data.length !== 0 ? data : this.state.data)}
                                                 schemaID={this.state.schemaID}
                                                 schemaName={this.state.schemaName}
                                                 userID={userID}
@@ -467,7 +543,7 @@ class CopySchemaButton extends Component {
                                     });
                                 }}
 
-                            >copy</Button>
+                            ><FormattedMessage id="copy"/></Button>
                         )
                     }}
                 </Mutation>
@@ -529,7 +605,7 @@ class DeleteSchemaButton extends Component {
                                 this.showConfirm(delete_schema, schemaName, userID);
                             }}
                         >
-                            delete
+                            <FormattedMessage id="delete"/>
                         </Button>
                     )
                 }}
@@ -591,6 +667,7 @@ class DeleteTableButton extends Component {
 
                                     return (
                                         <Icon type="delete"
+                                              theme="twoTone"
                                               onClick={() => {
                                                   update_schema({
                                                       variables: {
@@ -634,30 +711,34 @@ class ModifySchemaNameInput extends Component {
                         return <Spin style={{marginLeft: 3}}/>;
                     return (
                         <div className={'schema'}>
-                            <Search
-                                value={this.props.editSchemaName}
-                                enterButton="Confirm"
-                                style={{width: 500}}
-                                size="large"
-                                onChange={this.props.changeEditSchemaName}
-                                onSearch={value => {
-                                    update_schema({
-                                        variables: {
-                                            id: this.props.schemaID,
-                                            schemaName: value,
-                                            updateAt: new Date().getTime()
-                                        }
-                                    });
-                                    this.props.history.push({
-                                        pathname: `/graphql-service/my-create/${value}`,
-                                        state: {
-                                            schemaName: value,
-                                            schemaID: this.props.schemaID,
-                                        }
-                                    });
-                                    this.props.clearEditSchemaName();
-                                }}
-                            />
+                            <FormattedMessage id="Confirm">
+                                {(msg) => (
+                                    <Search
+                                        value={this.props.editSchemaName}
+                                        enterButton={msg}
+                                        style={{width: 500}}
+                                        size="large"
+                                        onChange={this.props.changeEditSchemaName}
+                                        onSearch={value => {
+                                            update_schema({
+                                                variables: {
+                                                    id: this.props.schemaID,
+                                                    schemaName: value,
+                                                    updateAt: new Date().getTime()
+                                                }
+                                            });
+                                            this.props.history.push({
+                                                pathname: `/graphql-service/my-create/${value}`,
+                                                state: {
+                                                    schemaName: value,
+                                                    schemaID: this.props.schemaID,
+                                                }
+                                            });
+                                            this.props.clearEditSchemaName();
+                                        }}
+                                    />)}
+                            </FormattedMessage>
+
                         </div>
                     )
                 }}

+ 135 - 57
src/app/graphqlService/component/schema/Table.js

@@ -1,11 +1,15 @@
 import React, {Component} from 'react';
+import axios from 'axios';
 
 import {Layout, Select, Input, Icon, Button, notification, Spin, Modal} from 'antd';
 import {UPDATE_SCHEMA, SHOW_SCHEMA, SHOW_TABLE} from "../../../../gql";
 import gql from "graphql-tag";
+import {FormattedMessage} from 'react-intl';
 
 import {Mutation, Query} from "react-apollo";
 import {getCookie} from "../../../../cookie";
+import {manageUsers} from "../../../../config";
+import {checkSchemaUrl} from '../../../../config';
 
 const Option = Select.Option;
 const {Content} = Layout;
@@ -22,7 +26,7 @@ class Table extends Component {
             newColType: 'type',
             types: ['ID', 'String', 'Int', 'Float', 'Boolean', 'DateTime'],
             descriptions: ['description', 'key', 'non-null', 'non-null-list', 'list'],
-            characterTips: false
+            characterTips: false,
         }
     }
 
@@ -127,32 +131,38 @@ class Table extends Component {
                 <Layout style={{zIndex: '0'}}>
                     <Content style={{padding: '24px', minHeight: 280, background: '#fff'}}>
                         <div className="column-content">
-                            <span className='table-title'> Table name</span>
-                            <Input
-                                value={this.state.currentTable}
-                                placeholder="please input table name"
-                                style={{width: 200, margin: '10px 0'}}
-                                onChange={(e) => {
-                                    this.setState({currentTable: e.target.value})
-                                }}/>
+                            <span className='table-title'> <FormattedMessage id="Table name"/></span>
+                            <FormattedMessage id="please input table name">
+                                {(msg) => (<Input
+                                    value={this.state.currentTable}
+                                    placeholder={msg}
+                                    style={{width: 200, margin: '10px 0'}}
+                                    onChange={(e) => {
+                                        this.setState({currentTable: e.target.value})
+                                    }}/>)}
+                            </FormattedMessage>
+
                         </div>
 
                         <div style={{marginBottom: 20}}>
-                            <span className='table-title'> Table remark</span>
-                            <Input
-                                value={this.state.remark}
-                                placeholder="please input table remark"
-                                style={{width: 250, margin: '10px 0'}}
-                                onChange={(e) => {
-                                    this.setState({remark: e.target.value})
-                                }}/>
+                            <span className='table-title'> <FormattedMessage id="Table remark"/></span>
+                            <FormattedMessage id="please input table remark">
+                                {(msg) => (<Input
+                                    value={this.state.remark}
+                                    placeholder={msg}
+                                    style={{width: 250, margin: '10px 0'}}
+                                    onChange={(e) => {
+                                        this.setState({remark: e.target.value})
+                                    }}/>)}
+                            </FormattedMessage>
+
                         </div>
 
                         <div>
-                            <span className='table-title'> Table fields</span>
-                            <span className='column-title'>name</span>
-                            <span className='column-title'>type</span>
-                            <span className='column-title'>description</span>
+                            <span className='table-title'> <FormattedMessage id="Table fields"/></span>
+                            <span className='column-title'><FormattedMessage id="name"/></span>
+                            <span className='column-title'><FormattedMessage id="type"/></span>
+                            <span className='column-title'><FormattedMessage id="description"/></span>
                             {
                                 this.state.columns.map((col, index) =>
                                     <div key={index} style={{marginBottom: 3}}>
@@ -178,27 +188,35 @@ class Table extends Component {
                                             onChange={this.handleDescChange(index)}>
                                             {
                                                 this.state.descriptions.map((value) =>
-                                                    <Option key={Math.random() + 'descriptions'} value={value.toLowerCase()}>{value}</Option>
+                                                    <Option key={Math.random() + 'descriptions'}
+                                                            value={value.toLowerCase()}>{value}</Option>
                                                 )
                                             }
                                         </Select>
                                         {
-                                            trialcase ?
-                                                ''
-                                                :
+                                            userID.indexOf(manageUsers) > -1 ?
                                                 <Icon type="delete" theme="twoTone" style={{cursor: 'pointer'}}
                                                       onClick={this.handleColDelete(index)}/>
+                                                :
+                                                trialcase ?
+                                                    ''
+                                                    :
+                                                    <Icon type="delete" theme="twoTone" style={{cursor: 'pointer'}}
+                                                          onClick={this.handleColDelete(index)}/>
                                         }
                                     </div>
                                 )
                             }
                             <div>
-                                <Input
-                                    className="column-details"
-                                    placeholder="field name"
-                                    onChange={this.handleNameNew}
-                                    value={this.state.newColName}
-                                />
+                                <FormattedMessage id="field name">
+                                    {(msg) => (<Input
+                                        className="column-details"
+                                        placeholder={msg}
+                                        onChange={this.handleNameNew}
+                                        value={this.state.newColName}
+                                    />)}
+                                </FormattedMessage>
+
                                 <Select
                                     className="column-details"
                                     defaultValue="type"
@@ -214,9 +232,7 @@ class Table extends Component {
                         </div>
 
                         {
-                            trialcase ?
-                                ''
-                                :
+                            userID.indexOf(manageUsers) > -1 ?
                                 <div style={{marginTop: 20}}>
                                     <UpdateTableButton
                                         currentTable={this.state.currentTable}
@@ -234,6 +250,27 @@ class Table extends Component {
                                         add={this.props.add}
                                     />
                                 </div>
+                                :
+                                trialcase ?
+                                    ''
+                                    :
+                                    <div style={{marginTop: 20}}>
+                                        <UpdateTableButton
+                                            currentTable={this.state.currentTable}
+                                            columns={this.state.columns}
+                                            remark={this.state.remark}
+                                            schemaID={schemaID}
+                                            userID={userID}
+                                            schemaData={this.props.schemaData}
+                                            fetchData={this.props.fetchData}
+                                            showTablePagination={this.props.showTablePagination}
+                                            page={this.props.page}
+                                            pageSize={this.props.pageSize}
+                                            history={this.props.history}
+                                            schemaName={schemaName}
+                                            add={this.props.add}
+                                        />
+                                    </div>
                         }
 
                     </Content>
@@ -250,22 +287,23 @@ class UpdateTableButton extends Component {
     constructor(props) {
         super(props);
         this.state = {
-            originTableName: props.currentTable
+            originTableName: props.currentTable,
+            schemaCheck: ''
         }
-
     }
 
-    showConfirm = (schemaName, schemaID) => {
+    showConfirm = (schemaName, schemaID, data) => {
         let _this = this;
 
         if (this.props.add !== 'add') {
-            this.props.history.push({
-                pathname: `/graphql-service/my-create/${schemaName}`,
-                state: {
-                    schemaName,
-                    schemaID
-                }
-            });
+            if(data.update_schema.schemaState === 'ok')
+                this.props.history.push({
+                    pathname: `/graphql-service/my-create/${schemaName}`,
+                    state: {
+                        schemaName,
+                        schemaID
+                    }
+                });
         } else {
             confirm({
                 title: '添加成功',
@@ -286,6 +324,41 @@ class UpdateTableButton extends Component {
         }
     };
 
+    checkSchema = (update_schema, schemaID, varobj, schemaCols) => {
+        update_schema({
+            variables: {
+                ...varobj,
+                schemaData: JSON.stringify(schemaCols)
+            }
+        });
+        let _this = this;
+
+        axios.get(`${checkSchemaUrl}?schema=${schemaID}`)
+            .then((res) => {
+                console.log('check schema res', res);
+                if (res.data !== '') {
+                    update_schema({
+                        variables: {
+                            ...varobj,
+                            schemaData: JSON.stringify(schemaCols),
+                            schemaState: 'ok',
+                        }
+                    });
+                    _this.setState({
+                        schemaCheck: '',
+                    });
+                }
+            })
+            .catch((err) => {
+                // console.log('err',err);
+                // console.log('err.response',err.response);
+                _this.setState({
+                    schemaCheck: err.response.data,
+                });
+                console.log('err.response.data', err.response.data);
+            });
+    };
+
     render() {
         let schemaID = this.props.schemaID;
         let schemaName = this.props.schemaName;
@@ -315,7 +388,7 @@ class UpdateTableButton extends Component {
                         return (
                             <Mutation
                                 mutation={gql(UPDATE_SCHEMA)}
-                                onCompleted={() => this.showConfirm(schemaName, schemaID)}
+                                onCompleted={(data) => this.showConfirm(schemaName, schemaID, data)}
                                 refetchQueries={[{query: gql(SHOW_TABLE), variables: {schema_id: schemaID}}]}
                             >
 
@@ -332,6 +405,7 @@ class UpdateTableButton extends Component {
                                     else schemaCols = JSON.parse(schemaData.schema_by_id.schemaData);
 
                                     // 处理一下description的问题
+
                                     let cols = this.props.columns;
                                     cols.map(obj => {
                                         if (obj.description === 'description')
@@ -368,19 +442,23 @@ class UpdateTableButton extends Component {
                                     }
 
                                     return (
-                                        <div style={{display: 'inline-block'}}>
-                                            <Button type="primary" onClick={() => {
-                                                update_schema({
-                                                    variables: {
-                                                        ...varobj,
-                                                        schemaData: JSON.stringify(schemaCols)
-                                                    }
-                                                });
-                                                this.props.showTablePagination(this.props.page, this.props.pageSize, schemaCols);
-                                            }}>
-                                                save
-                                            </Button>
+                                        <div>
+                                            <div style={{display: 'inline-block'}}>
+                                                <Button type="primary" onClick={() => {
+                                                    this.checkSchema(update_schema, schemaID, varobj, schemaCols);
+                                                    this.props.showTablePagination(this.props.page, this.props.pageSize, schemaCols);
+                                                }}>
+                                                    <FormattedMessage id="save"/>
+                                                </Button>
+                                            </div>
+                                            {
+                                                this.state.schemaCheck !== '' ?
+                                                    <span>  failed, cause '{this.state.schemaCheck}'</span>
+                                                    :
+                                                    ''
+                                            }
                                         </div>
+
                                     )
                                 }}
                             </Mutation>

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

@@ -1,6 +1,6 @@
 import React, {Component} from 'react';
-
 import {Layout, Menu} from 'antd';
+import {FormattedMessage} from 'react-intl';
 
 import WxConfig from "./wxConfig/WxConfig";
 import WxDeploy from "../common/deploy/Deploy";
@@ -42,9 +42,9 @@ class WxTrialCase extends Component {
                     onClick={(e) => this.switchMenu('menuLevel3', e)}
                     selectedKeys={[this.state.menuLevel3]}
                 >
-                    <Menu.Item key="wechat-config">config settings</Menu.Item>
-                    <Menu.Item key="wechat-deploy">deploy settings</Menu.Item>
-                    <Menu.Item key="wechat-result">result</Menu.Item>
+                    <Menu.Item key="wechat-config"><FormattedMessage id="config"/></Menu.Item>
+                    <Menu.Item key="wechat-deploy"><FormattedMessage id="deploy"/></Menu.Item>
+                    <Menu.Item key="wechat-result"><FormattedMessage id="manage"/></Menu.Item>
                 </Menu>
 
                 <Layout style={{padding: '24px', zIndex: '0'}}>
@@ -54,7 +54,7 @@ class WxTrialCase extends Component {
                                 case 'wechat-config':
                                     return <WxConfig defaultAppName={'ecommerce'} defaultConfigID={'ecommerce_wxConfigID'} trialcase={true} history={this.props.history} location={this.props.location}/>;
                                 case 'wechat-deploy':
-                                    return <WxDeploy userID={this.state.userID} configID={configID}/>;
+                                    return <WxDeploy trialcase={true} userID={this.state.userID} configID={configID}/>;
                                 case 'wechat-result':
                                     return <WxResult/>;
                                 default:

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

@@ -8,7 +8,7 @@ import WxConfig from "./wxConfig/WxConfig";
 import WxDeploy from "../common/deploy/Deploy";
 import WxResult from './wxResult/WxResult';
 import axios from 'axios';
-
+import {FormattedMessage} from 'react-intl';
 axios.defaults.withCredentials = true;
 
 const {Content} = Layout;
@@ -63,9 +63,9 @@ class WxUserCreate extends Component {
                     onClick={(e) => this.switchMenu('menuLevel3', e)}
                     selectedKeys={[this.state.menuLevel3]}
                 >
-                    <Menu.Item key="wechat-config">config settings</Menu.Item>
-                    <Menu.Item key="wechat-deploy">deploy settings</Menu.Item>
-                    <Menu.Item key="wechat-result">result</Menu.Item>
+                    <Menu.Item key="wechat-config"><FormattedMessage id="config"/></Menu.Item>
+                    <Menu.Item key="wechat-deploy"><FormattedMessage id="deploy"/></Menu.Item>
+                    <Menu.Item key="wechat-result"><FormattedMessage id="result"/></Menu.Item>
                 </Menu>
 
                 <Layout style={{padding: '24px', zIndex: '0'}}>
@@ -75,7 +75,7 @@ class WxUserCreate extends Component {
                                 case 'wechat-config':
                                     return <WxConfig history={this.props.history} location={this.props.location}/>;
                                 case 'wechat-deploy':
-                                    return <WxDeploy userID={this.state.userID} configID={configID}/>;
+                                    return <WxDeploy trialcase={false} userID={this.state.userID} configID={configID}/>;
                                 case 'wechat-result':
                                     return <WxResult/>;
                                 default:

+ 1 - 1
src/app/wechatService/wxConfig/WxConfig.jsx

@@ -121,7 +121,7 @@ class Display extends Component {
                 }
                 {
                     this.props.trialcase ?
-                        <Button type={'primary'}> need copy</Button>
+                        ""
                         :
                         <div>
                             <UpdateWXConfigButton

+ 9 - 0
src/app/wechatService/wxCreate/WxCreate.js

@@ -38,6 +38,11 @@ class WxCreate extends Component {
         });
     }
 
+    redirectToLogin = () => {
+        this.props.history.push({
+            pathname: `/login`,
+        });
+    };
 
     handleOk = (userID, create_wxConfig) => {
         let {mch_id, notify_url, appSecret, appID, token, spbill_create_ip, enter_url, pay_api_key, body, welcome_words, attach} = this.state;
@@ -126,6 +131,10 @@ class WxCreate extends Component {
                                             this.setState({
                                                 appName: e.target.value,
                                             });
+                                            if(userID === '' || undefined) {
+                                                this.redirectToLogin();
+                                                this.props.hideModal();
+                                            }
                                         }}
                                     />
                                 </div>

+ 12 - 3
src/config.js

@@ -8,9 +8,18 @@ const backend = serverIP + ':' + backendPort;
 const graphqlUrl = serverIP + ':' + graphqlPort + '/graphql';
 
 // api 配置
-const requestUrl = backend + '/graphql/genjs';
 const getIdUrl = backend + '/getuserid';
-const loginUrl = backend +  '/login';
+const loginUrl = backend + '/login';
 const registerUrl = backend + '/resetpassword';
 
-export {requestUrl, getIdUrl, loginUrl, registerUrl, graphqlUrl}
+// graphql 部署配置
+const backendGQ = backend + '/graphql';
+const genJsUrl = backendGQ + '/genjs';
+const checkSchemaUrl = backendGQ + '/compile';
+const deployUrl = backendGQ + '/deployall';
+
+// 管理员配置
+// 通过在该数组中添加 userID,可以管理 trialcase 的增删改查
+const manageUsers = ['xy_1_je9{d\'\'_32sD+'];
+
+export {getIdUrl, loginUrl, registerUrl, checkSchemaUrl, deployUrl, genJsUrl, graphqlUrl, manageUsers}

+ 8 - 0
src/gql.js

@@ -57,6 +57,7 @@ const SHOW_SCHEMA = `
                     schemaName
                     id
                     reference
+                    schemaState
                 }
             }
         `;
@@ -68,12 +69,14 @@ const SHOW_ALL_SCHEMA = `
                     schemaName
                     id
                     reference
+                    schemaState
                 }
                 caseSchema:schema_by_props(user_id: "ioobot") {
                     schemaData
                     schemaName
                     id
                     reference
+                    schemaState
                 }
             }
         `;
@@ -85,6 +88,7 @@ const SEARCH_SCHEMA = `
                     schemaData
                     id
                     reference
+                    schemaState
                 }
             }
         `;
@@ -105,6 +109,7 @@ const ADD_SCHEMA = `
                     schemaData
                     id
                     reference
+                    schemaState
                 }
             }
         `;
@@ -126,6 +131,7 @@ const UPDATE_SCHEMA = `
                     schemaName,
                     schemaData
                     id
+                    schemaState
                 }
             }
         `;
@@ -139,6 +145,7 @@ const UPDATE_SCHEMA_NAME = `
                 ) {
                     schemaName,
                     id
+                    schemaState
                 }
             }
         `;
@@ -150,6 +157,7 @@ const SHOW_TABLE = `
                     schemaData
                     schemaName
                     reference
+                    schemaState
                 }
             }
         `;

+ 71 - 0
src/language/en_US.js

@@ -6,5 +6,76 @@ const en_US = {
     "Data Storage":"Data Storage",
     "Data Analysis":"Data Analysis",
     "Monitor Notification":"Monitor Notification",
+    "schema":"schema",
+    "deploy":"deploy",
+    "graphql IDE":"graphql IDE",
+    "template":"template",
+    "preview":"preview",
+    "metabase":"metabase",
+    "Case Show":"Case Show",
+    "Create":"Create",
+    "My Create":"My Create",
+    "Instructions":"Instructions",
+    "Login":"Login",
+    "login":"login",
+    "Download":"Download",
+
+    "Name":"Name",
+    "name":"name",
+    "type":"type",
+    "description":"description",
+    "Remark":"Remark",
+    "copy":"copy",
+    "Table":"Table",
+    "fields":"fields",
+     // wexin相关
+    "config":"config",
+    "manage":"manage",
+    //cloud 相关
+    "Tencent":"Tencent",
+    "Aliyun":"Aliyun",
+    "AWS":"AWS",
+    // deploy相关
+    "Deploy":"Deploy",
+
+    //account 个人中心相关
+    "Account center":"Account center",
+    "Cloud settings":"Cloud settings",
+    "user setting":"user setting",
+    "cloud setting":"cloud setting",
+    "save":"save",
+    "cancel":"cancel",
+    "modify":"modify",
+    "exit":"exit",
+    "email":"email",
+    "tel":"tel",
+    "username":"username",
+    "password":"password",
+    "modify avatar":"modify avatar",
+    //提示语
+    "It is under development, please look forward to it. Thank you for your attention":"It is under development, please look forward to it. Thank you for your attention",
+
+
+    "delete": "delete",
+    "Table name": "Table name",
+    "Table remark": "Table remark",
+    "Table fields": "Table fields",
+    "result": "result",
+    "please input table remark": "please input table remark",
+    "please input table name": "please input table name",
+    "field name": 'field name',
+    "Confirm": 'Confirm',
+    "fc Deploy": "Deploy",
+    "API Group": 'API Group',
+    "API Path": 'API Path',
+    "Notification": 'Notification',
+    "Want more options?": 'Want more options?',
+    "Welcome": 'Welcome',
+    'register': 'register',
+    'ok, login please': 'ok, login please',
+    'login failed': 'login filed',
+    'relogin': 'relogin',
+    'nickname': 'nickname',
+    'username has been used': 'username has been used, please change one'
 };
 export default en_US;

+ 73 - 1
src/language/zh_CN.js

@@ -5,6 +5,78 @@ const zh_CN = {
     "Cloud Function":"云函数",
     "Data Storage":"数据存储",
     "Data Analysis":"数据分析",
-    "Monitor Notification":"监控通知"
+    "Monitor Notification":"监控通知",
+    "schema":"表结构",
+    "deploy":"一键部署",
+    "graphql IDE":"编辑器",
+    "template":"模板语句",
+    "preview":"展示",
+    "metabase":"数据分析",
+    "Case Show":"案例展示",
+    "Create":"创建",
+    "My Create":"我的创建",
+    "Instructions":"使用说明",
+    "Login":"登陆",
+    "login":"登陆",
+    "Download":"下载",
+
+    "Name":"名称",
+    "name":"名称",
+    "type":"类型",
+    "description":"description",
+    "Remark":"描述",
+    "copy":"复制",
+    "Table":"表",
+    "fields":"字段",
+    // wexin相关
+    "config":"配置",
+    "manage":"管理",
+    //cloud 相关
+    "Tencent":"腾讯云",
+    "Aliyun":"阿里云",
+    "AWS":"亚马逊",
+    // deploy相关
+    "Deploy":"部署",
+
+    //account 个人中心相关
+    "Account center":"账户中心",
+    "Cloud settings":"云服务商配置",
+    "user setting":"用户设置",
+    "cloud setting":"云授权设置",
+    "save":"保存",
+    "cancel":"取消",
+    "modify":"修改",
+    "exit":"退出",
+    "email":"邮箱",
+    "tel":"联系号码",
+    "username":"用户名",
+    "password":"密码",
+    "modify avatar":"修改我的头像",
+
+    //提示语
+    "It is under development, please look forward to it. Thank you for your attention":"正在开发中,请敬请期待,感谢您对我们的关注",
+
+
+    "delete": "删除",
+    "Table name": "表名",
+    "Table remark": "表备注",
+    "Table fields": "字段内容",
+    "result": "结果",
+    "please input table remark": "请输入表备注",
+    "please input table name": "请输入表名",
+    "field name": '字段名',
+    "Confirm": '确认修改',
+    "fc Deploy": "云函数配置",
+    "API Group": 'API组 配置',
+    "API Path": 'API路径 配置',
+    "Notification": '通知配置',
+    "Want more options?": '需要更多配置项?',
+    "Welcome": '欢迎',
+    'register': '注册',
+    'ok, login please': '完成,请登录',
+    'login failed': '登录失败',
+    'relogin': '重新登录',
+    'nickname': '昵称',
+    'username has been used': '用户名已被占用,请更换',
 };
 export default zh_CN;

+ 18 - 15
src/login/AccountConfig.js

@@ -1,4 +1,5 @@
 import React, {Component} from 'react';
+import {FormattedMessage} from 'react-intl';
 import {Icon, Row, Col, Input, Button} from 'antd';
 import './index.css'
 import avatar from '../images/avatar.jpg';
@@ -34,17 +35,19 @@ class AccountConfig extends Component {
                             <div className={'mask-black'}>
                                 <div className={'tip'}>
                                     <Icon style={{fontSize: 30, display: 'block'}} type="camera"/>
-                                    <span style={{paddingTop: 5, display: 'block'}} className={'tip-span'}>修改我的头像</span>
+                                    <span style={{paddingTop: 5, display: 'block'}} className={'tip-span'}>
+                                        <FormattedMessage id="modify avatar"/>
+                                    </span>
                                 </div>
                             </div>
                         </div>
                         <Row>
                             <Col span={20} offset={4} className={'message-wrapper'}>
                                 <Row>
-                                    <Col span={22}>
+                                    <Col span={20}>
                                         {
                                             this.state.editNickname ?
-                                                <EditNickname kind={'nickname'} cancelEdit={this.cancelEdit}/>
+                                                <EditNickname cancelEdit={this.cancelEdit}/>
                                                 :
                                                 <div className={'nickname'} onMouseOver={() => {
                                                     this.setState({overNickname: true})
@@ -63,7 +66,7 @@ class AccountConfig extends Component {
                                                                   }}>
                                                                 <Icon style={{fontSize: '18px'}} type="edit"
                                                                       theme="twoTone"/>
-                                                                <span className={'modify'}> modify</span>
+                                                                <span className={'modify'}> <FormattedMessage id="modify"/></span>
                                                             </span>
                                                             :
                                                             ''
@@ -71,20 +74,20 @@ class AccountConfig extends Component {
                                                 </div>
                                         }
                                     </Col>
-                                    <Col span={2}>
+                                    <Col span={4}>
                                         <div className="back-to-login" onClick={() => {
                                             this.props.history.push({
                                                 pathname: '/login',
                                             })
                                         }}>
-                                            login <Icon type="right" style={{color: '#848fa6'}}/>
+                                            <FormattedMessage id="login"/> <Icon type="right" style={{color: '#848fa6'}}/>
                                         </div>
                                     </Col>
                                 </Row>
 
                                 <Row className={'message'}>
                                     <Col span={5}>
-                                        <span className={'message-title'}>tel</span>
+                                        <span className={'message-title'}><FormattedMessage id="tel"/></span>
                                     </Col>
                                     <Col span={19}>
                                         {
@@ -108,7 +111,7 @@ class AccountConfig extends Component {
                                                                   }}>
                                                                 <Icon style={{fontSize: '18px'}} type="edit"
                                                                       theme="twoTone"/>
-                                                                <span className={'modify'}> modify</span>
+                                                                <span className={'modify'}> <FormattedMessage id="modify"/></span>
                                                             </span>
                                                             :
                                                             ''
@@ -120,7 +123,7 @@ class AccountConfig extends Component {
 
                                 <Row className={'message'}>
                                     <Col span={5}>
-                                        <span className={'message-title'}>email</span>
+                                        <span className={'message-title'}><FormattedMessage id="email"/></span>
                                     </Col>
 
                                     <Col span={19}>
@@ -146,7 +149,7 @@ class AccountConfig extends Component {
                                                                   }}>
                                                                 <Icon style={{fontSize: '18px'}} type="edit"
                                                                       theme="twoTone"/>
-                                                                <span className={'modify'}> modify</span>
+                                                                <span className={'modify'}> <FormattedMessage id="modify"/></span>
                                                             </span>
                                                             :
                                                             ''
@@ -176,13 +179,13 @@ class EditNickname extends Component {
         return (
             <Row className={'message-top'}>
                 <Col span={5}>
-                    <span className={'message-title message-title-high'}>{this.props.kind}</span>
+                    <span className={'message-title message-title-high'}><FormattedMessage id="nickname"/></span>
                 </Col>
                 <Col span={19}>
                     <span className={'message-content'}>
                         <Input/>
-                        <Button type={'primary'}>save</Button>
-                        <Button onClick={() => this.props.cancelEdit(this.props.kind)}>cancel</Button>
+                        <Button type={'primary'}><FormattedMessage id="save"/></Button>
+                        <Button onClick={() => this.props.cancelEdit(this.props.kind)}><FormattedMessage id="cancel"/></Button>
                     </span>
                 </Col>
             </Row>
@@ -200,8 +203,8 @@ class Edit extends Component {
         return (
             <span className={'message-content'}>
                 <Input/>
-                <Button type={'primary'}>save</Button>
-                <Button onClick={() => this.props.cancelEdit(this.props.kind)}>cancel</Button>
+                <Button type={'primary'}><FormattedMessage id="save"/></Button>
+                <Button onClick={() => this.props.cancelEdit(this.props.kind)}><FormattedMessage id="cancel"/></Button>
             </span>
         )
     }

+ 70 - 59
src/login/CloudConfig.js

@@ -1,4 +1,5 @@
 import React, {Component} from 'react';
+import {FormattedMessage} from 'react-intl';
 import {Button, Input, Spin, Icon} from 'antd';
 
 import {SHOW_CLOUD, ADD_CLOUD, UPDATE_CLOUD} from "../gql";
@@ -134,18 +135,19 @@ class CloudConfig extends Component {
                             pathname: '/login',
                         })
                     }}>
-                        <Icon type="left" style={{color: '#3187FA'}}/> login
+                        <Icon type="left" style={{color: '#3187FA'}}/> <FormattedMessage id="login"/>
                     </div>
+
                     <div style={{marginTop: 15}}>
-                        <span className='cloud-name'>Tencent: </span>
+                        <span className='cloud-name'><FormattedMessage id="Tencent"/>: </span>
                         <div style={{marginBottom: 15}}>
                             <div>
-                                <div style={{marginBottom: 10}}>
-                                    <span className='item-title-cloud'>ID:</span>
+                                <div style={{marginBottom: 20}}>
+                                    <span className='item-title-cloud'>secret ID:</span>
                                     <Input style={{width: 250}} value={this.state.aliID} onChange={this.inputChange('tenID')}/>
                                 </div>
-                                <div style={{marginBottom: 10}}>
-                                    <span className='item-title-cloud'>Key:</span>
+                                <div style={{marginBottom: 20}}>
+                                    <span className='item-title-cloud'>secret Key:</span>
                                     <Input style={{width: 250}} value={this.state.aliKey} onChange={this.inputChange('tenKey')}/>
                                 </div>
                                 {
@@ -159,62 +161,71 @@ class CloudConfig extends Component {
                                 }
                             </div>
                             <Button type='primary'
-                                    onClick={this.submit(this.state.tencentCLoudID, 'tencent', this.state.tenID, this.state.tenKey)}>ok</Button>
+                                    onClick={this.submit(this.state.tencentCLoudID, 'tencent', this.state.tenID, this.state.tenKey)}>
+                                <FormattedMessage id="save"/>
+                            </Button>
                         </div>
                     </div>
-                    <div>
-                        <span className='cloud-name'>Aliyun: </span>
-                        <div style={{marginBottom: 15}}>
-                            <div>
-                                <div style={{marginBottom: 10}}>
-                                    <span className='item-title-cloud'>ID:</span>
-                                    <Input style={{width: 250}} value={this.state.aliID} onChange={this.inputChange('aliID')}/>
-                                </div>
-                                <div style={{marginBottom: 10}}>
-                                    <span className='item-title-cloud'>Key:</span>
-                                    <Input style={{width: 250}} value={this.state.aliKey} onChange={this.inputChange('aliKey')}/>
-                                </div>
 
-                                {
-                                    this.state.showOK === 'aliyun' ?
-                                        <Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a"/>
-                                        :
-                                        this.state.showNotOK === 'aliyun' ?
-                                            <span>not ok</span>
-                                            :
-                                            ""
-                                }
-                            </div>
-                            <Button type='primary'
-                                    onClick={this.submit(this.state.aliyunCLoudID, 'aliyun', this.state.aliID, this.state.aliKey)}>ok</Button>
-                        </div>
-                    </div>
-                    <div>
-                        <span className='cloud-name'>AWS: </span>
-                        <div style={{marginBottom: 15}}>
-                            <div>
-                                <div style={{marginBottom: 10}}>
-                                    <span className='item-title-cloud'>ID:</span>
-                                    <Input style={{width: 250}} value={this.state.aliID} onChange={this.inputChange('awsID')}/>
-                                </div>
-                                <div style={{marginBottom: 10}}>
-                                    <span className='item-title-cloud'>Key:</span>
-                                    <Input style={{width: 250}} value={this.state.aliKey} onChange={this.inputChange('awsKey')}/>
-                                </div>
-                                {
-                                    this.state.showOK === 'amazon' ?
-                                        <Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a"/>
-                                        :
-                                        this.state.showNotOK === 'amazon' ?
-                                            <span>not ok</span>
-                                            :
-                                            ""
-                                }
-                            </div>
-                            <Button type='primary'
-                                    onClick={this.submit(this.state.awsCLoudID, 'amazon', this.state.awsID, this.state.awsKey)}>ok</Button>
-                        </div>
-                    </div>
+                    {/*<div>*/}
+                        {/*<span className='cloud-name'><FormattedMessage id="Aliyun"/>: </span>*/}
+                        {/*<div style={{marginBottom: 15}}>*/}
+                            {/*<div>*/}
+                                {/*<div style={{marginBottom: 10}}>*/}
+                                    {/*<span className='item-title-cloud'>ID:</span>*/}
+                                    {/*<Input style={{width: 250}} value={this.state.aliID} onChange={this.inputChange('aliID')}/>*/}
+                                {/*</div>*/}
+                                {/*<div style={{marginBottom: 10}}>*/}
+                                    {/*<span className='item-title-cloud'>Key:</span>*/}
+                                    {/*<Input style={{width: 250}} value={this.state.aliKey} onChange={this.inputChange('aliKey')}/>*/}
+                                {/*</div>*/}
+
+                                {/*{*/}
+                                    {/*this.state.showOK === 'aliyun' ?*/}
+                                        {/*<Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a"/>*/}
+                                        {/*:*/}
+                                        {/*this.state.showNotOK === 'aliyun' ?*/}
+                                            {/*<span>not ok</span>*/}
+                                            {/*:*/}
+                                            {/*""*/}
+                                {/*}*/}
+                            {/*</div>*/}
+                            {/*<Button type='primary'*/}
+                                    {/*onClick={this.submit(this.state.aliyunCLoudID, 'aliyun', this.state.aliID, this.state.aliKey)}>*/}
+                                {/*<FormattedMessage id="save"/>*/}
+                            {/*</Button>*/}
+                        {/*</div>*/}
+                    {/*</div>*/}
+
+                    {/*<div>*/}
+                        {/*<span className='cloud-name'><FormattedMessage id="AWS"/>: </span>*/}
+                        {/*<div style={{marginBottom: 15}}>*/}
+                            {/*<div>*/}
+                                {/*<div style={{marginBottom: 10}}>*/}
+                                    {/*<span className='item-title-cloud'>ID:</span>*/}
+                                    {/*<Input style={{width: 250}} value={this.state.aliID} onChange={this.inputChange('awsID')}/>*/}
+                                {/*</div>*/}
+                                {/*<div style={{marginBottom: 10}}>*/}
+                                    {/*<span className='item-title-cloud'>Key:</span>*/}
+                                    {/*<Input style={{width: 250}} value={this.state.aliKey} onChange={this.inputChange('awsKey')}/>*/}
+                                {/*</div>*/}
+                                {/*{*/}
+                                    {/*this.state.showOK === 'amazon' ?*/}
+                                        {/*<Icon type="check-circle" theme="twoTone" twoToneColor="#52c41a"/>*/}
+                                        {/*:*/}
+                                        {/*this.state.showNotOK === 'amazon' ?*/}
+                                            {/*<span>not ok</span>*/}
+                                            {/*:*/}
+                                            {/*""*/}
+                                {/*}*/}
+                            {/*</div>*/}
+                            {/*<Button type='primary'*/}
+                                    {/*onClick={this.submit(this.state.awsCLoudID, 'amazon', this.state.awsID, this.state.awsKey)}>*/}
+                                {/*<FormattedMessage id="save"/>*/}
+                            {/*</Button>*/}
+                        {/*</div>*/}
+                    {/*</div>*/}
+
                 </div>
                 :
                 <Spin style={{marginLeft: 3}}/>

+ 1 - 1
src/login/Login.js

@@ -3,7 +3,7 @@ import LoginInput from './LoginInput';
 import CloudConfig from "./CloudConfig";
 import AccountConfig from "./AccountConfig";
 import classnames from 'classnames';
-
+import {FormattedMessage} from 'react-intl';
 import {Layout} from 'antd';
 import './index.css';
 

+ 17 - 15
src/login/LoginInput.js

@@ -1,4 +1,5 @@
 import React, {Component} from 'react';
+import {FormattedMessage} from 'react-intl';
 
 import {Input, Button, Spin, Icon} from 'antd';
 import {ADD_USER, GET_USER, SEARCH_USER} from "../gql";
@@ -39,6 +40,7 @@ class LoginInput extends Component {
 
     login = () => {
         let _this = this;
+        // let loginUrl = `http://localhost:8999/login`;
 
         axios.post(loginUrl, {
             'user-name': this.state.login_username,
@@ -79,9 +81,9 @@ class LoginInput extends Component {
 
                     return (
                         <div>
-                            <span style={{marginRight: 20}}><b>register:</b></span>
+                            <span style={{marginRight: 20}}><b><FormattedMessage id="register"/>:</b></span>
                             <div style={{marginTop: 10}}>
-                                <span>username: </span>
+                                <span><FormattedMessage id="username"/>: </span>
                                 <Input
                                     placeholder=""
                                     onChange={(e) => {
@@ -94,13 +96,13 @@ class LoginInput extends Component {
                                 />
                                 {
                                     this.state.usernameTip ?
-                                        <span><b>username has been used!</b></span>
+                                        <span><b><FormattedMessage id="username has been used"/>!</b></span>
                                         :
                                         ''
                                 }
                             </div>
                             <div style={{marginTop: 10}}>
-                                <span>password: </span>
+                                <span><FormattedMessage id="password"/>: </span>
                                 <Input
                                     placeholder=""
                                     onChange={(e) => {
@@ -111,7 +113,7 @@ class LoginInput extends Component {
                                 />
                             </div>
                             <div style={{marginTop: 10}}>
-                                <span>nickname: </span>
+                                <span><FormattedMessage id="nickname"/>: </span>
                                 <Input
                                     placeholder=""
                                     onChange={(e) => {
@@ -216,9 +218,9 @@ class LoginInput extends Component {
                                 ''
                             :
                             <div>
-                                <span style={{marginRight: 20}}><b>login:</b></span>
+                                <span style={{marginRight: 20}}><b><FormattedMessage id="login"/>:</b></span>
                                 <div style={{marginTop: 10}}>
-                                    <span>username: </span>
+                                    <span><FormattedMessage id="username"/>: </span>
                                     <Input
                                         placeholder=""
                                         onChange={(e) => {
@@ -229,7 +231,7 @@ class LoginInput extends Component {
                                     />
                                 </div>
                                 <div style={{marginTop: 10}}>
-                                    <span>password: </span>
+                                    <span><FormattedMessage id="password"/>: </span>
                                     <Input
                                         placeholder=""
                                         onChange={(e) => {
@@ -250,7 +252,7 @@ class LoginInput extends Component {
                         this.state.loginStatus === 'logined' ?
                             <div>
                                                 <span
-                                                    style={{marginRight: '10px'}}>welcome, {this.state.nickname}</span>
+                                                    style={{marginRight: '10px'}}><FormattedMessage id="Welcome"/>, {this.state.nickname}</span>
                                 <Button onClick={() => {
                                     this.setState({
                                         hasLogin: false,
@@ -258,31 +260,31 @@ class LoginInput extends Component {
                                         loginOnce: true
                                     });
                                     // cookie.remove('ring-session')
-                                }}>exit</Button>
+                                }}><FormattedMessage id="exit"/></Button>
                                 <div style={{marginTop: 20}}>
                                     <Button type="primary" style={{marginRight: 10}} onClick={() => {
                                         this.props.history.push({
                                             pathname: '/login/account',
                                         })
-                                    }}>user setting</Button>
+                                    }}><FormattedMessage id="user setting"/></Button>
                                     <Button type="primary" onClick={() => {
                                         this.props.history.push({
                                             pathname: '/login/cloud',
                                         })
-                                    }}>cloud setting</Button>
+                                    }}><FormattedMessage id="cloud setting"/></Button>
                                 </div>
                             </div>
                             :
                             this.state.loginStatus === 'failed' ?
                                 <div>
-                                    <span style={{marginRight: '10px'}}>login failed</span>
+                                    <span style={{marginRight: '10px'}}><FormattedMessage id="login failed"/></span>
                                     <Button onClick={() => {
                                         this.setState({
                                             hasLogin: false,
                                             loginStatus: '',
                                             loginOnce: true
                                         })
-                                    }}>relogin</Button>
+                                    }}><FormattedMessage id="relogin"/></Button>
                                 </div>
                                 :
                                 ''
@@ -291,7 +293,7 @@ class LoginInput extends Component {
                 <div className='register' style={{marginTop: 20}}>
                     {
                         this.state.hasRegister ?
-                            <div>ok, login please</div>
+                            <div><FormattedMessage id="ok, login please"/></div>
                             :
                             this.state.loginStatus === 'logined' ?
                                 ''

+ 2 - 1
src/login/index.css

@@ -10,7 +10,7 @@
 
 .item-title-cloud {
   display: inline-block;
-  width: 50px;
+  width: 100px;
 }
 
 .login-wrapper {
@@ -113,4 +113,5 @@
   display: inline-block;
   line-height: 36px;
   font-size: 16px;
+  padding-right: 50px;
 }