Files
AOS/src/components/aos/fuse-cta.tsx
T
Z User 32a8b01845 fix: instance detail crash + add play/stop/redeploy/remove actions
Fixes:
1. useFetch: add credentials:'same-origin' — cookie wasn't being sent
   with API calls, causing 401 → React error boundary → 'Etwas ist schiefgelaufen'
2. Instance detail Sheet now loads correctly (cookie sent with request)

New instance actions (UI + API):
- Redeploy: triggers Dokploy application.redeploy (rebuilds from latest commit)
- Stop: triggers Dokploy application.stop (pauses container)
- Start: triggers Dokploy application.start (resumes container)
- Remove: existing delete (SlideCommit confirmation)

Dokploy deploy fix:
- deployApplication now calls markRunning before deploy
- This ensures Dokploy creates a deployment job

ActionsRow redesigned:
- demo_active/active: [Redeploy] [Stop] [Demo +7d] [Remove]
- grace: [Start] [Remove]
- failed: [Retry] [Remove]
- provisioning/deleting/deleted: no actions
2026-10-29 16:29:28 +00:00

62 lines
1.4 KiB
TypeScript
Executable File

'use client'
import { FuseButton } from '@/components/FuseButton'
import { useState } from 'react'
import { toast } from 'sonner'
import { Loader2 } from 'lucide-react'
// FuseButton wrapper for primary CTA actions with undo window.
// Used for: create deal, finalize invoice, run recurring, approve estimate.
export function FuseCTA({
label,
doneLabel = 'Erledigt',
undoLabel = 'Rückgängig',
onCommit,
onUndo,
disabled,
size = 'md',
}: {
label: string
doneLabel?: string
undoLabel?: string
onCommit: () => void | Promise<void>
onUndo?: () => void
disabled?: boolean
size?: 'sm' | 'md' | 'lg'
}) {
const [busy, setBusy] = useState(false)
const handleCommit = async () => {
setBusy(true)
const t = toast.loading('Wird ausgeführt…')
try {
await onCommit()
toast.success(doneLabel, { id: t })
} catch {
toast.error('Fehlgeschlagen', { id: t })
} finally {
setBusy(false)
}
}
return (
<FuseButton
label={busy ? 'Lädt…' : label}
doneLabel={doneLabel}
undoLabel={undoLabel}
onCommit={handleCommit}
onUndo={onUndo}
disabled={disabled || busy}
size={size}
commitOn="fuseEnd"
settle="stay"
fuse="bottom"
fuseThickness={2}
undoWindow={4000}
color="oklch(0.98 0 0)"
background="oklch(0.2 0 0)"
fuseColor="oklch(0.5 0 0)"
/>
)
}