fix: hide test-connection button for directories

This commit is contained in:
Nicolas Meienberger
2025-11-15 10:15:25 +01:00
parent 31da747c2d
commit 681cf5dff1

View File

@@ -536,42 +536,44 @@ export const CreateVolumeForm = ({ onSubmit, mode = "create", initialValues, for
</> </>
)} )}
<div className="space-y-3"> {watchedBackend !== "directory" && (
<div className="flex items-center gap-2"> <div className="space-y-3">
<Button <div className="flex items-center gap-2">
type="button" <Button
variant="outline" type="button"
onClick={handleTestConnection} variant="outline"
disabled={testBackendConnection.isPending} onClick={handleTestConnection}
className="flex-1" disabled={testBackendConnection.isPending}
> className="flex-1"
{testBackendConnection.isPending && <Loader2 className="mr-2 h-4 w-4 animate-spin" />} >
{!testBackendConnection.isPending && testMessage?.success && ( {testBackendConnection.isPending && <Loader2 className="mr-2 h-4 w-4 animate-spin" />}
<CheckCircle className="mr-2 h-4 w-4 text-green-500" /> {!testBackendConnection.isPending && testMessage?.success && (
)} <CheckCircle className="mr-2 h-4 w-4 text-green-500" />
{!testBackendConnection.isPending && testMessage && !testMessage.success && ( )}
<XCircle className="mr-2 h-4 w-4 text-red-500" /> {!testBackendConnection.isPending && testMessage && !testMessage.success && (
)} <XCircle className="mr-2 h-4 w-4 text-red-500" />
{testBackendConnection.isPending )}
? "Testing..." {testBackendConnection.isPending
: testMessage ? "Testing..."
? testMessage.success : testMessage
? "Connection Successful" ? testMessage.success
: "Test Failed" ? "Connection Successful"
: "Test Connection"} : "Test Failed"
</Button> : "Test Connection"}
</div> </Button>
{testMessage && (
<div
className={cn("text-xs p-2 rounded-md text-wrap wrap-anywhere", {
"bg-green-50 text-green-700 border border-green-200": testMessage.success,
"bg-red-50 text-red-700 border border-red-200": !testMessage.success,
})}
>
{testMessage.message}
</div> </div>
)} {testMessage && (
</div> <div
className={cn("text-xs p-2 rounded-md text-wrap wrap-anywhere", {
"bg-green-50 text-green-700 border border-green-200": testMessage.success,
"bg-red-50 text-red-700 border border-red-200": !testMessage.success,
})}
>
{testMessage.message}
</div>
)}
</div>
)}
{mode === "update" && ( {mode === "update" && (
<Button type="submit" className="w-full" loading={loading}> <Button type="submit" className="w-full" loading={loading}>
Save Changes Save Changes