Ver Fonte

限制内网填写

xy há 7 anos atrás
pai
commit
e110e3054d
1 ficheiros alterados com 22 adições e 13 exclusões
  1. 22 13
      src/app/common/deploy/tencent/DeployCard.js

+ 22 - 13
src/app/common/deploy/tencent/DeployCard.js

@@ -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>
                             ))