fix: standardize button order, add confirmation dialogs for destructive actions
- Fix Cancel|Save order and add primary/loading props (AppConfigDetailPage) - Add AlertDialog before stopping deployments (AppsTab) - Add ConfirmDialog before deleting taps (TapConfigModal) - Add AlertDialog before killing queries with toast feedback (DatabaseAdminPage) - Add AlertDialog before removing roles from users (UsersTab) - Standardize Cancel button to variant="ghost" (TapConfigModal, RouteDetail) - Add loading prop to ConfirmDialogs (OidcConfigPage, RouteDetail) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useState, useMemo, useEffect, useCallback } from 'react';
|
||||
import {
|
||||
Modal, FormField, Input, Select, Textarea, Toggle, Button, Collapsible,
|
||||
Modal, FormField, Input, Select, Textarea, Toggle, Button, Collapsible, ConfirmDialog,
|
||||
} from '@cameleer/design-system';
|
||||
import type { TapDefinition, ApplicationConfig } from '../api/queries/commands';
|
||||
import { useTestExpression } from '../api/queries/commands';
|
||||
@@ -65,6 +65,7 @@ export function TapConfigModal({
|
||||
const [attrType, setAttrType] = useState<TapDefinition['attributeType']>('BUSINESS_OBJECT');
|
||||
const [enabled, setEnabled] = useState(true);
|
||||
|
||||
const [showDeleteConfirm, setShowDeleteConfirm] = useState(false);
|
||||
const [testTab, setTestTab] = useState('custom');
|
||||
const [testPayload, setTestPayload] = useState('');
|
||||
const [testResult, setTestResult] = useState<{ result?: string; error?: string } | null>(null);
|
||||
@@ -118,6 +119,7 @@ export function TapConfigModal({
|
||||
if (tap && onDelete) {
|
||||
onDelete(tap);
|
||||
onClose();
|
||||
setShowDeleteConfirm(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,13 +251,24 @@ export function TapConfigModal({
|
||||
<div className={styles.footer}>
|
||||
{isEdit && onDelete && (
|
||||
<div className={styles.footerLeft}>
|
||||
<Button variant="danger" onClick={handleDelete}>Delete</Button>
|
||||
<Button variant="danger" onClick={() => setShowDeleteConfirm(true)}>Delete</Button>
|
||||
</div>
|
||||
)}
|
||||
<Button variant="secondary" onClick={onClose}>Cancel</Button>
|
||||
<Button variant="ghost" onClick={onClose}>Cancel</Button>
|
||||
<Button variant="primary" onClick={handleSave} disabled={!name || !processor || !expression}>Save</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ConfirmDialog
|
||||
open={showDeleteConfirm}
|
||||
onClose={() => setShowDeleteConfirm(false)}
|
||||
onConfirm={handleDelete}
|
||||
title="Delete Tap"
|
||||
message={`Delete tap "${name}"? This will remove the tap from the configuration.`}
|
||||
confirmText={name}
|
||||
confirmLabel="Delete"
|
||||
variant="danger"
|
||||
/>
|
||||
</Modal>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user