Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ui/src/components/filtering/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const stringToBoolean = (string?: string) => {
}

export const booleanToString = (value?: boolean) =>
value !== undefined ? `${value}` : ''
value !== undefined && value !== null ? `${value}` : ''

// Help function to decide if a filter section should be open or not on page load
export const someActive = (
Expand Down
3 changes: 2 additions & 1 deletion ui/src/data-services/hooks/deployments/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ export const convertToFormData = (fieldValues: DeploymentFieldValues) => {
research_site_id: fieldValues.siteId,
}).forEach(([key, value]) => {
if (value !== undefined) {
data.append(key, `${value}`)
// Convert null to empty string to signal "clear this field" (matches image field pattern)
data.append(key, value === null ? '' : `${value}`)
}
})

Expand Down
8 changes: 4 additions & 4 deletions ui/src/data-services/models/deployment-details.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export type ServerNestedCapture = {

export interface DeploymentFieldValues {
dataSourceId?: string
dataSourceSubdir?: string
dataSourceRegex?: string
dataSourceSubdir?: string | null
dataSourceRegex?: string | null
description: string
deviceId?: string
name: string
Expand Down Expand Up @@ -68,11 +68,11 @@ export class DeploymentDetails extends Deployment {
}
}

get dataSourceSubdir(): string {
get dataSourceSubdir(): string | null {
return this._deployment.data_source_subdir
}

get dataSourceRegex(): string {
get dataSourceRegex(): string | null {
return this._deployment.data_source_regex
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export const SectionSourceImages = ({
<ConnectionStatus
storageId={deployment.dataSource.id}
subdir={deployment.dataSourceSubdir ?? ''}
regex={deployment.dataSourceRegex}
regex={deployment.dataSourceRegex ?? ''}
showDetails
onConnectionChange={setIsConnected}
/>
Expand Down
2 changes: 1 addition & 1 deletion ui/src/utils/getAppRoute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const getAppRoute = ({
keepSearchParams ? window.location.search : undefined
)
Object.entries(filters).forEach(([name, value]) => {
if (value !== undefined) {
if (value !== undefined && value !== null) {
searchParams.set(name, value)
}
})
Expand Down