fix(admin-ui): Delete variant (#4163)
* fix(admin-ui): Delete variant * Create slimy-houses-battle.md
This commit is contained in:
1 parent
063d9b6d55
commit
f47b11293e
2 files changed
+13
-5
No files matched your search
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
"@medusajs/admin-ui": patch
|
||||||
|
"@medusajs/admin": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix(admin-ui): Delete variant
|
||||||
@@ -88,7 +88,9 @@ const VariantsTable = ({ variants, actions }: Props) => {
|
|||||||
const { isFeatureEnabled } = useFeatureFlag()
|
const { isFeatureEnabled } = useFeatureFlag()
|
||||||
const hasInventoryService = isFeatureEnabled("inventoryService")
|
const hasInventoryService = isFeatureEnabled("inventoryService")
|
||||||
const columns = useVariantsTableColumns(hasInventoryService)
|
const columns = useVariantsTableColumns(hasInventoryService)
|
||||||
const [showDelete, setShowDelete] = useState(false)
|
const [variantToRemove, setVariantToRemove] = useState<ProductVariant | null>(
|
||||||
|
null
|
||||||
|
)
|
||||||
|
|
||||||
const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow } =
|
const { getTableProps, getTableBodyProps, headerGroups, rows, prepareRow } =
|
||||||
useTable({
|
useTable({
|
||||||
@@ -134,7 +136,7 @@ const VariantsTable = ({ variants, actions }: Props) => {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: "Delete Variant",
|
label: "Delete Variant",
|
||||||
onClick: () => setShowDelete(true),
|
onClick: () => setVariantToRemove(variant),
|
||||||
icon: <TrashIcon size="20" />,
|
icon: <TrashIcon size="20" />,
|
||||||
variant: "danger",
|
variant: "danger",
|
||||||
},
|
},
|
||||||
@@ -179,10 +181,10 @@ const VariantsTable = ({ variants, actions }: Props) => {
|
|||||||
<Table.Cell>
|
<Table.Cell>
|
||||||
<div className="float-right">
|
<div className="float-right">
|
||||||
<Actionables forceDropdown actions={actionables} />
|
<Actionables forceDropdown actions={actionables} />
|
||||||
{showDelete && (
|
{variantToRemove && (
|
||||||
<DeletePrompt
|
<DeletePrompt
|
||||||
onDelete={async () => deleteVariant(row.original.id)}
|
onDelete={async () => deleteVariant(variantToRemove.id)}
|
||||||
handleClose={() => setShowDelete(false)}
|
handleClose={() => setVariantToRemove(null)}
|
||||||
confirmText="Yes, delete"
|
confirmText="Yes, delete"
|
||||||
heading="Delete variant"
|
heading="Delete variant"
|
||||||
text={`Are you sure you want to delete this variant? ${
|
text={`Are you sure you want to delete this variant? ${
|
||||||
|
|||||||
Reference in new issue
Block a user