diff options
Diffstat (limited to 'src/views/_ibs')
-rw-r--r-- | src/views/_ibs/Settings/Network/TableIpv4.vue | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/src/views/_ibs/Settings/Network/TableIpv4.vue b/src/views/_ibs/Settings/Network/TableIpv4.vue index a8a0486d..7954f2cd 100644 --- a/src/views/_ibs/Settings/Network/TableIpv4.vue +++ b/src/views/_ibs/Settings/Network/TableIpv4.vue @@ -137,7 +137,9 @@ export default { value: 'delete', title: this.$t('pageNetwork.table.deleteIpv4'), }, - ], + ].filter((action) => { + return action.value === 'delete' && ipv4.AddressOrigin === 'Static'; + }), }; }); }, @@ -147,17 +149,32 @@ export default { } }, deleteIpv4TableRow(index) { + const deleteMarker = null; + const newIpv4StaticArray = this.form.ipv4TableItems + .map((ipv4, idx) => { + // address cannot be matched, except by their index + if (idx === index) { + return deleteMarker; + } + return ipv4; + }) + .filter((ipv4) => { + return ipv4 === deleteMarker || ipv4.AddressOrigin === 'Static'; + }) + .map((ipv4) => { + if (ipv4 === deleteMarker) { + return deleteMarker; + } + const { Address, SubnetMask, Gateway } = ipv4; + return { + Address, + SubnetMask, + Gateway, + }; + }); this.form.ipv4TableItems.splice(index, 1); - const newIpv4Array = this.form.ipv4TableItems.map((ipv4) => { - const { Address, SubnetMask, Gateway } = ipv4; - return { - Address, - SubnetMask, - Gateway, - }; - }); this.$store - .dispatch('network/editIpv4Address', newIpv4Array) + .dispatch('network/editIpv4Address', newIpv4StaticArray) .then((message) => this.successToast(message)) .catch(({ message }) => this.errorToast(message)); }, |