Skip to content

Commit

Permalink
Working start task button
Browse files Browse the repository at this point in the history
  • Loading branch information
acidjunk committed Oct 6, 2023
1 parent 04508bc commit 98b9ec5
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 27 deletions.
3 changes: 2 additions & 1 deletion apps/wfo-ui/pages/start-workflow/[workflowName].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ const StartWorkflowPage = () => {
subscription_id: subscriptionId,
};
}
return undefined;
};
const startWorkflowPayload = getStartWorkFlowPayload();
if (startWorkflowPayload) {
if (workflowName) {
return (
<WFOStartWorkflowPage
workflowName={workflowName}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const WFOButtonComboBox: FC<WFOButtonComboBoxProps> = ({
isProcess,
}) => {
const [isPopoverOpen, setPopoverOpen] = useState(false);
const { popoverStyle, selectableStyle } = getStyles();
const { selectableStyle } = getStyles();
const { theme } = useOrchestratorTheme();

const Button = (
Expand All @@ -48,7 +48,6 @@ export const WFOButtonComboBox: FC<WFOButtonComboBoxProps> = ({

return (
<EuiPopover
css={popoverStyle}
initialFocus={`.euiSelectable .euiFieldSearch`}
button={Button}
isOpen={isPopoverOpen}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,11 @@ import { css } from '@emotion/react';
export const getStyles = () => {
const comboBoxWidth = '300px';

const popoverStyle = css({
inlineSize: '100%',
div: { inlineSize: '100%' },
});

const selectableStyle = css({
width: comboBoxWidth,
});

return {
popoverStyle,
selectableStyle,
};
};
Original file line number Diff line number Diff line change
Expand Up @@ -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: { },
});
};

Expand Down
13 changes: 12 additions & 1 deletion packages/orchestrator-ui-components/src/messages/nl-NL.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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) => {
Expand Down

0 comments on commit 98b9ec5

Please sign in to comment.