Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix minor bugs

dominik-zeglenef0b008eb9d0
diff --git a/saleor/static/dashboard-next/products/components/ProductVariantAttributes/ProductVariantAttributes.tsx b/saleor/static/dashboard-next/products/components/ProductVariantAttributes/ProductVariantAttributes.tsx
index 2743f5a6ef..6a0407f572 100644
--- a/saleor/static/dashboard-next/products/components/ProductVariantAttributes/ProductVariantAttributes.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductVariantAttributes/ProductVariantAttributes.tsx
@@ -35,9 +35,6 @@ const decorate = withStyles(theme => ({
overflow: "visible" as "visible"
},
grid: {
- "& input": {
- width: "100%"
- },
display: "grid",
gridGap: `${theme.spacing.unit * 2}px`,
gridTemplateColumns: "1fr 1fr"
diff --git a/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx b/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx
index 18da52c45b..95aa19abf4 100644
--- a/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductVariantCreatePage/ProductVariantCreatePage.tsx
@@ -25,7 +25,7 @@ interface FormData {
costPrice?: string;
images?: string[];
priceOverride?: string;
- stock?: number;
+ stock?: string;
sku?: string;
}
interface ProductVariantCreatePageProps {
@@ -71,9 +71,6 @@ interface ProductVariantCreatePageProps {
const decorate = withStyles(theme => ({
root: {
- "& input": {
- width: "100%"
- },
display: "grid",
gridGap: `${theme.spacing.unit * 2}px`,
gridTemplateColumns: "1fr 2.25fr",
@@ -115,14 +112,14 @@ const ProductVariantCreatePage = decorate<ProductVariantCreatePageProps>(
value: ""
}))
: undefined,
- costPrice: null,
+ costPrice: "",
images:
product && product.images && product.images.edges
? product.images.edges.map(edge => edge.node.id)
: undefined,
- priceOverride: null,
- sku: null,
- stock: null
+ priceOverride: "",
+ sku: "",
+ stock: ""
}}
errors={formErrors}
onSubmit={onSubmit}
diff --git a/saleor/static/dashboard-next/products/components/ProductVariantStock/ProductVariantStock.tsx b/saleor/static/dashboard-next/products/components/ProductVariantStock/ProductVariantStock.tsx
index 6119b518a2..e7fb113b1f 100644
--- a/saleor/static/dashboard-next/products/components/ProductVariantStock/ProductVariantStock.tsx
+++ b/saleor/static/dashboard-next/products/components/ProductVariantStock/ProductVariantStock.tsx
@@ -10,7 +10,7 @@ import i18n from "../../../i18n";
interface ProductVariantStockProps {
errors: { [key: string]: string };
sku?: string;
- stock?: number;
+ stock?: string;
stockAllocated?: number;
loading?: boolean;
onChange(event: any);
@@ -48,7 +48,7 @@ const ProductVariantStock = decorate<ProductVariantStockProps>(
helperText={
errors.stock
? errors.stock
- : loading
+ : loading || !stockAllocated
? ""
: `${i18n.t("Allocated:")} ${stockAllocated}`
}
diff --git a/saleor/static/dashboard-next/products/views/ProductVariantCreate.tsx b/saleor/static/dashboard-next/products/views/ProductVariantCreate.tsx
index 9175b6508c..718519d79f 100644
--- a/saleor/static/dashboard-next/products/views/ProductVariantCreate.tsx
+++ b/saleor/static/dashboard-next/products/views/ProductVariantCreate.tsx
@@ -27,7 +27,7 @@ interface FormData {
}>;
costPrice?: string;
priceOverride?: string;
- stock?: number;
+ stock?: string;
sku?: string;
}
@@ -44,7 +44,6 @@ export const ProductVariant: React.StatelessComponent<ProductUpdateProps> = ({
>
{({ data, error, loading: productLoading }) => {
if (error) {
- console.log(error);
return (
<ErrorMessageCard message={i18n.t("Something went wrong")} />
);
@@ -89,7 +88,7 @@ export const ProductVariant: React.StatelessComponent<ProductUpdateProps> = ({
costPrice: formData.costPrice,
priceOverride: formData.priceOverride,
product: productId,
- quantity: formData.stock,
+ quantity: parseInt(formData.stock, 10),
sku: formData.sku,
trackInventory: true
}