From 65980b963c5278aaf9bb9f8160d69397175837ce Mon Sep 17 00:00:00 2001 From: Giacomo Sanchietti Date: Fri, 15 May 2026 12:29:51 +0200 Subject: [PATCH] feat(ipsec): convert DPD to combobox Changes: - expose all possibile values for dpd action - add tooltip to explain the option values Assysted-by: Copilot:GPT5.4 --- .../ipsec_tunnel/CreateOrEditTunnelDrawer.vue | 58 ++++++++++++++----- src/i18n/en.json | 3 +- src/i18n/it.json | 3 +- 3 files changed, 47 insertions(+), 17 deletions(-) diff --git a/src/components/standalone/ipsec_tunnel/CreateOrEditTunnelDrawer.vue b/src/components/standalone/ipsec_tunnel/CreateOrEditTunnelDrawer.vue index bc22431ac..73bbfc1b9 100644 --- a/src/components/standalone/ipsec_tunnel/CreateOrEditTunnelDrawer.vue +++ b/src/components/standalone/ipsec_tunnel/CreateOrEditTunnelDrawer.vue @@ -59,7 +59,7 @@ type CreateEditIpsecTunnelPayload = { } ipcomp: string closeaction?: string - dpdaction: 'restart' | 'none' + dpdaction: TunnelDpdAction remote_subnet: string[] local_subnet: string[] ns_name: string @@ -72,6 +72,9 @@ type CreateEditIpsecTunnelPayload = { pre_shared_key: string } +type DpdAction = 'clear' | 'trap' | 'restart' +type TunnelDpdAction = DpdAction | 'none' + const { t } = useI18n() const emit = defineEmits(['close', 'add-edit-tunnel']) @@ -104,7 +107,7 @@ const remoteIdentifier = ref('') // Step 2 fields const presharedKeyMode = ref<'generate' | 'import'>('generate') const presharedKey = ref('') -const dpd = ref(false) +const dpdAction = ref('clear') const enableCompression = ref(false) const closeAction = ref('none') @@ -152,6 +155,11 @@ const closeActionOptions: NeComboboxOption[] = [ { id: 'trap', label: 'trap' }, { id: 'start', label: 'start' } ] +const dpdActionOptions: NeComboboxOption[] = [ + { id: 'clear', label: 'clear' }, + { id: 'trap', label: 'trap' }, + { id: 'restart', label: 'restart' } +] const encryptionOptions = ref([]) const integrityOptions = ref([]) const diffieHellmanOptions = ref([]) @@ -253,7 +261,7 @@ async function resetForm() { wanIpAddress.value = tunnelData?.local_ip ?? '' remoteIpAddress.value = tunnelData?.gateway ?? '' remoteNetworks.value = tunnelData?.remote_subnet ?? [''] - dpd.value = tunnelData ? tunnelData.dpdaction == 'restart' : false + dpdAction.value = normalizeDpdAction(tunnelData?.dpdaction) enableCompression.value = tunnelData ? tunnelData.ipcomp === 'true' : false closeAction.value = tunnelData?.closeaction ?? 'none' ikeVersion.value = tunnelData?.keyexchange ?? ikeVersionOptions[0].id @@ -403,6 +411,18 @@ function handlePreviousStep() { } } +function normalizeDpdAction(action?: string | null): DpdAction { + switch (action) { + case 'trap': + case 'restart': + case 'clear': + return action + case 'none': + default: + return 'clear' + } +} + async function createOrEditTunnel() { error.value.notificationTitle = '' error.value.notificationDescription = '' @@ -425,7 +445,7 @@ async function createOrEditTunnel() { ipcomp: enableCompression.value ? 'true' : 'false', closeaction: closeAction.value, enabled: enabled.value ? '1' : '0', - dpdaction: dpd.value ? 'restart' : 'none', + dpdaction: dpdAction.value, keyexchange: ikeVersion.value, remote_subnet: remoteNetworks.value.filter((x) => x != ''), local_subnet: localNetworks.value @@ -621,17 +641,25 @@ watch( -
- {{ - t('standalone.ipsec_tunnel.dpd_dead_peer_detection') - }} - -
+ + +
{{ t('standalone.ipsec_tunnel.compression') }}