Skip to content

Commit

Permalink
Merge pull request #2595 from emqx/dev/1.9.0
Browse files Browse the repository at this point in the history
Sync code from refs/heads/dev/1.9.0 to enterprise
  • Loading branch information
Kinplemelon authored Apr 25, 2024
2 parents 01e88c4 + 60191a3 commit ffb4487
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/components/ListenerDrawer/ListenerDrawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
:is-edit="isEdit"
:base-path="SSLConfigKey"
:verify-label="t('Base.tlsVerifyClient')"
@verify-change="handleTLSVerifyChange"
/>
</el-col>
<template v-if="!isQUIC && listenerRecord[SSLConfigKey].verify !== 'verify_none'">
Expand Down Expand Up @@ -462,6 +463,7 @@ const {
listenerFormRules,
submit,
onDelete,
handleTLSVerifyChange,
} = useListenerDialog(props, emit)
const isUDP = computed(() => listenerRecord.value.type === ListenerTypeForGateway.UDP)
Expand Down
7 changes: 6 additions & 1 deletion src/components/TLSConfig/TLSEnableConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
:disabled="readonly || disabledVerify"
:active-value="SSL_VERIFY_VALUE_MAP.get(true)"
:inactive-value="SSL_VERIFY_VALUE_MAP.get(false)"
@change="handleVerifyChange"
/>
</el-form-item>
<CustomFormItem
Expand Down Expand Up @@ -162,7 +163,7 @@ const props = defineProps({
},
})
const emit = defineEmits(['update:modelValue'])
const emit = defineEmits(['update:modelValue', 'verifyChange'])
const record: WritableComputedRef<SSL> = computed({
get() {
Expand Down Expand Up @@ -190,6 +191,10 @@ const getFormItemProp = (key: string) => {
}
return undefined
}
const handleVerifyChange = (val: string | number | boolean) => {
emit('verifyChange', val)
}
</script>

<style lang="scss">
Expand Down
10 changes: 10 additions & 0 deletions src/hooks/Config/useListenerDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ interface UseListenerDialogReturns {
submit: () => Promise<void>
onDelete: () => void
transPort: (port: string) => string
handleTLSVerifyChange: (val: string | number | boolean) => void
}

export default (props: Props, emit: Emit): UseListenerDialogReturns => {
Expand Down Expand Up @@ -316,6 +317,14 @@ export default (props: Props, emit: Emit): UseListenerDialogReturns => {
}
})

// If 'fail_if_no_peer_cert' is true while TLS verification is 'verify_none', it will cause an update error
const handleTLSVerifyChange = (val: string | number | boolean) => {
const { fail_if_no_peer_cert } = listenerRecord.value[SSLConfigKey.value]
if (val === 'verify_none' && fail_if_no_peer_cert === true) {
listenerRecord.value[SSLConfigKey.value].fail_if_no_peer_cert = false
}
}

return {
showDialog,
isLoading,
Expand All @@ -339,5 +348,6 @@ export default (props: Props, emit: Emit): UseListenerDialogReturns => {
submit,
onDelete,
transPort,
handleTLSVerifyChange,
}
}

0 comments on commit ffb4487

Please sign in to comment.