Przeglądaj źródła

修改地区一致

xy 7 lat temu
rodzic
commit
1a28a14211

+ 22 - 16
src/app/common/deploy/tencent/APIGroupCard.js

@@ -78,7 +78,7 @@ class APIGroupCard extends Component {
                 frontType,
                 userDomain,
                 userStatus,
-                groupRegion: region
+                groupRegion: next.region === '' ? region: next.region
             })
         } else {
             this.setState ( {
@@ -88,7 +88,7 @@ class APIGroupCard extends Component {
                 frontType: 'http&https',
                 userDomain: '',
                 userStatus: 'open',
-                groupRegion: next.region
+                groupRegion: next.region === '' ? 'ap-beijing' : next.region
             });
         }
     };
@@ -186,6 +186,26 @@ class APIGroupCard extends Component {
                     <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>
@@ -203,20 +223,6 @@ class APIGroupCard extends Component {
                 <Collapse bordered={false}>
                     <Panel header="Want more options?" style={customPanelStyle}>
 
-                        {/*<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={this.switchConfig('groupRegion')} 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['frontType']}
                                 <span> </span>

+ 9 - 8
src/app/common/deploy/tencent/DeployCard.js

@@ -84,10 +84,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
@@ -95,10 +95,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: ''
@@ -216,9 +216,6 @@ class DeployCard extends Component {
                     </span>
                     <Radio.Group onChange={(e) => {
                         this.props.switchRegion(e);
-                        this.setState({
-                            region: e.target.value
-                        })
                     }} 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>
@@ -235,7 +232,11 @@ class DeployCard extends Component {
                                     <Icon type="question-circle"/>
                                 </Tooltip>
                             </span>
-                            <Radio.Group onChange={this.switchConfig('cosBucketRegion')} defaultValue={this.state.region}
+                            <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>

+ 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);
     }