feat: add delete confirmation dialog for apps
All checks were successful
CI / cleanup-branch (push) Has been skipped
CI / build (push) Successful in 1m21s
CI / docker (push) Successful in 1m4s
CI / deploy-feature (push) Has been skipped
CI / deploy (push) Successful in 41s

Prevents accidental app deletion by requiring the user to type the app
slug before confirming.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
hsiegeln
2026-04-08 17:55:37 +02:00
parent 6a32b83326
commit b7f215e90c

View File

@@ -3,6 +3,7 @@ import { useParams, useNavigate } from 'react-router';
import {
Badge,
Button,
ConfirmDialog,
DataTable,
Input,
Modal,
@@ -271,6 +272,7 @@ function AppDetailView({ appId, environments, selectedEnv }: { appId: string; en
const deleteApp = useDeleteApp();
const fileInputRef = useRef<HTMLInputElement>(null);
const [subTab, setSubTab] = useState<'overview' | 'config'>('overview');
const [deleteConfirm, setDeleteConfirm] = useState(false);
const envMap = useMemo(() => new Map(environments.map((e) => [e.id, e])), [environments]);
const sortedVersions = useMemo(() => [...versions].sort((a, b) => b.version - a.version), [versions]);
@@ -323,7 +325,7 @@ function AppDetailView({ appId, environments, selectedEnv }: { appId: string; en
<div className={styles.detailActions}>
<input ref={fileInputRef} type="file" accept=".jar" style={{ display: 'none' }} onChange={handleUpload} />
<Button size="sm" variant="primary" onClick={() => fileInputRef.current?.click()} loading={uploadJar.isPending}>Upload JAR</Button>
<Button size="sm" variant="danger" onClick={handleDelete}>Delete App</Button>
<Button size="sm" variant="danger" onClick={() => setDeleteConfirm(true)}>Delete App</Button>
</div>
</div>
@@ -342,6 +344,15 @@ function AppDetailView({ appId, environments, selectedEnv }: { appId: string; en
{subTab === 'config' && (
<ConfigSubTab app={app} environment={env} />
)}
<ConfirmDialog
open={deleteConfirm}
onClose={() => setDeleteConfirm(false)}
onConfirm={handleDelete}
message={`Delete app "${app.displayName}"? All versions and deployments will be removed. This cannot be undone.`}
confirmText={app.slug}
loading={deleteApp.isPending}
/>
</div>
);
}