|
190 | 190 | v-decorator="['externalId']"></a-input> |
191 | 191 | </a-form-item> |
192 | 192 | <a-form-item :label="$t('label.aclid')"> |
193 | | - <a-select v-decorator="['acl']"> |
| 193 | + <a-select |
| 194 | + v-decorator="['acl',{rules: [{ required: true, message: `${$t('label.required')}` }]}]" |
| 195 | + @change="val => { this.handleNetworkAclChange(val) }"> |
194 | 196 | <a-select-option v-for="item in networkAclList" :key="item.id" :value="item.id"> |
195 | | - {{ item.name }} |
| 197 | + <strong>{{ item.name }}</strong> ({{ item.description }}) |
196 | 198 | </a-select-option> |
197 | 199 | </a-select> |
198 | 200 | </a-form-item> |
| 201 | + <a-alert v-if="this.selectedNetworkAcl.name==='default_allow'" type="warning" show-icon> |
| 202 | + <span slot="message" v-html="$t('message.network.acl.default.allow')" /> |
| 203 | + </a-alert> |
| 204 | + <a-alert v-else-if="this.selectedNetworkAcl.name==='default_deny'" type="warning" show-icon> |
| 205 | + <span slot="message" v-html="$t('message.network.acl.default.deny')" /> |
| 206 | + </a-alert> |
199 | 207 | </a-form> |
200 | 208 | </a-spin> |
201 | 209 | </a-modal> |
@@ -279,6 +287,7 @@ export default { |
279 | 287 | showAddInternalLB: false, |
280 | 288 | networkOfferings: [], |
281 | 289 | networkAclList: [], |
| 290 | + selectedNetworkAcl: {}, |
282 | 291 | modalLoading: false, |
283 | 292 | internalLB: {}, |
284 | 293 | LBPublicIPs: {}, |
@@ -412,11 +421,7 @@ export default { |
412 | 421 | this.modalLoading = true |
413 | 422 | api('listNetworkACLLists', { vpcid: this.resource.id }).then(json => { |
414 | 423 | this.networkAclList = json.listnetworkacllistsresponse.networkacllist || [] |
415 | | - this.$nextTick(function () { |
416 | | - this.form.setFieldsValue({ |
417 | | - acl: this.networkAclList[0].id |
418 | | - }) |
419 | | - }) |
| 424 | + this.handleNetworkAclChange(null) |
420 | 425 | }).catch(error => { |
421 | 426 | this.$notifyError(error) |
422 | 427 | }).finally(() => { |
@@ -519,6 +524,13 @@ export default { |
519 | 524 | this.fetchLoading = false |
520 | 525 | }) |
521 | 526 | }, |
| 527 | + handleNetworkAclChange (aclId) { |
| 528 | + if (aclId) { |
| 529 | + this.selectedNetworkAcl = this.networkAclList.filter(acl => acl.id === aclId)[0] |
| 530 | + } else { |
| 531 | + this.selectedNetworkAcl = {} |
| 532 | + } |
| 533 | + }, |
522 | 534 | closeModal () { |
523 | 535 | this.$emit('close-action') |
524 | 536 | }, |
|
0 commit comments