diff --git a/src/components/standalone/firewall/CreateOrEditPortForwardDrawer.vue b/src/components/standalone/firewall/CreateOrEditPortForwardDrawer.vue index dcf19e98c..c0a0cab63 100644 --- a/src/components/standalone/firewall/CreateOrEditPortForwardDrawer.vue +++ b/src/components/standalone/firewall/CreateOrEditPortForwardDrawer.vue @@ -12,7 +12,7 @@ import { type NeComboboxOption, getAxiosErrorMessage } from '@nethserver/vue-tailwind-lib' -import { toRefs, ref, onMounted } from 'vue' +import { toRefs, ref, watch } from 'vue' import type { CreateEditPortForwardPayload, PortForward @@ -165,14 +165,26 @@ watchEffect(() => { }) function close() { + error.value.notificationTitle = '' + error.value.notificationDescription = '' + validationErrorBag.value.clear() + restrictIPValidationErrors.value = [] + resetForm() emit('close') } -onMounted(() => { - fetchOptions() - firewallConfig.fetch() -}) +watch( + () => props.isShown, + () => { + if (props.isShown) { + fetchOptions() + if (firewallConfig.loading || firewallConfig.error) { + firewallConfig.fetch() + } + } + } +) function resetRestrictIPValidationErrors() { restrictIPValidationErrors.value = [] @@ -286,14 +298,18 @@ async function createOrEditPortForward() { " > -
+
-