浏览代码

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

wly 7 年之前
父节点
当前提交
af0cea4c5c

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

@@ -34,7 +34,7 @@ p.show {
 }
 
 .vice-title {
-    width: 120px;
+    width: 150px;
     display: inline-block;
 }
 

+ 109 - 44
src/app/common/deploy/tencent/APIGroupCard.js

@@ -1,5 +1,5 @@
 import React, {Component} from 'react';
-import {Input, Collapse, Button, Radio, Icon} from 'antd';
+import {Input, Collapse, Button, Radio, Icon, Tooltip} from 'antd';
 import {ADD_APIGROUP, UPDATE_APIGROUP} from "../../../../gql";
 import {request} from 'graphql-request'
 import {idGen} from "../../../../func";
@@ -21,6 +21,26 @@ const valueToKey = {
     'region': 'region',
 };
 
+const toolTipTitle = {
+    'groupName': 'its groupName',
+    'environmentName': 'its environmentName',
+    'defaultDomain': 'its defaultDomain',
+    'frontType': 'its frontType',
+    'userDomain': 'its userDomain',
+    'userStatus': 'its userStatus',
+    'region': 'its region',
+};
+
+const removePrefix = (prefix, value) => {
+    let r = new RegExp(prefix);
+    return value.replace(r, '');
+};
+
+const shiftPrefix = (prefix, value) => {
+    value = removePrefix(prefix, value);
+    return prefix + value;
+};
+
 class APIGroupCard extends Component {
     constructor(props) {
         super(props);
@@ -59,7 +79,7 @@ class APIGroupCard extends Component {
                 frontType,
                 userDomain,
                 userStatus,
-                groupRegion: region
+                groupRegion: next.region === '' ? region: next.region
             })
         } else {
             this.setState ( {
@@ -69,7 +89,7 @@ class APIGroupCard extends Component {
                 frontType: 'http&https',
                 userDomain: '',
                 userStatus: 'open',
-                groupRegion: next.region
+                groupRegion: next.region === '' ? 'ap-beijing' : next.region
             });
         }
     };
