From 45cff7ee8a422d4506a6b4dd2d814f3f289ca0c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20G=C4=99bala?= Date: Wed, 22 Jan 2020 15:51:33 +0100 Subject: [PATCH 01/11] Update installation guide --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index 06c4488ed..13f58848d 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,25 @@ Clone the repository: $ git clone https://github.com/mirumee/saleor-dashboard.git ``` +#### Using stable release + +To use the official stable release, checkout to a release tag: + +``` +$ git checkout v.2.0.0 +``` + +See the list of all releases here: https://github.com/mirumee/saleor-dashboard/releases/ + +#### Using development version + +If you want to use the latest development version, checkout to the `master` branch: + +``` +$ git checkout master +``` + + Enter the project directory: ``` From 35d433f7ca54b550ca8f517935d01ea3d25c2d35 Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Fri, 31 Jan 2020 14:48:39 +0100 Subject: [PATCH 02/11] Improve form error handling --- .../VisibilityCard/VisibilityCard.tsx | 11 +++++++++- .../views/ProductUpdate/ProductUpdate.tsx | 14 +++++++++---- .../stories/products/ProductUpdatePage.tsx | 21 +++++++++++++++++++ 3 files changed, 41 insertions(+), 5 deletions(-) diff --git a/src/components/VisibilityCard/VisibilityCard.tsx b/src/components/VisibilityCard/VisibilityCard.tsx index 6bca5b70d..061d00a66 100644 --- a/src/components/VisibilityCard/VisibilityCard.tsx +++ b/src/components/VisibilityCard/VisibilityCard.tsx @@ -8,7 +8,9 @@ import { useIntl } from "react-intl"; import CardTitle from "@saleor/components/CardTitle"; import RadioSwitchField from "@saleor/components/RadioSwitchField"; +import { FormErrors } from "@saleor/types"; import { DateContext } from "../Date/DateContext"; +import FormSpacer from "../FormSpacer"; const useStyles = makeStyles( theme => ({ @@ -50,7 +52,7 @@ interface VisibilityCardProps { isPublished: boolean; publicationDate: string; }; - errors: { [key: string]: string }; + errors: FormErrors<"isPublished" | "publicationDate">; disabled?: boolean; hiddenMessage: string; onChange: (event: React.ChangeEvent) => void; @@ -99,6 +101,7 @@ export const VisibilityCard: React.FC = props => {

@@ -157,6 +160,12 @@ export const VisibilityCard: React.FC = props => { )} )} + {errors.isPublished && ( + <> + + {errors.isPublished} + + )}

{children}
diff --git a/src/products/views/ProductUpdate/ProductUpdate.tsx b/src/products/views/ProductUpdate/ProductUpdate.tsx index d1ca3dab0..cda0d29b6 100644 --- a/src/products/views/ProductUpdate/ProductUpdate.tsx +++ b/src/products/views/ProductUpdate/ProductUpdate.tsx @@ -206,10 +206,16 @@ export const ProductUpdate: React.FC = ({ id, params }) => { () => searchCollectionsOpts.data.search.edges, [] ).map(edge => edge.node); - const errors = maybe( - () => updateProduct.opts.data.productUpdate.errors, - [] - ); + const errors = [ + ...maybe( + () => updateProduct.opts.data.productUpdate.errors, + [] + ), + ...maybe( + () => updateSimpleProduct.opts.data.productUpdate.errors, + [] + ) + ]; return ( <> diff --git a/src/storybook/stories/products/ProductUpdatePage.tsx b/src/storybook/stories/products/ProductUpdatePage.tsx index 84c5b0952..a3c0b2d74 100644 --- a/src/storybook/stories/products/ProductUpdatePage.tsx +++ b/src/storybook/stories/products/ProductUpdatePage.tsx @@ -8,6 +8,8 @@ import ProductUpdatePage, { ProductUpdatePageProps } from "@saleor/products/components/ProductUpdatePage"; import { product as productFixture } from "@saleor/products/fixtures"; +import { ProductUpdatePageFormData } from "@saleor/products/utils/data"; +import { formError } from "@saleor/storybook/misc"; import Decorator from "../../Decorator"; const product = productFixture(placeholderImage); @@ -83,4 +85,23 @@ storiesOf("Views / Products / Product edit", module) attributes: [] }} /> + )) + .add("form errors", () => ( + ).map(formError)} + /> )); From 7f71269856b89f7dcfc74af38a97e6119f2c34df Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Fri, 31 Jan 2020 14:51:43 +0100 Subject: [PATCH 03/11] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8ebcf167..09e63e8b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ All notable, unreleased changes to this project will be documented in this file. - Fix variant stock input - #377 by @dominik-zeglen - Add filtering to views - #361 by @dominik-zeglen - Do not render password change if authenticating - #378 by @dominik-zeglen +- Improve product update form error handling - #392 by @dominik-zeglen ## 2.0.0 From d5cb6523fd815cba0398d4fe31c3c111df937fe9 Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Fri, 31 Jan 2020 15:01:26 +0100 Subject: [PATCH 04/11] Update snapshots --- .../__snapshots__/Stories.test.ts.snap | 1810 +++++++++++++++++ 1 file changed, 1810 insertions(+) diff --git a/src/storybook/__snapshots__/Stories.test.ts.snap b/src/storybook/__snapshots__/Stories.test.ts.snap index 2d8f82911..4490a2db0 100644 --- a/src/storybook/__snapshots__/Stories.test.ts.snap +++ b/src/storybook/__snapshots__/Stories.test.ts.snap @@ -78300,6 +78300,14 @@ Ctrl + K" > Set publication date +
+
+ Generic form error +
@@ -93637,6 +93645,1808 @@ exports[`Storyshots Views / Products / Create product variant with errors 1`] =
`; +exports[`Storyshots Views / Products / Product edit form errors 1`] = ` +
+
+
+
+
+ Ergonomic Plastic Bacon +
+
+
+
+
+
+
+
+
+ + General Informations + +
+
+
+
+
+
+ +
+ + +
+

