From 98b9ec5a047e06c03afcb62213f94736c959bc5f Mon Sep 17 00:00:00 2001 From: Rene Dohmen Date: Sat, 7 Oct 2023 01:18:01 +0200 Subject: [PATCH] Working start task button --- .../pages/start-workflow/[workflowName].tsx | 3 ++- .../WFOButtonComboBox/WFOButtonComboBox.tsx | 3 +-- .../src/components/WFOButtonComboBox/styles.ts | 6 ------ .../WFOStartTaskButtonComboBox.tsx | 14 +++++++------- .../src/messages/nl-NL.json | 13 ++++++++++++- .../src/pages/tasks/WFOTaskListPage.tsx | 2 +- .../src/pages/workflow/WFOStartWorkflowPage.tsx | 16 +++++++--------- 7 files changed, 30 insertions(+), 27 deletions(-) diff --git a/apps/wfo-ui/pages/start-workflow/[workflowName].tsx b/apps/wfo-ui/pages/start-workflow/[workflowName].tsx index d441c96b7..6c17d308d 100644 --- a/apps/wfo-ui/pages/start-workflow/[workflowName].tsx +++ b/apps/wfo-ui/pages/start-workflow/[workflowName].tsx @@ -26,9 +26,10 @@ const StartWorkflowPage = () => { subscription_id: subscriptionId, }; } + return undefined; }; const startWorkflowPayload = getStartWorkFlowPayload(); - if (startWorkflowPayload) { + if (workflowName) { return ( = ({ isProcess, }) => { const [isPopoverOpen, setPopoverOpen] = useState(false); - const { popoverStyle, selectableStyle } = getStyles(); + const { selectableStyle } = getStyles(); const { theme } = useOrchestratorTheme(); const Button = ( @@ -48,7 +48,6 @@ export const WFOButtonComboBox: FC = ({ return ( { const comboBoxWidth = '300px'; - const popoverStyle = css({ - inlineSize: '100%', - div: { inlineSize: '100%' }, - }); - const selectableStyle = css({ width: comboBoxWidth, }); return { - popoverStyle, selectableStyle, }; }; diff --git a/packages/orchestrator-ui-components/src/components/WFOStartTaskButtonComboBox/WFOStartTaskButtonComboBox.tsx b/packages/orchestrator-ui-components/src/components/WFOStartTaskButtonComboBox/WFOStartTaskButtonComboBox.tsx index f54e0a757..4bd7058c9 100644 --- a/packages/orchestrator-ui-components/src/components/WFOStartTaskButtonComboBox/WFOStartTaskButtonComboBox.tsx +++ b/packages/orchestrator-ui-components/src/components/WFOStartTaskButtonComboBox/WFOStartTaskButtonComboBox.tsx @@ -24,20 +24,20 @@ export const WFOStartTaskButtonComboBox = () => { }, 'taskWorkflows', ); - debugger; - console.log('DATA:'); - console.log(data); const productList: WorkflowComboBoxOption[] = data?.workflows.page.map( (w) => { - return { label: w.name, data: w.name }; + return { + label: w.description, + data: { workflowName: w.name, productId: '' }, + }; }, - ); + ) as WorkflowComboBoxOption[]; const handleOptionChange = (selectedProduct: WorkflowComboBoxOption) => { - const { workflowName, productId } = selectedProduct.data; + const { workflowName } = selectedProduct.data; router.push({ pathname: `${PATH_START_WORKFLOW}/${workflowName}`, - query: { productId }, + // query: { }, }); }; diff --git a/packages/orchestrator-ui-components/src/messages/nl-NL.json b/packages/orchestrator-ui-components/src/messages/nl-NL.json index 7d785bbbc..0832b1bfb 100644 --- a/packages/orchestrator-ui-components/src/messages/nl-NL.json +++ b/packages/orchestrator-ui-components/src/messages/nl-NL.json @@ -14,6 +14,15 @@ "retrieve_stored_settings": "Er ging iets fout tijdens het laden van de instellingen. Hersteld naar standaard waardes", "retrieve_stored_settings_title": "Fout tijdens het ophalen van instellingen." }, + "pydanticForms": { + "userInputForm": { + "cancel": "Annuleren", + "submit": "Verstuur", + "previous": "Vorige", + "runProcess": "Start workflow", + "cancelProcess": "Annuleren" + } + }, "metadata": { "tabs": { "products": "Producten", @@ -96,7 +105,9 @@ "viewOptions": "Scherm options", "expandAll": "klap alles uit", "collapseAll": "klap alles in", - "duration": "Looptijd" + "duration": "Looptijd", + "userInput": "Workflow input", + "inProgress": "Nu bezig" } }, "subscriptions": { diff --git a/packages/orchestrator-ui-components/src/pages/tasks/WFOTaskListPage.tsx b/packages/orchestrator-ui-components/src/pages/tasks/WFOTaskListPage.tsx index e71b4ee0f..9fcdc4f67 100644 --- a/packages/orchestrator-ui-components/src/pages/tasks/WFOTaskListPage.tsx +++ b/packages/orchestrator-ui-components/src/pages/tasks/WFOTaskListPage.tsx @@ -12,7 +12,7 @@ import { useTranslations } from 'next-intl'; import { useDataDisplayParams, useOrchestratorTheme } from '../../hooks'; import { EuiButton, EuiHorizontalRule, EuiSpacer } from '@elastic/eui'; import { WFOPageHeader } from '../../components/WFOPageHeader/WFOPageHeader'; -import { WFOPlusCircleFill, WFORefresh } from '../../icons'; +import { WFORefresh } from '../../icons'; import { ProcessListItem, WFOProcessList, diff --git a/packages/orchestrator-ui-components/src/pages/workflow/WFOStartWorkflowPage.tsx b/packages/orchestrator-ui-components/src/pages/workflow/WFOStartWorkflowPage.tsx index 56d15ed55..d61b8f36c 100644 --- a/packages/orchestrator-ui-components/src/pages/workflow/WFOStartWorkflowPage.tsx +++ b/packages/orchestrator-ui-components/src/pages/workflow/WFOStartWorkflowPage.tsx @@ -29,17 +29,13 @@ type StartModifyWorkflowPayload = { subscription_id: string; }; -type StartTaskWorkflow = { - subscription_id?: string; -}; - type StartWorkFlowPayload = | StartCreateWorkflowPayload | StartModifyWorkflowPayload; interface WFOStartWorkflowPageProps { workflowName: string; - startWorkflowPayload: StartWorkFlowPayload; + startWorkflowPayload?: StartWorkFlowPayload | undefined; } export interface UserInputForm { @@ -62,10 +58,12 @@ export const WFOStartWorkflowPage = ({ const submit = useCallback( (processInput: object[]) => { const startWorkflowPromise = apiClient - .startProcess(workflowName, [ - startWorkflowPayload, - ...processInput, - ]) + .startProcess( + workflowName, + startWorkflowPayload + ? [startWorkflowPayload, ...processInput] + : [...processInput], + ) .then( // Resolve handler (result) => {