fix(admin-ui) Custom batch job activity card (#5288)

This commit is contained in:
pepijn-vanvlaanderen
2023-10-31 11:22:28 +01:00
committed by GitHub
parent 9ff22110a6
commit 2057d3b247
3 changed files with 9 additions and 13 deletions

View File

@@ -0,0 +1,5 @@
---
"@medusajs/admin-ui": patch
---
Fixes crash on the batch job activity card when using a custom batch job.

View File

@@ -18,7 +18,7 @@ import FileIcon from "../../fundamentals/icons/file-icon"
import MedusaIcon from "../../fundamentals/icons/medusa-icon"
import { ActivityCard } from "../../molecules/activity-card"
import BatchJobFileCard from "../../molecules/batch-job-file-card"
import { batchJobDescriptionBuilder, BatchJobOperation } from "./utils"
import { batchJobDescriptionBuilder } from "./utils"
import CrossIcon from "../../fundamentals/icons/cross-icon"
/**
@@ -86,12 +86,8 @@ const BatchJobActivityCard = (props: { batchJob: BatchJob }) => {
to: batchJob.created_at,
})
const operation = {
"product-import": BatchJobOperation.Import,
"price-list-import": BatchJobOperation.Import,
"product-export": BatchJobOperation.Export,
"order-export": BatchJobOperation.Export,
}[batchJob.type]
let operation = batchJob.type.split("-").pop()
operation = operation.charAt(0).toUpperCase() + operation.slice(1)
const batchJobActivityDescription = batchJobDescriptionBuilder(
batchJob,

View File

@@ -1,13 +1,8 @@
import { BatchJob } from "@medusajs/medusa/dist"
export enum BatchJobOperation {
Import = "Import",
Export = "Export",
}
export function batchJobDescriptionBuilder(
batchJob: BatchJob,
operation: BatchJobOperation,
operation: string,
elapsedTime?: number
): string {
let description = ""