+ Generic form error +

+
+
+
+
+
+ Description +
+
+ +
+
+
+
+
+
+ + + bold + + +
+
+
+
+ + + italic + + +
+
+
+
+ + + strikethrough + + +
+
+

+
+ + + h1 + + +
+

+

+
+ + + h2 + + +
+

+

+
+ + + h3 + + +
+

+
+
+ + + blockquote + + +
+
+
    +
  • +
    + + + ul + + +
    +
  • +
+
    +
  1. +
    + + + ol + + +
    +
  2. +
+
+
+ + + link + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + Images + +
+ + +
+
+
+
+
+
+
+ + +
+ Drop here to upload +
+
+
+
+
+
+
+
+
+ Id sit dolores adipisci +
+
+
+
+
+ Id sit dolores adipisci +
+
+
+
+
+ Id sit dolores adipisci +
+
+
+
+
+ Id sit dolores adipisci +
+
+
+
+
+ Id sit dolores adipisci +
+
+
+
+
+
+
+
+ + Attributes + +
+
+
+
+
+
+
+
+ 2 Attributes +
+
+ +
+
+
+
+
+ Borders +
+
+
+
+
+ + +
+
+
+
+
+
+
+
+ Legacy +
+
+
+
+
+ + +
+
+
+
+
+
+ Auto Loan Account +
+ +
+
+
+
+
+
+
+
+
+
+ + Pricing + +
+
+
+ +
+
+
+
+
+ +
+ +
+
+ NZD +
+
+ +
+
+
+
+
+
+
+
+ + Variants + +
+ +
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + Name + + Status + + SKU +
+
+
+
+
+
+ + Search Engine Preview + +
+ +
+
+
+
+
+
+ Add search engine title and description to make this product easier to find +
+
+
+
+
+
+
+ + Organize Product + +
+
+
+
+
+
+ Product Type +
+
+ Versatile +
+
+
+ Product Type +
+
+ Configurable +
+
+
+
+
+
+ + +

+ Generic form error +

+
+
+
+
+
+
+
+ + +

+ *Optional. Adding product to collection helps users find it. +

