diff options
author | Alexandr Ilenko <AIlenko@IBS.RU> | 2022-08-01 21:37:08 +0300 |
---|---|---|
committer | Alexandr Ilenko <AIlenko@IBS.RU> | 2022-08-01 21:37:08 +0300 |
commit | 72c742e7abd4d153ac038b361522e2cb90a53830 (patch) | |
tree | e712c002520aeb29f8370b423b198ca237b6d695 /src/views/_ibs/Settings/Network/TableIpv4.vue | |
parent | 20f718fc04f3ad8b8be0236f23717a63c5e8757c (diff) | |
parent | cd1073bf004122f0d7efe75d59350e9d2d85b3f4 (diff) | |
download | webui-vue-72c742e7abd4d153ac038b361522e2cb90a53830.tar.xz |
Merge remote-tracking branch 'origin/sila_ui/fix-SILABMC-172-v3' into sila-ui
Diffstat (limited to 'src/views/_ibs/Settings/Network/TableIpv4.vue')
-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)); }, |