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
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import Switch from 'components/Switch'
import ErrorMessage from 'components/ErrorMessage'
import FieldError from 'components/base/forms/FieldError'
import WarehouseSetupSqlHelp from './WarehouseSetupSqlHelp'
import WarningMessage from 'components/WarningMessage'
import { ClickHouseConfig } from 'common/types/responses'
import { useTestWarehouseConnectionConfigMutation } from 'common/services/useWarehouseConnection'
import {
Expand Down Expand Up @@ -286,10 +285,10 @@ const ClickHouseConfigForm: FC<ClickHouseConfigFormProps> = ({
</div>
)}
{testState === 'errored' && (
<div className='d-flex justify-content-end'>
<WarningMessage
warningMessage={getTestFailureWarning(testDetail)}
warningMessageClass='mb-0'
<div className='d-flex'>
<ErrorMessage
error={getTestFailureWarning(testDetail)}
errorMessageClass='mb-0 flex-1 wh-config-form__test-error'
/>
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
color: var(--color-text-tertiary);
}

&__test-error {
white-space: pre-line;
}

&__note {
padding: 12px 14px;
background: var(--color-surface-info-subtle, var(--color-surface-muted));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ import { getTestFailureWarning } from 'components/pages/environment-settings/tab

describe('getTestFailureWarning', () => {
it.each([
['Authentication failed.', ': Authentication failed. You can save anyway'],
['Connection refused', ': Connection refused. You can save anyway'],
['Timed out!', ': Timed out! You can save anyway'],
[null, '. You can save anyway'],
])('formats detail %p with a single sentence break', (detail, expected) => {
expect(getTestFailureWarning(detail)).toContain(expected)
})
['Authentication failed.', ': Authentication failed.\nYou can save anyway'],
['Connection refused', ': Connection refused.\nYou can save anyway'],
['Timed out!', ': Timed out!\nYou can save anyway'],
[null, '.\nYou can save anyway'],
])(
'formats detail %p with the save-anyway hint on its own line',
(detail, expected) => {
expect(getTestFailureWarning(detail)).toContain(expected)
},
)

it('does not claim a failed connection when only the events table is missing', () => {
const detail =
Expand All @@ -25,7 +28,7 @@ describe('getTestFailureWarning', () => {

it('keeps the sentence boundary when the missing-table detail lacks punctuation', () => {
expect(getTestFailureWarning('Events table not found')).toContain(
'Events table not found. You can save anyway',
'Events table not found.\nYou can save anyway',
)
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export const getTestFailureWarning = (detail: string | null): string => {
if (detail && isMissingEventsTableDetail(detail)) {
return `${punctuate(
detail,
)} You can save anyway and test again later, but events won't be delivered until the table exists.`
)}\nYou can save anyway and test again later, but events won't be delivered until the table exists.`
}
const reason = detail ? `: ${punctuate(detail)}` : '.'
return `We couldn't establish a connection${reason} You can save anyway and test again later, but events won't be delivered until the connection succeeds.`
return `We couldn't establish a connection${reason}\nYou can save anyway and test again later, but events won't be delivered until the connection succeeds.`
}
Loading