feat(medusa,dashboard): Add metadata UI to product tags domain + retrieve metadata by default (#13272)
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/dashboard": patch
|
||||||
|
"@medusajs/medusa": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(medusa,dashboard): Retrieve `metadata` for product_tags by default and add metadta UI to product tag domain in admin dashboard
|
||||||
@@ -1329,6 +1329,13 @@ export function getRouteMap({
|
|||||||
lazy: () =>
|
lazy: () =>
|
||||||
import("../../routes/product-tags/product-tag-edit"),
|
import("../../routes/product-tags/product-tag-edit"),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "metadata/edit",
|
||||||
|
lazy: () =>
|
||||||
|
import(
|
||||||
|
"../../routes/product-tags/product-tag-metadata"
|
||||||
|
),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
+1
@@ -40,6 +40,7 @@ export const ProductTagDetail = () => {
|
|||||||
before: getWidgets("product_tag.details.before"),
|
before: getWidgets("product_tag.details.before"),
|
||||||
}}
|
}}
|
||||||
showJSON
|
showJSON
|
||||||
|
showMetadata
|
||||||
data={product_tag}
|
data={product_tag}
|
||||||
>
|
>
|
||||||
<ProductTagGeneralSection productTag={product_tag} />
|
<ProductTagGeneralSection productTag={product_tag} />
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
export { ProductTagMetadata as Component } from "./product-tag-metadata"
|
||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
import { useParams } from "react-router-dom"
|
||||||
|
import { MetadataForm } from "../../../components/forms/metadata-form/metadata-form"
|
||||||
|
import { useProductTag, useUpdateProductTag } from "../../../hooks/api"
|
||||||
|
|
||||||
|
export const ProductTagMetadata = () => {
|
||||||
|
const { id } = useParams()
|
||||||
|
|
||||||
|
const { product_tag, isPending, isError, error } = useProductTag(id!)
|
||||||
|
|
||||||
|
const { mutateAsync, isPending: isMutating } = useUpdateProductTag(
|
||||||
|
product_tag?.id!
|
||||||
|
)
|
||||||
|
|
||||||
|
if (isError) {
|
||||||
|
throw error
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<MetadataForm
|
||||||
|
metadata={product_tag?.metadata}
|
||||||
|
hook={mutateAsync}
|
||||||
|
isPending={isPending}
|
||||||
|
isMutating={isMutating}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ export const defaultAdminProductTagFields = [
|
|||||||
"value",
|
"value",
|
||||||
"created_at",
|
"created_at",
|
||||||
"updated_at",
|
"updated_at",
|
||||||
|
"metadata",
|
||||||
]
|
]
|
||||||
|
|
||||||
export const retrieveProductTagTransformQueryConfig = {
|
export const retrieveProductTagTransformQueryConfig = {
|
||||||
|
|||||||
Reference in New Issue
Block a user