+
+
+
+
+
+
+ Winter sale +
+ +
+
+
+
+
+
+
+
+ + Visibility + +
+
+
+
+
+
+
+ + +
+
+
+
+ Generic form error +
+
+
+
+
+
+
+ +
+`; + exports[`Storyshots Views / Products / Product edit no product attributes 1`] = `
Date: Fri, 31 Jan 2020 16:20:14 +0100 Subject: [PATCH 05/11] Fix column picker errors --- src/components/ColumnPicker/ColumnPicker.tsx | 55 +++++++++---------- .../ColumnPicker/ColumnPickerContent.tsx | 2 + 2 files changed, 28 insertions(+), 29 deletions(-) diff --git a/src/components/ColumnPicker/ColumnPicker.tsx b/src/components/ColumnPicker/ColumnPicker.tsx index f2a1c9434..3dc2cf759 100644 --- a/src/components/ColumnPicker/ColumnPicker.tsx +++ b/src/components/ColumnPicker/ColumnPicker.tsx @@ -77,30 +77,27 @@ const ColumnPicker: React.FC = props => { }; return ( -
- setExpansionState(prevState => !prevState)} - /> - - {({ TransitionProps, placement }) => ( - - setExpansionState(false)} - mouseEvent="onClick" + setExpansionState(false)}> +
+ setExpansionState(prevState => !prevState)} + /> + + {({ TransitionProps, placement }) => ( + = props => { onReset={handleReset} onSave={handleSave} /> - - - )} - -
+
+ )} +
+
+ ); }; diff --git a/src/components/ColumnPicker/ColumnPickerContent.tsx b/src/components/ColumnPicker/ColumnPickerContent.tsx index 26eada3f1..971a57d3d 100644 --- a/src/components/ColumnPicker/ColumnPickerContent.tsx +++ b/src/components/ColumnPicker/ColumnPickerContent.tsx @@ -137,6 +137,7 @@ const ColumnPickerContent: React.FC = props => { name={column.value} label={column.label} onChange={() => onColumnToggle(column.value)} + key={column.value} /> ))} {loading && ( @@ -160,6 +161,7 @@ const ColumnPickerContent: React.FC = props => { name={column.value} label={column.label} onChange={() => onColumnToggle(column.value)} + key={column.value} /> ))}
From 749ea98b4a87ab095fce7e055760ae813f8503e9 Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Fri, 31 Jan 2020 16:22:41 +0100 Subject: [PATCH 06/11] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 441a948ba..3c9b8de5f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ All notable, unreleased changes to this project will be documented in this file. - Add filtering to views - #361 by @dominik-zeglen - Do not render password change if authenticating - #378 by @dominik-zeglen - Fix crash when one product is selected - #391 by @dominik-zeglen +- Fix column picker errors - #393 by @dominik-zeglen ## 2.0.0 From 9fe2a5c708a33f4b8ba008269f1179d8e5eb921a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20G=C4=99bala?= <5421321+maarcingebala@users.noreply.github.com> Date: Mon, 3 Feb 2020 12:51:02 +0100 Subject: [PATCH 07/11] Fix type in README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 13f58848d..ea868b063 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ $ git clone https://github.com/mirumee/saleor-dashboard.git To use the official stable release, checkout to a release tag: ``` -$ git checkout v.2.0.0 +$ git checkout v2.0.0 ``` See the list of all releases here: https://github.com/mirumee/saleor-dashboard/releases/ From 6cc4c48e2c0e568adbb99d5cefa43bf6fe7b509b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20G=C4=99bala?= <5421321+maarcingebala@users.noreply.github.com> Date: Mon, 3 Feb 2020 12:53:51 +0100 Subject: [PATCH 08/11] Update README.md --- README.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ea868b063..897ec3788 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,12 @@ Clone the repository: $ git clone https://github.com/mirumee/saleor-dashboard.git ``` +Enter the project directory: + +``` +$ cd saleor-dashboard +``` + #### Using stable release To use the official stable release, checkout to a release tag: @@ -47,13 +53,6 @@ If you want to use the latest development version, checkout to the `master` bran $ git checkout master ``` - -Enter the project directory: - -``` -$ cd saleor-dashboard -``` - Install NPM dependencies: ``` From 759be70ede649937368e1a835867224e5c04a8a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Szyma=C5=84ski?= Date: Thu, 6 Feb 2020 10:30:58 +0100 Subject: [PATCH 09/11] Add dockerfile for development purposes --- Dockerfile.dev | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 Dockerfile.dev diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 000000000..0e38180d1 --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,16 @@ +FROM node:10 + +WORKDIR /app +COPY package*.json ./ +RUN npm install +COPY . . +ARG APP_MOUNT_URI +ARG API_URI +ARG STATIC_URL +ENV API_URI http://localhost:8000/graphql/ +ENV APP_MOUNT_URI /dashboard/ +ENV STATIC_URL /dashboard/ +VOLUME /app + +EXPOSE 9000 +CMD npm start -- --host 0.0.0.0 From 981901af39e6f442878c74f68c64ebb42c619202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Szyma=C5=84ski?= Date: Fri, 7 Feb 2020 10:03:26 +0100 Subject: [PATCH 10/11] Remove volume from dev dockerfile --- Dockerfile.dev | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile.dev b/Dockerfile.dev index 0e38180d1..13567f16c 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -10,7 +10,6 @@ ARG STATIC_URL ENV API_URI http://localhost:8000/graphql/ ENV APP_MOUNT_URI /dashboard/ ENV STATIC_URL /dashboard/ -VOLUME /app EXPOSE 9000 CMD npm start -- --host 0.0.0.0 From 88e0df817a49439f7c95db45576e09a0cd3a3b70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Szyma=C5=84ski?= Date: Fri, 7 Feb 2020 10:44:20 +0100 Subject: [PATCH 11/11] Better env vars handling --- Dockerfile.dev | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Dockerfile.dev b/Dockerfile.dev index 13567f16c..9ac570133 100644 --- a/Dockerfile.dev +++ b/Dockerfile.dev @@ -7,9 +7,9 @@ COPY . . ARG APP_MOUNT_URI ARG API_URI ARG STATIC_URL -ENV API_URI http://localhost:8000/graphql/ -ENV APP_MOUNT_URI /dashboard/ -ENV STATIC_URL /dashboard/ +ENV API_URI ${API_URI:-http://localhost:8000/graphql/} +ENV APP_MOUNT_URI ${APP_MOUNT_URI:-/dashboard/} +ENV STATIC_URL ${STATIC_URL:-/dashboard/} EXPOSE 9000 CMD npm start -- --host 0.0.0.0