fix(dashboard): Workflow executions (#9757)

**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">
This commit is contained in:
Adrien de Peretti authored and GitHub committed 2024-10-24 11:18:05 +00:00
1 parent 7b6793f846
commit e087073121
4 files changed
+24 -15

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
"@medusajs/dashboard": patch
---
fix(dashboard): Workflow executions
@@ -1,30 +1,37 @@
import { HttpTypes } from "@medusajs/types"
import { TransactionState, TransactionStepState } from "./types" import { TransactionState, TransactionStepState } from "./types"
export const STEP_IN_PROGRESS_STATES = [ export const STEP_IN_PROGRESS_STATES: HttpTypes.TransactionStepState[] = [
TransactionStepState.COMPENSATING, TransactionStepState.COMPENSATING,
TransactionStepState.INVOKING, TransactionStepState.INVOKING,
] ]
export const STEP_SKIPPED_STATES = [ export const STEP_SKIPPED_STATES: HttpTypes.TransactionStepState[] = [
TransactionStepState.SKIPPED, TransactionStepState.SKIPPED,
TransactionStepState.SKIPPED_FAILURE, 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.FAILED,
TransactionStepState.REVERTED, TransactionStepState.REVERTED,
TransactionStepState.TIMEOUT, TransactionStepState.TIMEOUT,
TransactionStepState.DORMANT, 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_OK_STATES: HttpTypes.TransactionState[] = [
export const TRANSACTION_ERROR_STATES = [ TransactionState.DONE,
]
export const TRANSACTION_ERROR_STATES: HttpTypes.TransactionState[] = [
TransactionState.FAILED, TransactionState.FAILED,
TransactionState.REVERTED, TransactionState.REVERTED,
] ]
export const TRANSACTION_IN_PROGRESS_STATES = [ export const TRANSACTION_IN_PROGRESS_STATES: HttpTypes.TransactionState[] = [
TransactionState.INVOKING, TransactionState.INVOKING,
TransactionState.WAITING_TO_COMPENSATE, TransactionState.WAITING_TO_COMPENSATE,
TransactionState.COMPENSATING, TransactionState.COMPENSATING,
@@ -1,11 +1,11 @@
import { Spinner, TriangleDownMini } from "@medusajs/icons" import { Spinner, TriangleDownMini } from "@medusajs/icons"
import { import {
clx,
CodeBlock, CodeBlock,
Container, Container,
Heading, Heading,
IconButton, IconButton,
Text, Text,
clx,
} from "@medusajs/ui" } from "@medusajs/ui"
import * as Collapsible from "@radix-ui/react-collapsible" import * as Collapsible from "@radix-ui/react-collapsible"
import { format } from "date-fns" import { format } from "date-fns"
@@ -14,8 +14,8 @@ import { useTranslation } from "react-i18next"
import { useLocation } from "react-router-dom" import { useLocation } from "react-router-dom"
import { import {
STEP_ERROR_STATES, STEP_ERROR_STATES,
STEP_INACTIVE_STATES,
STEP_IN_PROGRESS_STATES, STEP_IN_PROGRESS_STATES,
STEP_INACTIVE_STATES,
STEP_OK_STATES, STEP_OK_STATES,
STEP_SKIPPED_STATES, STEP_SKIPPED_STATES,
} from "../../../constants" } from "../../../constants"
@@ -93,7 +93,7 @@ const Event = ({
isUnreachable, isUnreachable,
}: { }: {
step: HttpTypes.AdminWorkflowExecutionStep step: HttpTypes.AdminWorkflowExecutionStep
stepInvokeContext: HttpTypes.StepInvoke | undefined stepInvokeContext: HttpTypes.StepInvokeResult | undefined
stepError?: HttpTypes.StepError | undefined stepError?: HttpTypes.StepError | undefined
isLast: boolean isLast: boolean
isUnreachable?: boolean isUnreachable?: boolean
@@ -115,8 +115,6 @@ const Event = ({
const identifier = step.id.split(".").pop() const identifier = step.id.split(".").pop()
stepInvokeContext
return ( return (
<div <div
className="grid grid-cols-[20px_1fr] items-start gap-x-2 px-2" className="grid grid-cols-[20px_1fr] items-start gap-x-2 px-2"
@@ -217,7 +215,7 @@ const Event = ({
</CodeBlock> </CodeBlock>
</div> </div>
)} )}
{!!stepInvokeContext?.output.compensateInput && {!!stepInvokeContext?.output?.compensateInput &&
step.compensate.state === TransactionStepState.REVERTED && ( step.compensate.state === TransactionStepState.REVERTED && (
<div className="text-ui-fg-subtle flex flex-col gap-y-2"> <div className="text-ui-fg-subtle flex flex-col gap-y-2">
<Text size="small" leading="compact"> <Text size="small" leading="compact">
@@ -19,7 +19,6 @@ export const WorkflowExecutionListTable = () => {
useWorkflowExecutions( useWorkflowExecutions(
{ {
...searchParams, ...searchParams,
fields: "execution,state",
}, },
{ {
placeholderData: keepPreviousData, placeholderData: keepPreviousData,