diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b9481f4e..e54f4c257 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,8 @@ 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 +- Improve product update form error handling - #392 by @dominik-zeglen +- Fix column picker errors - #393 by @dominik-zeglen - Improve order filters - #396 by @dominik-zeglen ## 2.0.0 diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 000000000..9ac570133 --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,15 @@ +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 ${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 diff --git a/README.md b/README.md index 06c4488ed..897ec3788 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,24 @@ Enter the project directory: $ cd saleor-dashboard ``` +#### Using stable release + +To use the official stable release, checkout to a release tag: + +``` +$ git checkout v2.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 +``` + Install NPM dependencies: ``` 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} /> ))} 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/__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`] = `
+ )) + .add("form errors", () => ( + ).map(formError)} + /> ));