@@ -83,7 +103,8 @@ class APIGroupCard extends Component {
     };
 
     ok = (id) => {
-        let {userStatus, userDomain, groupName, frontType, environmentName} = this.state;
+        let {userStatus, userDomain, groupName, groupRegion, frontType, environmentName} = this.state;
+        let region = shiftPrefix('ap-', groupRegion);
         let varObj = {
             id,
             cloud_id: this.props.cloudID,
@@ -92,7 +113,7 @@ class APIGroupCard extends Component {
             userDomain,
             groupName,
             frontType,
-            region: this.state.groupRegion,
+            region,
             environmentName,
             defaultDomain: '',
             status: '',
@@ -116,14 +137,15 @@ class APIGroupCard extends Component {
                 }
             )
         } else {
-            let {userStatus, userDomain, groupName, frontType, environmentName} = this.state;
+            let {userStatus, userDomain, groupName, groupRegion, frontType, environmentName} = this.state;
+            let region = shiftPrefix('ap-', groupRegion);
             let varObj = {
                 id: this.props.group.id,
                 userStatus,
                 userDomain,
                 groupName,
                 frontType,
-                region: this.state.groupRegion,
+                region,
                 environmentName,
                 updatedAt: new Date().getTime()
             };
@@ -155,24 +177,60 @@ class APIGroupCard extends Component {
 
         return (
             <div>
+                <div style={{marginBottom: 10}}>
+                            <span className='vice-title'>{valueToKey['groupName']}
+                                <span> </span>
+                                <Tooltip placement="top" title={toolTipTitle['groupName']}>
+                                    <Icon type="question-circle"/>
+                                </Tooltip>
+                            </span>
+                    <Input value={this.state.groupName} style={{width: 400}}
+                           onChange={this.switchConfig('groupName')}/>
+                </div>
+
+                <div style={{marginBottom: 10}}>
+                            <span className='vice-title'>{valueToKey['region']}
+                                <span> </span>
+                                <Tooltip placement="top" title={toolTipTitle['region']}>
+                                    <Icon type="question-circle"/>
+                                </Tooltip>
+                            </span>
+                    <Radio.Group onChange={(e)=>{
+                        // 如果不想一变所有都变,就将 onchange 改成
+                        // onChange={this.switchConfig('groupRegion')}
+                        this.props.switchRegion(e);
+                    }} value={removePrefix('ap-', this.state.groupRegion)} buttonStyle="solid">
+                        <Radio.Button value="guangzhou">Guangzhou</Radio.Button>
+                        <Radio.Button value="shanghai">Shanghai</Radio.Button>
+                        <Radio.Button value="beijing">Beijing</Radio.Button>
+                        <Radio.Button value="chengdu">Chengdu</Radio.Button>
+                    </Radio.Group>
+                </div>
+
+                <div style={{marginBottom: 10}}>
+                            <span className='vice-title'>{valueToKey['environmentName']}
+                                <span> </span>
+                                <Tooltip placement="top" title={toolTipTitle['environmentName']}>
+                                    <Icon type="question-circle"/>
+                                </Tooltip>
+                            </span>
+                    <Radio.Group onChange={this.switchConfig('environmentName')} defaultValue={this.state.environmentName}
+                                 buttonStyle="solid">
+                        <Radio.Button value="test">test</Radio.Button>
+                        <Radio.Button value="prepub">prepub</Radio.Button>
+                        <Radio.Button value="release">release</Radio.Button>
+                    </Radio.Group>
+                </div>
                 <Collapse bordered={false}>
                     <Panel header="Want more options?" style={customPanelStyle}>
+
                         <div style={{marginBottom: 10}}>
-                            <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'>{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>
-                                <Radio.Button value="beijing">Beijing</Radio.Button>
-                                <Radio.Button value="chengdu">Chengdu</Radio.Button>
-                            </Radio.Group>
-                        </div>
-                        <div style={{marginBottom: 10}}>
-                            <span className='vice-title'>{valueToKey['frontType']}: </span>
+                            <span className='vice-title'>{valueToKey['frontType']}
+                                <span> </span>
+                                <Tooltip placement="top" title={toolTipTitle['frontType']}>
+                                    <Icon type="question-circle"/>
+                                </Tooltip>
+                            </span>
                             <Radio.Group onChange={this.switchConfig('frontType')} defaultValue={this.state.frontType}
                                          buttonStyle="solid">
                                 <Radio.Button value="http">http</Radio.Button>
@@ -180,32 +238,39 @@ class APIGroupCard extends Component {
                                 <Radio.Button value="http&https">http&https</Radio.Button>
                             </Radio.Group>
                         </div>
+                        {/*<div style={{marginBottom: 10}}>*/}
+                            {/*<span className='vice-title'>{valueToKey['defaultDomain']}*/}
+                                {/*<span> </span>*/}
+                                {/*<Tooltip placement="top" title={toolTipTitle['defaultDomain']}>*/}
+                                    {/*<Icon type="question-circle"/>*/}
+                                {/*</Tooltip>*/}
+                            {/*</span>*/}
+                            {/*<Input value={this.state.defaultDomain} style={{width: 400}} disabled/>*/}
+                        {/*</div>*/}
+
                         <div style={{marginBottom: 10}}>
-                            <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'>{valueToKey['environmentName']}: </span>
-                            <Radio.Group onChange={this.switchConfig('environmentName')} defaultValue={this.state.environmentName}
-                                         buttonStyle="solid">
-                                <Radio.Button value="test">test</Radio.Button>
-                                <Radio.Button value="prepub">prepub</Radio.Button>
-                                <Radio.Button value="release">release</Radio.Button>
-                            </Radio.Group>
-                        </div>
-                        <div style={{marginBottom: 10}}>
-                            <span className='vice-title'>{valueToKey['userDomain']}: </span>
+                            <span className='vice-title'>{valueToKey['userDomain']}
+                                <span> </span>
+                                <Tooltip placement="top" title={toolTipTitle['userDomain']}>
+                                    <Icon type="question-circle"/>
+                                </Tooltip>
+                            </span>
                             <Input value={this.state.userDomain} style={{width: 400}}
                                    onChange={this.switchConfig('userDomain')}/>
                         </div>
-                        <div style={{marginBottom: 10}}>
-                            <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>
-                                <Radio.Button value="close">close</Radio.Button>
-                            </Radio.Group>
-                        </div>
+                        {/*<div style={{marginBottom: 10}}>*/}
+                            {/*<span className='vice-title'>{valueToKey['userStatus']}*/}
+                                {/*<span> </span>*/}
+                                {/*<Tooltip placement="top" title={toolTipTitle['userStatus']}>*/}
+                                    {/*<Icon type="question-circle"/>*/}
+                                {/*</Tooltip>*/}
+                            {/*</span>*/}
+                            {/*<Radio.Group onChange={this.switchConfig('userStatus')} defaultValue={this.state.userStatus}*/}
+                                         {/*buttonStyle="solid">*/}
+                                {/*<Radio.Button value="open">open</Radio.Button>*/}
+                                {/*<Radio.Button value="close">close</Radio.Button>*/}
+                            {/*</Radio.Group>*/}
+                        {/*</div>*/}
                     </Panel>
                 </Collapse>
                 {

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

@@ -1,5 +1,5 @@
 import React, {Component} from 'react';
-import {Input, Radio, Collapse, Button, Icon} from 'antd';
+import {Input, Radio, Collapse, Button, Icon, Tooltip} from 'antd';
 import {request} from 'graphql-request'
 import {ADD_APIGWPATH, UPDATE_APIGWPATH} from "../../../../gql";
 import {idGen} from "../../../../func";
@@ -17,6 +17,12 @@ const valueToKey = {
     'requestMethod': 'Method'
 };
 
+const toolTipTitle = {
+    'apiGWName': 'its apiGWName',
+    'apiGWDesc': 'its apiGWDesc',
+    'requestMethod': 'its requestMethod'
+};
+
 class APIPathCard extends Component {
     constructor(props) {
         super(props);
@@ -141,14 +147,24 @@ class APIPathCard extends Component {
                         {
                             this.state.configs.map(config => (
                                 <div key={config} style={{marginBottom: 10}}>
-                                    <span className='vice-title'>{valueToKey[config]}: </span>
+                                    <span className='vice-title'>{valueToKey[config]}
+                                        <span> </span>
+                                        <Tooltip placement="top" title={toolTipTitle[config]}>
+                                            <Icon type="question-circle"/>
+                                        </Tooltip>
+                                    </span>
                                     <Input value={this.state[config]} style={{width: 200}}
                                            onChange={this.switchConfig(config)}/>
                                 </div>
                             ))
                         }
                         <div style={{marginBottom: 10}}>
-                            <span className='vice-title'>{valueToKey['requestMethod']}: </span>
+                            <span className='vice-title'>{valueToKey['requestMethod']}
+                                <span> </span>
+                                <Tooltip placement="top" title={toolTipTitle['requestMethod']}>
+                                    <Icon type="question-circle"/>
+                                </Tooltip>
+                            </span>
                             <Radio.Group onChange={this.switchConfig('requestMethod')}
                                          defaultValue={this.state.requestMethod}
                                          buttonStyle="solid">

+ 73 - 20
src/app/common/deploy/tencent/DeployCard.js

@@ -1,5 +1,5 @@
 import React, {Component} from 'react';
-import {Input, Radio, Collapse, Button, Icon} from 'antd';
+import {Input, Radio, Collapse, Button, Icon, Tooltip} from 'antd';
 import {ADD_DEPLOY, UPDATE_DEPLOY} from "../../../../gql";
 import {request} from 'graphql-request'
 import {idGen} from "../../../../func";
@@ -23,6 +23,28 @@ const valueToKey = {
     'description': 'description',
 };
 
+const toolTipTitle = {
+    'functionName': 'its funcname',
+    'cosBucketName': 'its cosBucketName',
+    'cosObjectName': 'its cosObjectName',
+    'cosBucketRegion': 'its cosBucketRegion',
+    'serviceName': 'its serviceName',
+    'subnetId': 'its subnetId',
+    'vpcId': 'its vpcId',
+    'region': 'its region',
+    'description': 'its description',
+};
+
+const removePrefix = (prefix, value) => {
+    let r = new RegExp(prefix);
+    return value.replace(r, '');
+};
+
+const shiftPrefix = (prefix, value) => {
+    value = removePrefix(prefix, value);
+    return prefix + value;
+};
+
 class DeployCard extends Component {
     constructor(props) {
         super(props);
@@ -63,10 +85,10 @@ class DeployCard extends Component {
             this.setState({
                 description,
                 functionName,
-                region,
+                region: next.region === '' ? region: next.region,
                 cosBucketName,
                 cosObjectName,
-                cosBucketRegion,
+                cosBucketRegion: next.region === '' ? cosBucketRegion : next.region,
                 serviceName,
                 vpcId,
                 subnetId
@@ -74,10 +96,10 @@ class DeployCard extends Component {
         } else {
             this.setState({
                 functionName: next.defalutName,
-                region: next.region,
+                region: next.region === '' ? 'ap-beijing': next.region,
                 cosBucketName: 'graphqlfc',
                 cosObjectName: next.defalutName,
-                cosBucketRegion: next.region,
+                cosBucketRegion: next.region === '' ? 'ap-beijing' : next.region,
                 serviceName: '',
                 vpcId: '',
                 subnetId: ''
@@ -95,6 +117,8 @@ class DeployCard extends Component {
 
     ok = (id) => {
         let {description, cosBucketName, subnetId, cosObjectName, region, vpcId, cosBucketRegion, functionName} = this.state;
+        region = shiftPrefix('ap-', region);
+        cosBucketRegion = shiftPrefix('ap-', cosBucketRegion);
         let varObj = {
             id,
             cloud_id: this.props.cloudID,
@@ -132,6 +156,8 @@ class DeployCard extends Component {
             )
         } else {
             let {description, cosBucketName, subnetId, cosObjectName, region, vpcId, cosBucketRegion, functionName} = this.state;
+            region = shiftPrefix('ap-', region);
+            cosBucketRegion = shiftPrefix('ap-', cosBucketRegion);
             let varObj = {
                 id: this.props.deploy.id,
                 description,
@@ -173,18 +199,25 @@ class DeployCard extends Component {
         return (
             <div>
                 <div style={{marginBottom: 10}}>
-                    <span className='vice-title'>{valueToKey['functionName']}: </span>
+                    <span className='vice-title'>{valueToKey['functionName']}
+                        <span> </span>
+                        <Tooltip placement="top" title={toolTipTitle['functionName']}>
+                            <Icon type="question-circle"/>
+                        </Tooltip>
+                    </span>
                     <Input value={this.state.functionName} style={{width: 400}}
                            onChange={this.switchConfig('functionName')}/>
                 </div>
                 <div style={{marginBottom: 10}}>
-                    <span className='vice-title'>{valueToKey['region']}: </span>
+                    <span className='vice-title'>{valueToKey['region']}
+                        <span> </span>
+                        <Tooltip placement="top" title={toolTipTitle['region']}>
+                            <Icon type="question-circle"/>
+                        </Tooltip>
+                    </span>
                     <Radio.Group onChange={(e) => {
                         this.props.switchRegion(e);
-                        this.setState({
-                            region: e.target.value
-                        })
-                    }} defaultValue={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>
@@ -194,24 +227,44 @@ class DeployCard extends Component {
                 <Collapse bordered={false}>
                     <Panel header="Want more options?" style={customPanelStyle}>
                         <div style={{marginBottom: 10}}>
-                            <span className='vice-title'>{valueToKey['cosBucketRegion']}: </span>
-                            <Radio.Group onChange={this.switchConfig('cosBucketRegion')}
-                                         value={this.state.cosBucketRegion} buttonStyle="solid">
+                            <span className='vice-title'>{valueToKey['cosBucketRegion']}
+                                <span> </span>
+                                <Tooltip placement="top" title={toolTipTitle['cosBucketRegion']}>
+                                    <Icon type="question-circle"/>
+                                </Tooltip>
+                            </span>
+                            <Radio.Group onChange={(e)=>{
+                                // 如果不想一变所有都变,就将 onchange 改成
+                                // onChange={this.switchConfig('cosBucketRegion')}
+                                this.props.switchRegion(e);
+                            }} defaultValue={this.state.region}
+                                         value={removePrefix('ap-', this.state.cosBucketRegion)} buttonStyle="solid">
                                 <Radio.Button value="guangzhou">Guangzhou</Radio.Button>
                                 <Radio.Button value="shanghai">Shanghai</Radio.Button>
                                 <Radio.Button value="beijing">Beijing</Radio.Button>
                                 <Radio.Button value="chengdu">Chengdu</Radio.Button>
                             </Radio.Group>
                         </div>
-                        <div style={{marginBottom: 10}}>
-                            <span className='vice-title'>{valueToKey['serviceName']}: </span>
-                            <Input value={this.state.serviceName} style={{width: 200}} disabled
-                                   onChange={this.switchConfig('serviceName')}/>
-                        </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')}/>*/}
+                        {/*</div>*/}
                         {
                             this.state.configs.map(config => (
                                 <div key={config} style={{marginBottom: 10}}>
-                                    <span className='vice-title'>{valueToKey[config]}: </span>
+                                    <span className='vice-title'>{valueToKey[config]}
+                                        <span> </span>
+                                        <Tooltip placement="top" title={toolTipTitle[config]}>
+                                            <Icon type="question-circle"/>
+                                        </Tooltip>
+                                    </span>
                                     <Input value={this.state[config]} style={{width: 200}}
                                            onChange={this.switchConfig(config)}/>
                                 </div>

+ 3 - 2
src/app/common/deploy/tencent/TencentConfig.js

@@ -16,7 +16,7 @@ class TencentConfig extends Component {
     constructor(props) {
         super(props);
         this.state = {
-            region: 'beijing',
+            region: '',
             deploys: [],
             currentDeploy: '',
             groups: [],
@@ -39,7 +39,8 @@ class TencentConfig extends Component {
         this.setState({
             fc: next.fc,
             cloudID: next.cloudID,
-            couldDeploy: false
+            couldDeploy: false,
+            region: ''
         }, this.fetch);
     }
 

+ 1 - 1
src/app/wechatService/wxConfig/index.css

@@ -1,4 +1,4 @@
 .vice-title {
-  width: 120px;
+  width: 150px;
   display: inline-block;
 }

+ 1 - 1
src/login/AccountConfig.js

@@ -185,7 +185,7 @@ class EditNickname extends Component {
                     <span className={'message-content'}>
                         <Input/>
                         <Button type={'primary'}><FormattedMessage id="save"/></Button>
-                        <Button onClick={() => this.props.cancelEdit(this.props.kind)}><FormattedMessage id="cancel"/></Button>
+                        <Button onClick={() => this.props.cancelEdit('nickname')}><FormattedMessage id="cancel"/></Button>
                     </span>
                 </Col>
             </Row>