Skip to content

Commit

Permalink
fix: unable remove some fields' value [KM-970]
Browse files Browse the repository at this point in the history
  • Loading branch information
raoxiaoyan committed Feb 25, 2025
1 parent 4b0d7ab commit 35e50a1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -243,24 +243,16 @@ const getPayload = computed((): UpstreamFormPayload => {
hash_on: state.fields.hashOn,
hash_fallback: state.fields.hashFallback,
healthchecks: {},
host_header : state.fields.hostHeader ? state.fields.hostHeader : null,
client_certificate : state.fields.clientCertificate ? { id: state.fields.clientCertificate } : null,
}
if (state.fields.hostHeader) {
result.host_header = state.fields.hostHeader
}
if (state.fields.clientCertificate) {
result.client_certificate = { id: state.fields.clientCertificate }
}
const healthchecksThreshold = state.fields.healthchecksThreshold ? state.fields.healthchecksThreshold : '0'
result.healthchecks.threshold = Number(healthchecksThreshold)
if (state.fields.healthchecksThreshold) {
result.healthchecks.threshold = Number(state.fields.healthchecksThreshold)
}
if (state.fields.tags) {
result.tags = state.fields.tags.split(',')?.map((tag: string) => String(tag || '')
.trim())?.filter((tag: string) => tag !== '')
}
const tags = state.fields.tags ? state.fields.tags : ''
result.tags = tags.split(',')?.map((tag: string) => String(tag || '')
.trim())?.filter((tag: string) => tag !== '')
if (state.fields.hashOn === 'header') {
result.hash_on_header = state.fields.hashOnHeader
Expand Down Expand Up @@ -298,9 +290,7 @@ const getPayload = computed((): UpstreamFormPayload => {
unhealthy: {},
}
if (state.fields.activeHealthCheck.timeout) {
result.healthchecks.active.timeout = Number(state.fields.activeHealthCheck.timeout)
}
result.healthchecks.active.timeout = state.fields.activeHealthCheck.timeout ? Number(state.fields.activeHealthCheck.timeout) : undefined
if (state.fields.activeHealthCheck.concurrency) {
result.healthchecks.active.concurrency = Number(state.fields.activeHealthCheck.concurrency)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export interface MultiselectComposableOptions {

export interface UpstreamActivePayload {
type: HealthCheckType
timeout?: number
timeout?: number | undefined
concurrency?: number
http_path?: string
headers?: Record<string, string[]> | []
Expand Down Expand Up @@ -137,8 +137,8 @@ export interface UpstreamPassivePayload {
export interface UpstreamFormPayload {
name: string
algorithm: UpstreamAlgorithm
host_header?: string
client_certificate?: { id: string }
host_header?: string | null
client_certificate?: { id: string } | null
tags?: string[]
slots: number
hash_on: UpstreamHash
Expand Down

0 comments on commit 35e50a1

Please sign in to comment.