Pārlūkot izejas kodu

bug fixed - apigroup region

xy 7 gadi atpakaļ
vecāks
revīzija
a131ead24a

+ 1 - 1
src/components/common/deploy/tencent/APIGroupCard.js

@@ -82,7 +82,7 @@ class APIGroupCard extends Component {
                         </div>
                         <div style={{marginBottom: 10}}>
                             <span className='vice-title'>region: </span>
-                            <Radio.Group onChange={this.switchConfig('groupRegion')} defaultValue={this.state.groupRegion} buttonStyle="solid">
+                            <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>

+ 20 - 20
src/components/common/deploy/tencent/DeployCard.js

@@ -36,11 +36,11 @@ class DeployCard extends Component {
     }
 
     componentWillReceiveProps(next) {
-        if(next.deploy !== '') {
+        if (next.deploy !== '') {
             let {functionName, cosBucketName, cosObjectName, cosBucketRegion, serviceName, vpcId, subnetId, region} = next.deploy;
-            this.setState( {
+            this.setState({
                 functionName,
-                // region,
+                region,
                 cosBucketName,
                 cosObjectName,
                 cosBucketRegion,
@@ -49,7 +49,7 @@ class DeployCard extends Component {
                 subnetId
             })
         } else {
-            this.setState ( {
+            this.setState({
                 functionName: next.schemaName,
                 region: next.region,
                 cosBucketName: 'graphqlfc',
@@ -86,26 +86,26 @@ class DeployCard extends Component {
                     <Input value={this.state.functionName} style={{width: 400}}
                            onChange={this.switchConfig('functionName')}/>
                 </div>
-                {/*// todo: 不知道为啥, radio group 放在这里就是不对*/}
+                <div style={{marginBottom: 10}}>
+                    <span className='vice-title'>region: </span>
+                    <Radio.Group onChange={(e) => {
+                        this.props.switchRegion(e);
+                        this.setState({
+                            region: e.target.value
+                        })
+                    }} defaultValue={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>
+                        <Radio.Button value="chengdu">Chengdu</Radio.Button>
+                    </Radio.Group>
+                </div>
                 <Collapse bordered={false}>
                     <Panel header="Want more options?" style={customPanelStyle}>
-                        <div style={{marginBottom: 10}}>
-                            <span className='vice-title'>region: </span>
-                            <Radio.Group onChange={(e)=>{
-                                this.props.switchRegion(e);
-                                this.setState({
-                                    region: e.target.value
-                                })
-                            }} defaultValue={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>
-                                <Radio.Button value="chengdu">Chengdu</Radio.Button>
-                            </Radio.Group>
-                        </div>
                         <div style={{marginBottom: 10}}>
                             <span className='vice-title'>cosBucketRegion: </span>
-                            <Radio.Group onChange={this.switchConfig('cosBucketRegion')} value={this.state.cosBucketRegion} buttonStyle="solid">
+                            <Radio.Group onChange={this.switchConfig('cosBucketRegion')}
+                                         value={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>