Skip to content
This repository was archived by the owner on Jan 12, 2026. It is now read-only.

Commit 8a53e1d

Browse files
Fixes
1 parent febaaa3 commit 8a53e1d

File tree

5 files changed

+36
-19
lines changed

5 files changed

+36
-19
lines changed

src/components/display/formFooter/testConnectionResult.tsx

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,11 @@ export function FormFooterTestConnectionResult({
3131
const intervalId = useRef<number>();
3232
const timeoutId = useRef<number>();
3333
const [progress, setProgress] = useState(0);
34-
const [errorMessage, setErrorMessage] = useState<string | undefined>();
35-
const [success, setSuccess] = useState(false);
34+
const [progressRunning, setProgressRunning] = useState(false);
3635

3736
useEffect(() => {
3837
if (isLoading) {
39-
setErrorMessage(undefined);
40-
setSuccess(false);
38+
setProgressRunning(true);
4139

4240
const updateProgress = (currentProgress: number) => {
4341
const difference = 100 - currentProgress;
@@ -64,17 +62,13 @@ export function FormFooterTestConnectionResult({
6462
let hasTransitionEnded = false;
6563

6664
const handleTransitionEnd = () => {
65+
setProgressRunning(false);
66+
6767
clearTimeout(timeoutId.current);
6868
timeoutId.current = window.setTimeout(() => {
6969
if (!hasTransitionEnded) {
7070
hasTransitionEnded = true;
71-
if (failureError) {
72-
setErrorMessage(
73-
failureError.message ||
74-
'Connection failed, please check your configuration and try again',
75-
);
76-
} else {
77-
setSuccess(true);
71+
if (!failureError) {
7872
onSuccess();
7973
}
8074
}
@@ -99,9 +93,9 @@ export function FormFooterTestConnectionResult({
9993
// eslint-disable-next-line react-hooks/exhaustive-deps
10094
}, [isLoading, isSubmitting]);
10195

102-
if (success) {
103-
return null;
104-
}
96+
const errorMessage = failureError
97+
? failureError.message || 'Connection failed, please check your configuration and try again'
98+
: undefined;
10599

106100
return (
107101
<Card ref={cardRef}>
@@ -124,13 +118,14 @@ export function FormFooterTestConnectionResult({
124118
</Button>
125119
)}
126120
</Stack>
127-
{errorMessage ? (
121+
{progressRunning && (
122+
<LinearProgress ref={progressElemRef} value={progress} variant="determinate" />
123+
)}
124+
{errorMessage && !progressRunning && (
128125
<Alert color="error" severity="error" variant="filled">
129126
<AlertTitle>Connection test failed</AlertTitle>
130127
{errorMessage.charAt(0).toUpperCase() + errorMessage.slice(1)}
131128
</Alert>
132-
) : (
133-
<LinearProgress ref={progressElemRef} value={progress} variant="determinate" />
134129
)}
135130
</Card>
136131
</Card>

src/components/display/lightboxImage/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import React, { ImgHTMLAttributes, useCallback } from 'react';
22

33
import { PluginUiMessageHandler } from '@cloudquery/plugin-config-ui-connector';
44

5+
import { parseSrc } from '../../../utils/parseSrc';
6+
57
/**
68
* @public
79
*/
@@ -47,7 +49,11 @@ export function LightboxImage({ pluginUiMessageHandler, ...props }: LightboxImag
4749
onClick={handleOpen}
4850
onKeyDown={handleKeyDown}
4951
>
50-
<img {...props} style={{ width: 'inherit', display: 'block', ...props.style }} />
52+
<img
53+
{...props}
54+
src={props.src ? parseSrc(props.src) : undefined}
55+
style={{ width: 'inherit', display: 'block', ...props.style }}
56+
/>
5157
</button>
5258
);
5359
}

src/components/display/logo.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import Box from '@mui/material/Box';
44
import CircularProgress from '@mui/material/CircularProgress';
55
import useTheme from '@mui/material/styles/useTheme';
66

7+
import { parseSrc } from '../../utils/parseSrc';
8+
79
/**
810
* @public
911
*/
@@ -54,7 +56,7 @@ export function Logo({ width = 24, height = 24, src, alt, fallbackSrc }: LogoPro
5456
/>
5557
)}
5658
<img
57-
src={currentSrc}
59+
src={parseSrc(currentSrc)}
5860
alt={alt ?? src}
5961
height={height - PADDING}
6062
width={width - PADDING}

src/components/utils/cloudAppMock.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import createTheme from '@mui/material/styles/createTheme';
2424
import Typography from '@mui/material/Typography';
2525
import toast, { Toaster as HotToaster, ToastBar } from 'react-hot-toast';
2626

27+
import { parseSrc } from '../../utils/parseSrc';
28+
2729
/**
2830
* @public
2931
*/
@@ -460,6 +462,7 @@ export function CloudAppMock({
460462
isLoaded: true,
461463
} as typeof lightboxProps)
462464
}
465+
src={lightboxProps?.src ? parseSrc(lightboxProps.src) : undefined}
463466
style={{
464467
height: 'auto',
465468
maxHeight: lightboxProps?.isLoaded ? undefined : 0,

src/utils/parseSrc.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export function parseSrc(src: string) {
2+
if (src.startsWith('./')) {
3+
return `${window.location.origin}${window.location.pathname}${src.slice(1)}`;
4+
}
5+
6+
if (src.startsWith('/')) {
7+
return `${window.location.origin}${src}`;
8+
}
9+
10+
return src;
11+
}

0 commit comments

Comments
 (0)