feat(ui): add toasts for create edit and run flows
- add global ToastProvider and useToast hook mounted at app root - show success/error toasts for environment, credential, snippet, and scenario create/edit actions - show run-started/error toasts on scenario run actions with 100ms exit animation
This commit is contained in:
1 parent
d511c85891
commit
7444082b65
18 files changed
+285
-31
No files matched your search
@@ -12,6 +12,7 @@ import {
|
||||
Table,
|
||||
Timestamp,
|
||||
UuidBadge,
|
||||
useToast,
|
||||
type TableColumn,
|
||||
} from '../../ui';
|
||||
import type { BadgeVariant } from '../../ui';
|
||||
@@ -37,6 +38,7 @@ export function RunsPage() {
|
||||
const { t } = useTranslation();
|
||||
const { id } = useParams<{ id: string }>();
|
||||
const navigate = useNavigate();
|
||||
const toast = useToast();
|
||||
|
||||
const [scenario, setScenario] = useState<Scenario | null>(null);
|
||||
const [items, setItems] = useState<RunRow[]>([]);
|
||||
@@ -71,8 +73,13 @@ export function RunsPage() {
|
||||
}, [load]);
|
||||
|
||||
const handleRun = async () => {
|
||||
const run = await scenarios.run(id!);
|
||||
navigate(`/scenarios/${id}/runs/${run.id}`);
|
||||
try {
|
||||
const run = await scenarios.run(id!);
|
||||
toast.success('Scenario run started');
|
||||
navigate(`/scenarios/${id}/runs/${run.id}`);
|
||||
} catch (err) {
|
||||
toast.error((err as Error).message);
|
||||
}
|
||||
};
|
||||
|
||||
const columns: TableColumn<RunRow>[] = [
|
||||
|
||||
Reference in new issue
Block a user