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
2024-10-24 13:18:05 +02:00
committed by GitHub
parent 7b6793f846
commit e087073121
4 changed files with 24 additions and 15 deletions

View File

@@ -0,0 +1,5 @@
---
"@medusajs/dashboard": patch
---
fix(dashboard): Workflow executions

View File

@@ -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,

View File

@@ -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 (
<div
className="grid grid-cols-[20px_1fr] items-start gap-x-2 px-2"
@@ -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">

View File

@@ -19,7 +19,6 @@ export const WorkflowExecutionListTable = () => {
useWorkflowExecutions(
{
...searchParams,
fields: "execution,state",
},
{
placeholderData: keepPreviousData,