Skip to content

Commit c6ba3d1

Browse files
ui: Make 'ACL' field as mandatory and add warning message for default_allow and default_deny (#5003)
Co-authored-by: Wei Zhou <weizhouapache@gmail.com>
1 parent 5cbc1d9 commit c6ba3d1

3 files changed

Lines changed: 22 additions & 8 deletions

File tree

ui/public/locales/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2953,6 +2953,8 @@
29532953
"message.move.acl.order.failed": "Failed to move ACL rule",
29542954
"message.move.acl.order.processing": "Moving ACL rule...",
29552955
"message.ncc.delete.confirm": "Please confirm you want to delete this NCC",
2956+
"message.network.acl.default.allow": "Warning: With this policy all traffic will be allowed through the firewall to this VPC tier. You should consider securing your network.",
2957+
"message.network.acl.default.deny": "Warning: With this policy all traffic will be denied through the firewall to this VPC tier. In order to allow traffic through you will need to change policies.",
29562958
"message.network.addvm.desc": "Please specify the network that you would like to add this VM to. A new NIC will be added for this network.",
29572959
"message.network.addvmnic": "Please confirm that you would like to add a new VM NIC for this network.",
29582960
"message.network.description": "Setup network and traffic",

ui/src/views/network/VpcTab.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@
176176
<a-form-item :label="$t('label.aclid')">
177177
<a-select v-decorator="['acl']">
178178
<a-select-option v-for="item in networkAcls" :key="item.id" :value="item.id">
179-
{{ item.name }}
179+
<strong>{{ item.name }}</strong> ({{ item.description }})
180180
</a-select-option>
181181
</a-select>
182182
</a-form-item>

ui/src/views/network/VpcTiersTab.vue

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,20 @@
190190
v-decorator="['externalId']"></a-input>
191191
</a-form-item>
192192
<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) }">
194196
<a-select-option v-for="item in networkAclList" :key="item.id" :value="item.id">
195-
{{ item.name }}
197+
<strong>{{ item.name }}</strong> ({{ item.description }})
196198
</a-select-option>
197199
</a-select>
198200
</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>
199207
</a-form>
200208
</a-spin>
201209
</a-modal>
@@ -279,6 +287,7 @@ export default {
279287
showAddInternalLB: false,
280288
networkOfferings: [],
281289
networkAclList: [],
290+
selectedNetworkAcl: {},
282291
modalLoading: false,
283292
internalLB: {},
284293
LBPublicIPs: {},
@@ -412,11 +421,7 @@ export default {
412421
this.modalLoading = true
413422
api('listNetworkACLLists', { vpcid: this.resource.id }).then(json => {
414423
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)
420425
}).catch(error => {
421426
this.$notifyError(error)
422427
}).finally(() => {
@@ -519,6 +524,13 @@ export default {
519524
this.fetchLoading = false
520525
})
521526
},
527+
handleNetworkAclChange (aclId) {
528+
if (aclId) {
529+
this.selectedNetworkAcl = this.networkAclList.filter(acl => acl.id === aclId)[0]
530+
} else {
531+
this.selectedNetworkAcl = {}
532+
}
533+
},
522534
closeModal () {
523535
this.$emit('close-action')
524536
},

0 commit comments

Comments
 (0)