diff options
author | Dixsie Wolmers <dixsie@ibm.com> | 2021-11-03 06:06:35 +0300 |
---|---|---|
committer | Dixsie Wolmers <dixsiew@gmail.com> | 2021-12-03 23:45:37 +0300 |
commit | b34349d4139230fb4ca99bf89a6b0e1f707e58e2 (patch) | |
tree | 06313bfae3aa3d8b2aa60ff98a89c066cb4daea8 /src/views/Settings/Network/TableDns.vue | |
parent | c4b8757ed88ecea369e6044548d2fbe072d5bd4a (diff) | |
download | webui-vue-b34349d4139230fb4ca99bf89a6b0e1f707e58e2.tar.xz |
Network Settings: Add and Delete IPV4 and DNS address
Adds ability to add or delete static ipv4 and dns
addesses per interface.
Signed-off-by: Dixsie Wolmers <dixsie@ibm.com>
Change-Id: Ie143ded2f173dd48f137471a684ba0d35ab0bf69
Diffstat (limited to 'src/views/Settings/Network/TableDns.vue')
-rw-r--r-- | src/views/Settings/Network/TableDns.vue | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/src/views/Settings/Network/TableDns.vue b/src/views/Settings/Network/TableDns.vue index 2578ba36..569109f1 100644 --- a/src/views/Settings/Network/TableDns.vue +++ b/src/views/Settings/Network/TableDns.vue @@ -2,6 +2,12 @@ <page-section :section-title="$t('pageNetwork.staticDns')"> <b-row> <b-col lg="6"> + <div class="text-right"> + <b-button variant="primary" @click="initDnsModal()"> + <icon-add /> + {{ $t('pageNetwork.table.addDnsAddress') }} + </b-button> + </div> <b-table responsive="md" hover @@ -11,7 +17,7 @@ class="mb-0" show-empty > - <template #cell(actions)="{ item }"> + <template #cell(actions)="{ item, index }"> <table-row-action v-for="(action, actionIndex) in item.actions" :key="actionIndex" @@ -34,6 +40,7 @@ <script> import BVToastMixin from '@/components/Mixins/BVToastMixin'; +import IconAdd from '@carbon/icons-vue/es/add--alt/20'; import IconEdit from '@carbon/icons-vue/es/edit/20'; import IconTrashcan from '@carbon/icons-vue/es/trash-can/20'; import PageSection from '@/components/Global/PageSection'; @@ -43,6 +50,7 @@ import { mapState } from 'vuex'; export default { name: 'DNSTable', components: { + IconAdd, IconEdit, IconTrashcan, PageSection, @@ -87,6 +95,9 @@ export default { tabIndex() { this.getStaticDnsItems(); }, + ethernetData() { + this.getStaticDnsItems(); + }, }, created() { this.getStaticDnsItems(); @@ -104,10 +115,6 @@ export default { address: server, actions: [ { - value: 'edit', - title: this.$t('pageNetwork.table.editDns'), - }, - { value: 'delete', title: this.$t('pageNetwork.table.deleteDns'), }, @@ -115,12 +122,24 @@ export default { }; }); }, - onDnsTableAction(action, row) { - if (action === 'delete') { - this.form.dnsStaticTableItems.splice(row, 1); - // TODO: delete row in store + onDnsTableAction(action, $event, index) { + if ($event === 'delete') { + this.deleteDnsTableRow(index); } }, + deleteDnsTableRow(index) { + this.form.dnsStaticTableItems.splice(index, 1); + const newDnsArray = this.form.dnsStaticTableItems.map((dns) => { + return dns.address; + }); + this.$store + .dispatch('network/editDnsAddress', newDnsArray) + .then((message) => this.successToast(message)) + .catch(({ message }) => this.errorToast(message)); + }, + initDnsModal() { + this.$bvModal.show('modal-dns'); + }, }, }; </script> |