Skip to content

Commit

Permalink
fix(dashboard): Workflow executions (#9757)
Browse files Browse the repository at this point in the history
**What**
- Fix wrong http request fields
- fix workflow executions UI

<img width="1609" alt="Screenshot 2024-10-24 at 12 22 06" src="https://github.com/user-attachments/assets/5f8ced3c-920e-424a-bdd0-ca5793fa8dad">
<img width="1623" alt="Screenshot 2024-10-24 at 12 22 19" src="https://github.com/user-attachments/assets/1df44280-3616-44af-a1a5-591e6c9a7986">
  • Loading branch information
adrien2p authored Oct 24, 2024
1 parent 7b6793f commit e087073
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .changeset/four-trees-smile.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@medusajs/dashboard": patch
---

fix(dashboard): Workflow executions
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -115,8 +115,6 @@ const Event = ({

const identifier = step.id.split(".").pop()

stepInvokeContext

return (
<div
className="grid grid-cols-[20px_1fr] items-start gap-x-2 px-2"
Expand Down Expand Up @@ -217,7 +215,7 @@ const Event = ({
</CodeBlock>
</div>
)}
{!!stepInvokeContext?.output.compensateInput &&
{!!stepInvokeContext?.output?.compensateInput &&
step.compensate.state === TransactionStepState.REVERTED && (
<div className="text-ui-fg-subtle flex flex-col gap-y-2">
<Text size="small" leading="compact">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ export const WorkflowExecutionListTable = () => {
useWorkflowExecutions(
{
...searchParams,
fields: "execution,state",
},
{
placeholderData: keepPreviousData,
Expand Down

0 comments on commit e087073

Please sign in to comment.