From e0870731213d353d2d718ba0b600ce8c08add14a Mon Sep 17 00:00:00 2001 From: Adrien de Peretti Date: Thu, 24 Oct 2024 13:18:05 +0200 Subject: [PATCH] fix(dashboard): Workflow executions (#9757) **What** - Fix wrong http request fields - fix workflow executions UI Screenshot 2024-10-24 at 12 22 06 Screenshot 2024-10-24 at 12 22 19 --- .changeset/four-trees-smile.md | 5 ++++ .../routes/workflow-executions/constants.ts | 23 ++++++++++++------- .../workflow-execution-history-section.tsx | 10 ++++---- .../workflow-execution-list-table.tsx | 1 - 4 files changed, 24 insertions(+), 15 deletions(-) create mode 100644 .changeset/four-trees-smile.md diff --git a/.changeset/four-trees-smile.md b/.changeset/four-trees-smile.md new file mode 100644 index 0000000000..a6570dd2ba --- /dev/null +++ b/.changeset/four-trees-smile.md @@ -0,0 +1,5 @@ +--- +"@medusajs/dashboard": patch +--- + +fix(dashboard): Workflow executions diff --git a/packages/admin/dashboard/src/routes/workflow-executions/constants.ts b/packages/admin/dashboard/src/routes/workflow-executions/constants.ts index f84c286d6a..df6dc0eb4a 100644 --- a/packages/admin/dashboard/src/routes/workflow-executions/constants.ts +++ b/packages/admin/dashboard/src/routes/workflow-executions/constants.ts @@ -1,30 +1,37 @@ +import { HttpTypes } from "@medusajs/types" import { TransactionState, TransactionStepState } from "./types" -export const STEP_IN_PROGRESS_STATES = [ +export const STEP_IN_PROGRESS_STATES: HttpTypes.TransactionStepState[] = [ TransactionStepState.COMPENSATING, TransactionStepState.INVOKING, ] -export const STEP_SKIPPED_STATES = [ +export const STEP_SKIPPED_STATES: HttpTypes.TransactionStepState[] = [ TransactionStepState.SKIPPED, TransactionStepState.SKIPPED_FAILURE, ] -export const STEP_OK_STATES = [TransactionStepState.DONE] +export const STEP_OK_STATES: HttpTypes.TransactionStepState[] = [ + TransactionStepState.DONE, +] -export const STEP_ERROR_STATES = [ +export const STEP_ERROR_STATES: HttpTypes.TransactionStepState[] = [ TransactionStepState.FAILED, TransactionStepState.REVERTED, TransactionStepState.TIMEOUT, TransactionStepState.DORMANT, ] -export const STEP_INACTIVE_STATES = [TransactionStepState.NOT_STARTED] +export const STEP_INACTIVE_STATES: HttpTypes.TransactionStepState[] = [ + TransactionStepState.NOT_STARTED, +] -export const TRANSACTION_OK_STATES = [TransactionState.DONE] -export const TRANSACTION_ERROR_STATES = [ +export const TRANSACTION_OK_STATES: HttpTypes.TransactionState[] = [ + TransactionState.DONE, +] +export const TRANSACTION_ERROR_STATES: HttpTypes.TransactionState[] = [ TransactionState.FAILED, TransactionState.REVERTED, ] -export const TRANSACTION_IN_PROGRESS_STATES = [ +export const TRANSACTION_IN_PROGRESS_STATES: HttpTypes.TransactionState[] = [ TransactionState.INVOKING, TransactionState.WAITING_TO_COMPENSATE, TransactionState.COMPENSATING, diff --git a/packages/admin/dashboard/src/routes/workflow-executions/workflow-execution-detail/components/workflow-execution-history-section/workflow-execution-history-section.tsx b/packages/admin/dashboard/src/routes/workflow-executions/workflow-execution-detail/components/workflow-execution-history-section/workflow-execution-history-section.tsx index 5e8ba2ce53..88a3dd970b 100644 --- a/packages/admin/dashboard/src/routes/workflow-executions/workflow-execution-detail/components/workflow-execution-history-section/workflow-execution-history-section.tsx +++ b/packages/admin/dashboard/src/routes/workflow-executions/workflow-execution-detail/components/workflow-execution-history-section/workflow-execution-history-section.tsx @@ -1,11 +1,11 @@ import { Spinner, TriangleDownMini } from "@medusajs/icons" import { + clx, CodeBlock, Container, Heading, IconButton, Text, - clx, } from "@medusajs/ui" import * as Collapsible from "@radix-ui/react-collapsible" import { format } from "date-fns" @@ -14,8 +14,8 @@ import { useTranslation } from "react-i18next" import { useLocation } from "react-router-dom" import { STEP_ERROR_STATES, - STEP_INACTIVE_STATES, STEP_IN_PROGRESS_STATES, + STEP_INACTIVE_STATES, STEP_OK_STATES, STEP_SKIPPED_STATES, } from "../../../constants" @@ -93,7 +93,7 @@ const Event = ({ isUnreachable, }: { step: HttpTypes.AdminWorkflowExecutionStep - stepInvokeContext: HttpTypes.StepInvoke | undefined + stepInvokeContext: HttpTypes.StepInvokeResult | undefined stepError?: HttpTypes.StepError | undefined isLast: boolean isUnreachable?: boolean @@ -115,8 +115,6 @@ const Event = ({ const identifier = step.id.split(".").pop() - stepInvokeContext - return (
)} - {!!stepInvokeContext?.output.compensateInput && + {!!stepInvokeContext?.output?.compensateInput && step.compensate.state === TransactionStepState.REVERTED && (
diff --git a/packages/admin/dashboard/src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/workflow-execution-list-table.tsx b/packages/admin/dashboard/src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/workflow-execution-list-table.tsx index bbd25361b1..d863de6ad0 100644 --- a/packages/admin/dashboard/src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/workflow-execution-list-table.tsx +++ b/packages/admin/dashboard/src/routes/workflow-executions/workflow-execution-list/components/workflow-execution-list-table/workflow-execution-list-table.tsx @@ -19,7 +19,6 @@ export const WorkflowExecutionListTable = () => { useWorkflowExecutions( { ...searchParams, - fields: "execution,state", }, { placeholderData: keepPreviousData,