diff --git a/src/hooks/useAutomations.ts b/src/hooks/useAutomations.ts index ddb444f..69a6cbf 100644 --- a/src/hooks/useAutomations.ts +++ b/src/hooks/useAutomations.ts @@ -541,7 +541,7 @@ export function useAutomationTemplates() { }, [request]); const duplicateTemplate = useCallback(async (templateId: string) => { - const response = await request('POST', `/api/automation-templates/${templateId}/duplicate`); + const response = await request({ url: `/api/automation-templates/${templateId}/duplicate`, method: 'post' }); return response; }, [request]); diff --git a/src/hooks/useUserMandates.ts b/src/hooks/useUserMandates.ts index 1d7c666..cce62ca 100644 --- a/src/hooks/useUserMandates.ts +++ b/src/hooks/useUserMandates.ts @@ -54,6 +54,7 @@ export interface Role { description?: string | { [key: string]: string }; mandateId?: string; featureInstanceId?: string; + featureCode?: string; isSystemRole?: boolean; } diff --git a/src/pages/admin/AdminAutomationEventsPage.tsx b/src/pages/admin/AdminAutomationEventsPage.tsx index 8daf3e0..eecf72c 100644 --- a/src/pages/admin/AdminAutomationEventsPage.tsx +++ b/src/pages/admin/AdminAutomationEventsPage.tsx @@ -83,7 +83,7 @@ export const AdminAutomationEventsPage: React.FC = () => { const _handleDelete = useCallback(async (eventId: string) => { try { setError(null); - const event = events.find(e => e.eventId === eventId); + const _event = events.find(e => e.eventId === eventId); const encodedId = encodeURIComponent(eventId); await api.post(`/api/admin/automation-events/${encodedId}/remove`); setEvents(prev => prev.filter(e => e.eventId !== eventId)); diff --git a/src/pages/workflows/AutomationTemplatesPage.tsx b/src/pages/workflows/AutomationTemplatesPage.tsx index 0e5124b..f6d0bfd 100644 --- a/src/pages/workflows/AutomationTemplatesPage.tsx +++ b/src/pages/workflows/AutomationTemplatesPage.tsx @@ -53,7 +53,7 @@ export const AutomationTemplatesPage: React.FC = () => { const columns = useMemo(() => [ { key: 'label', label: 'Label', type: 'string' as const, sortable: true, searchable: true, width: 200 }, { key: 'overview', label: 'Beschreibung', type: 'string' as const, width: 300 }, - { key: 'isSystem', label: 'Typ', type: 'custom' as const, width: 100, render: (value: boolean) => + { key: 'isSystem', label: 'Typ', type: 'boolean' as const, width: 100, formatter: (value: any) => value ? System : Instanz }, @@ -124,17 +124,6 @@ export const AutomationTemplatesPage: React.FC = () => { } }; - // Check if template is editable (system templates only by SysAdmin) - const _canEditTemplate = (template: AutomationTemplate) => { - if ((template as any).isSystem) return isSysAdmin; - return canUpdate; - }; - - const _canDeleteTemplate = (template: AutomationTemplate) => { - if ((template as any).isSystem) return isSysAdmin; - return canDelete; - }; - if (error) { return (
@@ -211,8 +200,7 @@ export const AutomationTemplatesPage: React.FC = () => { selectable={false} actionButtons={[ { - type: 'custom' as const, - icon: , + type: 'copy' as const, title: 'Duplizieren', onAction: handleDuplicate, }, diff --git a/src/pages/workflows/AutomationsPage.tsx b/src/pages/workflows/AutomationsPage.tsx index f1e1bd1..b7aa3d0 100644 --- a/src/pages/workflows/AutomationsPage.tsx +++ b/src/pages/workflows/AutomationsPage.tsx @@ -247,7 +247,7 @@ export const AutomationsPage: React.FC = () => { // Handle duplicate automation const handleDuplicate = async (automation: Automation) => { try { - await request('POST', `/api/automations/${automation.id}/duplicate`); + await request({ url: `/api/automations/${automation.id}/duplicate`, method: 'post' }); showSuccess('Automatisierung dupliziert'); await refetch(); } catch (err: any) { @@ -341,7 +341,7 @@ export const AutomationsPage: React.FC = () => { url: `/api/workflows/${workflowId}/logs`, method: 'get', params: lastLogIdRef.current ? { afterId: lastLogIdRef.current } : {}, - headers: contextHeaders, + additionalConfig: { headers: contextHeaders }, }); const logs: WorkflowLog[] = response?.items || response || []; @@ -364,7 +364,7 @@ export const AutomationsPage: React.FC = () => { const statusResponse = await request({ url: `/api/workflows/${workflowId}`, method: 'get', - headers: contextHeaders, + additionalConfig: { headers: contextHeaders }, }); const workflowStatus = statusResponse?.status; @@ -462,7 +462,7 @@ export const AutomationsPage: React.FC = () => { await request({ url: `/api/workflows/${executionModal.workflowId}/stop`, method: 'post', - headers: stopHeaders, + additionalConfig: { headers: stopHeaders }, }); setExecutionModal(prev => ({ @@ -628,8 +628,7 @@ export const AutomationsPage: React.FC = () => { selectable={false} actionButtons={[ ...(canCreate ? [{ - type: 'custom' as const, - icon: , + type: 'copy' as const, title: 'Duplizieren', onAction: handleDuplicate, }] : []),