Skip to content

Commit

Permalink
Removed Prefix Length input from IPV6DefaultGateway table
Browse files Browse the repository at this point in the history
  • Loading branch information
tiwari-nishant committed Oct 23, 2024
1 parent a51ba17 commit 4042020
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 95 deletions.
54 changes: 2 additions & 52 deletions src/views/Settings/Network/ModalIpv6StaticDefaultGateway.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<b-form-input
id="ipAddress"
v-model="form.ipAddress"
style="width: 215%"
type="text"
:state="getValidationState($v.form.ipAddress)"
@input="$v.form.ipAddress.$touch()"
Expand All @@ -33,38 +34,6 @@
</b-form-invalid-feedback>
</b-form-group>
</b-col>
<b-col sm="6">
<b-form-group
:label="$t('pageNetwork.modal.prefixLength')"
label-for="prefixLength"
>
<b-form-input
id="prefixLength"
v-model="form.prefixLength"
type="number"
:state="getValidationState($v.form.prefixLength)"
@blur="$v.form.prefixLength.$touch()"
/>
<b-form-invalid-feedback role="alert">
<template v-if="!$v.form.prefixLength.required">
{{ $t('global.form.fieldRequired') }}
</template>
<template
v-if="
!$v.form.prefixLength.minLength ||
!$v.form.prefixLength.maxLength
"
>
{{
$t('global.form.valueMustBeBetween', {
min: 0,
max: 128,
})
}}
</template>
</b-form-invalid-feedback>
</b-form-group>
</b-col>
</b-row>
</b-form>
<template #modal-footer="{ cancel }">
Expand All @@ -85,20 +54,11 @@

<script>
import VuelidateMixin from '@/components/Mixins/VuelidateMixin.js';
import {
required,
minValue,
maxValue,
helpers,
} from 'vuelidate/lib/validators';
import { required, helpers } from 'vuelidate/lib/validators';
export default {
mixins: [VuelidateMixin],
props: {
prefixLength: {
type: Number,
default: 0,
},
ipAddress: {
type: String,
default: '',
Expand All @@ -112,17 +72,13 @@ export default {
return {
form: {
ipAddress: '',
prefixLength: 0,
},
};
},
watch: {
ipAddress() {
this.form.ipAddress = this.ipAddress;
},
prefixLength() {
this.form.prefixLength = this.prefixLength;
},
},
validations() {
return {
Expand All @@ -134,11 +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9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$))|(^\s*((?=.{1,255}$)(?=.*[A-Za-z].*)[0-9A-Za-z](?:(?:[0-9A-Za-z]|\b-){0,61}[0-9A-Za-z])?(?:\.[0-9A-Za-z](?:(?:[0-9A-Za-z]|\b-){0,61}[0-9A-Za-z])?)*)\s*$)/
),
},
prefixLength: {
required,
minValue: minValue(0),
maxValue: maxValue(128),
},
},
};
},
Expand All @@ -148,7 +99,6 @@ export default {
if (this.$v.$invalid) return;
this.$emit('ok', {
Address: this.form.ipAddress,
PrefixLength: Number(this.form.prefixLength),
});
this.closeModal();
},
Expand Down
83 changes: 40 additions & 43 deletions src/views/Settings/Network/TableIpv6StaticDefaultGateway.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,48 @@
<div>
<page-section :section-title="$t('pageNetwork.ipv6StaticDefaultGateway')">
<b-row>
<b-col class="text-right">
<b-button
variant="primary"
:disabled="isTablesDisabled"
@click="initIpv6DefaultGatewayModal()"
<b-col lg="6">
<div class="text-right">
<b-button
variant="primary"
:disabled="isTablesDisabled"
@click="initIpv6DefaultGatewayModal()"
>
<icon-add />
{{ $t('pageNetwork.table.addIpv6StaticDefaultGateway') }}
</b-button>
</div>

<b-table
responsive="md"
hover
:fields="ipv6DefaultGatewayTableFields"
:items="form.ipv6DefaultGatewayTableItems"
:empty-text="$t('global.table.emptyMessage')"
:busy="isTablesDisabled"
class="mb-0"
show-empty
>
<icon-add />
{{ $t('pageNetwork.table.addIpv6StaticDefaultGateway') }}
</b-button>
<template #cell(actions)="{ item }">
<table-row-action
v-for="(action, actionIndex) in item.actions"
:key="actionIndex"
:value="action.value"
:title="action.title"
:enabled="action.enabled"
@click-table-action="
onIpv6DefaultGatewayTableAction(action, $event, item)
"
>
<template #icon>
<icon-edit v-if="action.value === 'edit'" />
<icon-trashcan v-if="action.value === 'delete'" />
</template>
</table-row-action>
</template>
</b-table>
</b-col>
</b-row>
<b-table
responsive="md"
hover
:fields="ipv6DefaultGatewayTableFields"
:items="form.ipv6DefaultGatewayTableItems"
:empty-text="$t('global.table.emptyMessage')"
:busy="isTablesDisabled"
class="mb-0"
show-empty
>
<template #cell(actions)="{ item }">
<table-row-action
v-for="(action, actionIndex) in item.actions"
:key="actionIndex"
:value="action.value"
:title="action.title"
:enabled="action.enabled"
@click-table-action="
onIpv6DefaultGatewayTableAction(action, $event, item)
"
>
<template #icon>
<icon-edit v-if="action.value === 'edit'" />
<icon-trashcan v-if="action.value === 'delete'" />
</template>
</table-row-action>
</template>
</b-table>
</page-section>
</div>
</template>
Expand Down Expand Up @@ -90,10 +93,6 @@ export default {
key: 'Address',
label: this.$t('pageNetwork.table.ipAddress'),
},
{
key: 'PrefixLength',
label: this.$t('pageNetwork.table.prefixLength'),
},
{ key: 'actions', label: '', tdClass: 'text-right' },
],
};
Expand Down Expand Up @@ -128,7 +127,6 @@ export default {
this.form.ipv6DefaultGatewayTableItems = addresses.map((ipv6) => {
return {
Address: ipv6.Address,
PrefixLength: ipv6.PrefixLength,
actions: [
{
value: 'edit',
Expand Down Expand Up @@ -161,10 +159,9 @@ export default {
const newIpv6Array = this.form.ipv6DefaultGatewayTableItems
.filter((row) => row.Address !== item.Address)
.map((ipv6) => {
const { Address, PrefixLength } = ipv6;
const { Address } = ipv6;
return {
Address,
PrefixLength,
};
});
const addressIp = item.Address;
Expand Down

0 comments on commit 4042020

Please sign in to comment.