Quellcode durchsuchen

fix(dashboard): Add missing columns to product variants table

Michael Bromley vor 4 Monaten
Ursprung
Commit
0577e24341

+ 1 - 0
packages/dashboard/src/app/routes/_authenticated/_product-variants/product-variants.graphql.ts

@@ -14,6 +14,7 @@ export const productVariantListDocument = graphql(
                     }
                     name
                     sku
+                    enabled
                     currencyCode
                     price
                     priceWithTax

+ 6 - 2
packages/dashboard/src/app/routes/_authenticated/_products/components/product-variants-table.tsx

@@ -47,8 +47,12 @@ export function ProductVariantsTable({
                 productId,
             })}
             defaultVisibility={{
-                id: false,
-                currencyCode: false,
+                featuredAsset: true,
+                name: true,
+                enabled: true,
+                price: true,
+                priceWithTax: true,
+                stockLevels: true,
             }}
             customizeColumns={{
                 name: {

+ 25 - 16
packages/dashboard/src/app/routes/_authenticated/_products/products.graphql.ts

@@ -61,25 +61,34 @@ export const productDetailFragment = graphql(
     [assetFragment],
 );
 
-export const productVariantListDocument = graphql(`
-    query ProductVariantList($options: ProductVariantListOptions, $productId: ID) {
-        productVariants(options: $options, productId: $productId) {
-            items {
-                id
-                name
-                sku
-                currencyCode
-                price
-                priceWithTax
-                stockLevels {
-                    stockOnHand
-                    stockAllocated
+export const productVariantListDocument = graphql(
+    `
+        query ProductVariantList($options: ProductVariantListOptions, $productId: ID) {
+            productVariants(options: $options, productId: $productId) {
+                items {
+                    id
+                    createdAt
+                    updatedAt
+                    featuredAsset {
+                        ...Asset
+                    }
+                    name
+                    sku
+                    enabled
+                    currencyCode
+                    price
+                    priceWithTax
+                    stockLevels {
+                        stockOnHand
+                        stockAllocated
+                    }
                 }
+                totalItems
             }
-            totalItems
         }
-    }
-`);
+    `,
+    [assetFragment],
+);
 
 export const productDetailDocument = graphql(
     `