Browse Source

整合, 修改 deploy 的名称显示

xy 7 years ago
parent
commit
79761f1264

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

@@ -8,7 +8,18 @@ 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) {
@@ -147,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>
@@ -161,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>
@@ -170,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>
@@ -183,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>

+ 10 - 3
src/app/common/deploy/tencent/APIPathCard.js

@@ -8,7 +8,14 @@ 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) {
@@ -134,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">

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

@@ -8,16 +8,19 @@ import {manageUsers} from "../../../../config";
 
 const Panel = Collapse.Panel;
 
+// 如需改变显示,请在此处 value 处更改
+// 如需添加中文,请在此处 value 处添加
+// eg: 'xxxx': <F..  id='xxx'/>
 const valueToKey = {
-    'functionName': '',
-    'cosBucketName': '',
-    'cosObjectName': '',
-    'cosBucketRegion': '',
-    'serviceName': '',
-    'subnetId': '',
-    'vpcId': '',
-    'region': '',
-    'description': '',
+    'functionName': 'Name',
+    'cosBucketName': 'cosBucketName',
+    'cosObjectName': 'cosObjectName',
+    'cosBucketRegion': 'cosBucketRegion',
+    'serviceName': 'serviceName',
+    'subnetId': 'subnetId',
+    'vpcId': 'vpcId',
+    'region': 'region',
+    'description': 'description',
 };
 
 class DeployCard extends Component {
@@ -41,7 +44,7 @@ class DeployCard extends Component {
             :
             this.state = {
                 configs: ['description', 'cosBucketName', 'cosObjectName', 'vpcId', 'subnetId'],
-                description: props.description,
+                description: '',
                 showOK: false,
                 functionName: props.defalutName,
                 region: props.region,
@@ -170,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({
@@ -191,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>
@@ -201,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>

+ 9 - 5
src/config.js

@@ -8,14 +8,18 @@ const backend = serverIP + ':' + backendPort;
 const graphqlUrl = serverIP + ':' + graphqlPort + '/graphql';
 
 // api 配置
-const genJsUrl = backend + '/graphql/genjs';
-const checkSchemaUrl = backend + '/graphql/compile';
-const deployUrl = backend + '/graphql/deployall';
 const getIdUrl = backend + '/getuserid';
-const loginUrl = backend +  '/login';
+const loginUrl = backend + '/login';
 const registerUrl = backend + '/resetpassword';
 
+// 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 {genJsUrl, getIdUrl, loginUrl, registerUrl,checkSchemaUrl,deployUrl, graphqlUrl, manageUsers}
+export {getIdUrl, loginUrl, registerUrl, checkSchemaUrl, deployUrl, genJsUrl, graphqlUrl, manageUsers}