From 58e2a50b7452e9fd2d233b5cc3a3ce4760c4d145 Mon Sep 17 00:00:00 2001 From: Connor Yoh Date: Tue, 19 Aug 2025 14:35:18 +0100 Subject: [PATCH] Clean automationcreation --- .../tools/automate/AutomationCreation.tsx | 213 +++++++----------- 1 file changed, 84 insertions(+), 129 deletions(-) diff --git a/frontend/src/components/tools/automate/AutomationCreation.tsx b/frontend/src/components/tools/automate/AutomationCreation.tsx index 28c90bf0e..4beb99ce4 100644 --- a/frontend/src/components/tools/automate/AutomationCreation.tsx +++ b/frontend/src/components/tools/automate/AutomationCreation.tsx @@ -2,28 +2,24 @@ import React, { useState, useEffect } from 'react'; import { useTranslation } from 'react-i18next'; import { Button, - Card, Text, Title, Stack, Group, Select, TextInput, - Textarea, - Badge, ActionIcon, - Modal, - Box + Divider } from '@mantine/core'; import AddIcon from '@mui/icons-material/Add'; import DeleteIcon from '@mui/icons-material/Delete'; import SettingsIcon from '@mui/icons-material/Settings'; -import ArrowForwardIcon from '@mui/icons-material/ArrowForward'; import ArrowBackIcon from '@mui/icons-material/ArrowBack'; import CheckIcon from '@mui/icons-material/Check'; import CloseIcon from '@mui/icons-material/Close'; import { useToolWorkflow } from '../../../contexts/ToolWorkflowContext'; import ToolConfigurationModal from './ToolConfigurationModal'; +import AutomationEntry from './AutomationEntry'; interface AutomationCreationProps { mode: 'custom' | 'suggested' | 'create'; @@ -45,7 +41,6 @@ export default function AutomationCreation({ mode, existingAutomation, onBack, o const { toolRegistry } = useToolWorkflow(); const [automationName, setAutomationName] = useState(''); - const [automationDescription, setAutomationDescription] = useState(''); const [selectedTools, setSelectedTools] = useState([]); const [configModalOpen, setConfigModalOpen] = useState(false); const [configuraingToolIndex, setConfiguringToolIndex] = useState(-1); @@ -54,7 +49,6 @@ export default function AutomationCreation({ mode, existingAutomation, onBack, o useEffect(() => { if (mode === 'suggested' && existingAutomation) { setAutomationName(existingAutomation.name); - setAutomationDescription(existingAutomation.description || ''); const tools = existingAutomation.operations.map((op: string) => ({ id: `${op}-${Date.now()}`, @@ -77,7 +71,7 @@ export default function AutomationCreation({ mode, existingAutomation, onBack, o if (!toolRegistry) return []; return Object.entries(toolRegistry) - .filter(([key]) => key !== 'automate') // Don't allow recursive automations + .filter(([key]) => key !== 'automate') .map(([key, tool]) => ({ value: key, label: (tool as any).name @@ -139,7 +133,7 @@ export default function AutomationCreation({ mode, existingAutomation, onBack, o const automation = { name: automationName.trim(), - description: automationDescription.trim(), + description: '', operations: selectedTools.map(tool => ({ operation: tool.operation, parameters: tool.parameters @@ -152,147 +146,108 @@ export default function AutomationCreation({ mode, existingAutomation, onBack, o onComplete(); } catch (error) { console.error('Error saving automation:', error); - // TODO: Show error notification to user } }; const currentConfigTool = configuraingToolIndex >= 0 ? selectedTools[configuraingToolIndex] : null; return ( - - -
- - {mode === 'create' - ? t('automate.creation.title.create', 'Create New Automation') - : mode === 'suggested' - ? t('automate.creation.title.configure', 'Configure Automation') - : t('automate.creation.title.edit', 'Edit Automation') - } - - - {t('automate.creation.description', 'Add and configure tools to create your workflow')} - -
- +
+ + + {mode === 'create' + ? t('automate.creation.title.create', 'Create Automation') + : t('automate.creation.title.configure', 'Configure Automation') + } + + + + - {/* Automation Details */} - - - setAutomationName(e.currentTarget.value)} - required - /> -