Răsfoiți Sursa

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

wly 7 ani în urmă
părinte
comite
4f9acb02e8

+ 24 - 15
src/app/common/deploy/tencent/DeployCard.js

@@ -51,7 +51,7 @@ class DeployCard extends Component {
         let {functionName, cosBucketName, cosObjectName, cosBucketRegion, serviceName, vpcId, subnetId, region, description} = props.deploy;
         props.deploy !== '' ?
             this.state = {
-                configs: ['description', 'cosBucketName', 'cosObjectName', 'vpcId', 'subnetId'],
+                configs: ['cosBucketName', 'cosObjectName', 'description', 'vpcId', 'subnetId'],
                 description,
                 showOK: false,
                 functionName,
@@ -65,7 +65,7 @@ class DeployCard extends Component {
             }
             :
             this.state = {
-                configs: ['description', 'cosBucketName', 'cosObjectName', 'vpcId', 'subnetId'],
+                configs: ['cosBucketName', 'cosObjectName', 'description', 'vpcId', 'subnetId'],
                 description: '',
                 showOK: false,
                 functionName: props.defalutName,
@@ -76,7 +76,7 @@ class DeployCard extends Component {
                 serviceName: '',
                 vpcId: '',
                 subnetId: '',
-            }
+            };
     }
 
     componentWillReceiveProps(next) {
@@ -85,7 +85,7 @@ class DeployCard extends Component {
             this.setState({
                 description,
                 functionName,
-                region: next.region === '' ? region: next.region,
+                region: next.region === '' ? region : next.region,
                 cosBucketName,
                 cosObjectName,
                 cosBucketRegion: next.region === '' ? cosBucketRegion : next.region,
@@ -96,7 +96,7 @@ class DeployCard extends Component {
         } else {
             this.setState({
                 functionName: next.defalutName,
-                region: next.region === '' ? 'ap-beijing': next.region,
+                region: next.region === '' ? 'ap-beijing' : next.region,
                 cosBucketName: 'graphqlfc',
                 cosObjectName: next.defalutName,
                 cosBucketRegion: next.region === '' ? 'ap-beijing' : next.region,
@@ -196,6 +196,13 @@ class DeployCard extends Component {
             overflow: 'hidden',
         };
 
+        const ioobotCloudID = ['tencent_CloudID', 'aliyun_CloudID'];
+
+        const disable = {
+            'subnetId': ioobotCloudID.includes(this.props.cloudID) ? true : '',
+            'vpcId': ioobotCloudID.includes(this.props.cloudID) ? true : '',
+        };
+
         return (
             <div>
                 <div style={{marginBottom: 10}}>
@@ -217,7 +224,8 @@ class DeployCard extends Component {
                     </span>
                     <Radio.Group onChange={(e) => {
                         this.props.switchRegion(e);
-                    }} defaultValue={this.state.region} value={removePrefix('ap-', this.state.region)} buttonStyle="solid">
+                    }} defaultValue={this.state.region} value={removePrefix('ap-', this.state.region)}
+                                 buttonStyle="solid">
                         <Radio.Button value="guangzhou">Guangzhou</Radio.Button>
                         <Radio.Button value="shanghai">Shanghai</Radio.Button>
                         <Radio.Button value="beijing">Beijing</Radio.Button>
@@ -233,7 +241,7 @@ class DeployCard extends Component {
                                     <Icon type="question-circle"/>
                                 </Tooltip>
                             </span>
-                            <Radio.Group onChange={(e)=>{
+                            <Radio.Group onChange={(e) => {
                                 // 如果不想一变所有都变,就将 onchange 改成
                                 // onChange={this.switchConfig('cosBucketRegion')}
                                 this.props.switchRegion(e);
@@ -247,14 +255,14 @@ class DeployCard extends Component {
                         </div>
                         {/*腾讯云为空字符串,不显示,这里未作区分*/}
                         {/*<div style={{marginBottom: 10}}>*/}
-                            {/*<span className='vice-title'>{valueToKey['serviceName']}*/}
-                                {/*<span> </span>*/}
-                                {/*<Tooltip placement="top" title={toolTipTitle['serviceName']}>*/}
-                                    {/*<Icon type="question-circle"/>*/}
-                                {/*</Tooltip>*/}
-                            {/*</span>*/}
-                            {/*<Input value={this.state.serviceName} style={{width: 200}} disabled*/}
-                                   {/*onChange={this.switchConfig('serviceName')}/>*/}
+                        {/*<span className='vice-title'>{valueToKey['serviceName']}*/}
+                        {/*<span> </span>*/}
+                        {/*<Tooltip placement="top" title={toolTipTitle['serviceName']}>*/}
+                        {/*<Icon type="question-circle"/>*/}
+                        {/*</Tooltip>*/}
+                        {/*</span>*/}
+                        {/*<Input value={this.state.serviceName} style={{width: 200}} disabled*/}
+                        {/*onChange={this.switchConfig('serviceName')}/>*/}
                         {/*</div>*/}
                         {
                             this.state.configs.map(config => (
@@ -266,6 +274,7 @@ class DeployCard extends Component {
                                         </Tooltip>
                                     </span>
                                     <Input value={this.state[config]} style={{width: 200}}
+                                           disabled={disable[config] === true}
                                            onChange={this.switchConfig(config)}/>
                                 </div>
                             ))

+ 44 - 29
src/app/graphqlService/component/schema/Create.js

@@ -1,6 +1,6 @@
 import React, {Component} from 'react';
-import { withRouter } from "react-router-dom";
-import {Modal,Row, Col, Input, Icon, Button, Spin} from 'antd';
+import {withRouter} from "react-router-dom";
+import {Modal, Row, Col, Input, Icon, Button, Spin} from 'antd';
 
 import {Mutation, Query} from "react-apollo";
 import gql from "graphql-tag";
@@ -9,6 +9,7 @@ import {SHOW_SCHEMA, ADD_SCHEMA} from '../../../../gql'
 import './index.css';
 import {getCookie} from "../../../../cookie";
 import {idGen} from "../../../../func";
+import {FormattedMessage} from 'react-intl';
 
 class Create extends Component {
     constructor(props) {
@@ -66,9 +67,9 @@ class Create extends Component {
         this.props.switchSidebar(schemaName);
         this.props.history.push({
             pathname: `/graphql-service/my-create/${schemaName}`,
-            state:{
+            state: {
                 schemaName,
-                schemaID:varobj.id,
+                schemaID: varobj.id,
                 create: true
             }
         });
@@ -91,31 +92,45 @@ class Create extends Component {
                         if (error)
                             return 'error';
                         return (
-                            <Modal title="Create Graphql Service"
-                                   centered
-                                   visible={visible}
-                                   onOk={() => this.handleOk(userID, create_schema)}
-                                   confirmLoading={confirmLoading}
-                                   onCancel={() => {this.props.hideModal();}}
-                            >
-                                <div>
-                                    <p>schema name</p>
-                                    <Input
-                                        className='add-input'
-                                        placeholder="input schema_name"
-                                        onChange={e => {
-                                            e.persist();
-                                            this.setState({
-                                                schemaName: e.target.value,
-                                            });
-                                            if(userID === '' || undefined) {
-                                                this.redirectToLogin();
-                                                this.props.hideModal();
-                                            }
-                                        }}
-                                    />
-                                </div>
-                            </Modal>
+                            <FormattedMessage id="Create Graphql Service">
+                                {(msg) => (
+                                    <Modal title={msg}
+                                           centered
+                                           visible={visible}
+                                           onOk={() => this.handleOk(userID, create_schema)}
+                                           confirmLoading={confirmLoading}
+                                           onCancel={() => {
+                                               this.props.hideModal();
+                                           }}
+                                    >
+                                        <div>
+                                            <p><FormattedMessage id="schema name"/></p>
+                                            <FormattedMessage id="input schema_name">
+                                                {(msg) => (
+                                                        <Input
+                                                            className='add-input'
+                                                            placeholder={msg}
+                                                            onChange={e => {
+                                                                e.persist();
+                                                                this.setState({
+                                                                    schemaName: e.target.value,
+                                                                });
+                                                                if (userID === '' || undefined) {
+                                                                    this.redirectToLogin();
+                                                                    this.props.hideModal();
+                                                                }
+                                                            }}
+                                                        />
+                                                    )
+                                                }
+
+                                            </FormattedMessage>
+
+                                        </div>
+                                    </Modal>
+                                )}
+                            </FormattedMessage>
+
                         )
                     }}
                 </Mutation>

+ 4 - 0
src/language/en_US.js

@@ -20,6 +20,10 @@ const en_US = {
     "login":"login",
     "Download":"Download",
 
+    "Create Graphql Service": 'Create Graphql Service',
+    "schema name": 'schema name',
+    "input schema_name": 'input schema_name',
+
     "Name":"Name",
     "name":"name",
     "type":"type",

+ 7 - 2
src/language/zh_CN.js

@@ -20,11 +20,15 @@ const zh_CN = {
     "login":"登陆",
     "Download":"下载",
 
+    "Create Graphql Service": '创建 Graphql服务',
+    "schema name": '表名',
+    "input schema_name": '请输入表名',
+
     "Name":"名称",
     "name":"名称",
     "type":"类型",
-    "description":"description",
-    "Remark":"描述",
+    "description":"描述",
+    "Remark":"备注",
     "copy":"复制",
     "Table":"表",
     "fields":"字段",
@@ -38,6 +42,7 @@ const zh_CN = {
     // deploy相关
     "Deploy":"部署",
 
+
     //account 个人中心相关
     "Account center":"账户中心",
     "Cloud settings":"云服务商配置",