From f97319c47ad11c83fca4409c287ad79716fcd4e0 Mon Sep 17 00:00:00 2001 From: Krzysztof Bialoglowicz Date: Thu, 10 Oct 2019 14:48:19 +0200 Subject: [PATCH] Fix storybook --- src/icons/Webhooks.tsx | 4 +- .../__snapshots__/Stories.test.ts.snap | 4916 ++++++++--------- .../WebhooksCreatePage.stories.tsx | 25 + .../WebhooksDetailsPage.stories.tsx | 30 + .../WebhookListPage.stories.tsx | 30 + src/webhooks/fixtures.ts | 15 + 6 files changed, 2441 insertions(+), 2579 deletions(-) create mode 100644 src/webhooks/components/WebhookCreatePage/WebhooksCreatePage.stories.tsx create mode 100644 src/webhooks/components/WebhooksDetailsPage/WebhooksDetailsPage.stories.tsx create mode 100644 src/webhooks/components/WebhooksListPage/WebhookListPage.stories.tsx diff --git a/src/icons/Webhooks.tsx b/src/icons/Webhooks.tsx index eaa17aae7..051893abe 100644 --- a/src/icons/Webhooks.tsx +++ b/src/icons/Webhooks.tsx @@ -4,8 +4,8 @@ import React from "react"; export const Webhooks = createSvgIcon( <> diff --git a/src/storybook/__snapshots__/Stories.test.ts.snap b/src/storybook/__snapshots__/Stories.test.ts.snap index a53de1617..dc07dd54b 100644 --- a/src/storybook/__snapshots__/Stories.test.ts.snap +++ b/src/storybook/__snapshots__/Stories.test.ts.snap @@ -28233,6 +28233,44 @@ exports[`Storyshots Views / Configuration default 1`] = ` +
+
+
+ +
+
+

+ Webhooks +

+

+ View and update your site settings +

+
+
+
@@ -28711,6 +28749,44 @@ exports[`Storyshots Views / Configuration partial access 1`] = ` +
+
+
+ +
+
+

+ Webhooks +

+

+ View and update your site settings +

+
+
+
@@ -103653,7 +103729,7 @@ exports[`Storyshots Views / Services / Create service default 1`] = `
- Create New Account + Create Webhook
- Service Account Information + Webhook Information
+

+ General Information +

@@ -103698,7 +103779,7 @@ exports[`Storyshots Views / Services / Create service default 1`] = ` class="MuiFormLabel-root-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id" data-shrink="false" > - Account Name + Webhook Name
+
+
+
+
+
+

+ Webhook specific information +

+
+ +
+ +
+
+ + ​ + +
+ + +
+
+
+
+
+ +
+ +
+

+ This URL will recieve webhook POST requests +

+
+
+
+ +
+ + +
+

+ secret key is used to create a hash signature with each payload. *optional field +

-
+
- - Permissions -
-
-
-
-
-

- Expand or restrict user's permissions to access certain part of saleor system. -

-
- -
-
-
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
-
-
-
- - Account Status - -
-
-
-
-
-

- If you want to disable this account uncheck the box below -

- +
+
+
+
+
+

+ Expand or restrict webhooks permissions to register certain events in Saleor system. +

+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+ + Webhook Status + +
+
+
+
+
+

+ If you want to disable this webhook please uncheck the box below. +

+ +
@@ -104097,7 +104239,7 @@ exports[`Storyshots Views / Services / Create service form errors 1`] = `
- Create New Account + Create Webhook
- Service Account Information + Webhook Information
+

+ General Information +

@@ -104142,7 +104289,7 @@ exports[`Storyshots Views / Services / Create service form errors 1`] = ` class="MuiFormLabel-root-id MuiFormLabel-error-id MuiInputLabel-error-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id" data-shrink="false" > - Account Name + Webhook Name

+
+
+
+

+ Webhook specific information +

+
+ +
+ +
+
+ + ​ + +
+ + +
+
+
+
+
+ +
+ + +
+

+ This URL will recieve webhook POST requests +

+
+
+
+ +
+ + +
+

+ secret key is used to create a hash signature with each payload. *optional field +

+
-
+
- - Permissions -
-
-
-
-
-

- Expand or restrict user's permissions to access certain part of saleor system. -

-
- -
-
-
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
-
-
-
- - Account Status - -
-
-
-
-
-

- If you want to disable this account uncheck the box below -

- +
+
+
+
+
+

+ Expand or restrict webhooks permissions to register certain events in Saleor system. +

+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+ + Webhook Status + +
+
+
+
+
+

+ If you want to disable this webhook please uncheck the box below. +

+ +
@@ -104546,7 +104754,7 @@ exports[`Storyshots Views / Services / Create service loading 1`] = `
- Create New Account + Create Webhook
- Service Account Information + Webhook Information
+

+ General Information +

@@ -104591,7 +104804,7 @@ exports[`Storyshots Views / Services / Create service loading 1`] = ` class="MuiFormLabel-root-id MuiFormLabel-disabled-id MuiInputLabel-disabled-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id" data-shrink="false" > - Account Name + Webhook Name
+
+
+
+
+
+

+ Webhook specific information +

+
+ +
+ +
+
+ + ​ + +
+ + +
+
+
+
+
+ +
+ +
+

+ This URL will recieve webhook POST requests +

+
+
+
+ +
+ + +
+

+ secret key is used to create a hash signature with each payload. *optional field +

-
+
- - Permissions -
-
-
-
-
-

- Expand or restrict user's permissions to access certain part of saleor system. -

-
- -
-
-
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
-
-
-
- - Account Status - -
-
-
-
-
-

- If you want to disable this account uncheck the box below -

- +
+
+
+
+
+

+ Expand or restrict webhooks permissions to register certain events in Saleor system. +

+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+ + Webhook Status + +
+
+
+
+
+

+ If you want to disable this webhook please uncheck the box below. +

+ +
@@ -105021,7 +105289,7 @@ exports[`Storyshots Views / Services / Service details default 1`] = `
- Magento Importer + ... Details
- Service Account Information + Webhook Information
+

+ General Information +

​ @@ -105090,125 +105363,171 @@ exports[`Storyshots Views / Services / Service details default 1`] = ` class="MuiInputBase-input-id MuiOutlinedInput-input-id" name="name" type="text" - value="Magento Importer" + value="" />
-
-
-
-
-
- - Service Account Information -
+
+
+

- + + + ​ + + + +

+
+ + ​ + +
+ + +
+
+
+
+
+ +
+ + +
+

+ This URL will recieve webhook POST requests +

+
+
+
+ +
+ + +
+

+ secret key is used to create a hash signature with each payload. *optional field +

-
-
- - - - - - - - - - - - - - - -
- Token Note - - Key - - Actions -
- default - - **** AK05 - - -
@@ -105221,7 +105540,7 @@ exports[`Storyshots Views / Services / Service details default 1`] = ` - Permissions + Events
- Expand or restrict user's permissions to access certain part of saleor system. -

-
- -
-
-
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
-
-
-
- - Account Status - -
-
-
-
-
-

- If you want to disable this account uncheck the box below + Expand or restrict webhooks permissions to register certain events in Saleor system.

+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+ + Webhook Status + +
+
+
+
+
+

+ If you want to disable this webhook please uncheck the box below. +

+
@@ -106228,7 +106447,7 @@ exports[`Storyshots Views / Services / Service details form errors 1`] = `
- Magento Importer + ... Details
- Service Account Information + Webhook Information
+

+ General Information +

​ @@ -106297,130 +106521,176 @@ exports[`Storyshots Views / Services / Service details form errors 1`] = ` class="MuiInputBase-input-id MuiOutlinedInput-input-id" name="name" type="text" - value="Magento Importer" + value="" />

Generic form error

-
-
-
-
-
- - Service Account Information -
+
+
+

- + + + ​ + + + +

+
+ + ​ + +
+ + +
+
+
+
+
+ +
+ + +
+

+ This URL will recieve webhook POST requests +

+
+
+
+ +
+ + +
+

+ secret key is used to create a hash signature with each payload. *optional field +

-
-
- - - - - - - - - - - - - - - -
- Token Note - - Key - - Actions -
- default - - **** AK05 - - -
@@ -106433,7 +106703,7 @@ exports[`Storyshots Views / Services / Service details form errors 1`] = ` - Permissions + Events
- Expand or restrict user's permissions to access certain part of saleor system. -

-
- -
-
-
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
-
-
-
- - Account Status - -
-
-
-
-
-

- If you want to disable this account uncheck the box below + Expand or restrict webhooks permissions to register certain events in Saleor system.

+
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+ +
+
+
+
+
+
+ + Webhook Status + +
+
+
+
+
+

+ If you want to disable this webhook please uncheck the box below. +

+
@@ -106793,12 +106963,7 @@ exports[`Storyshots Views / Services / Service details loading 1`] = `
- - ‌ - + ... Details
- Service Account Information + Webhook Information
+

+ General Information +

@@ -106843,7 +107013,7 @@ exports[`Storyshots Views / Services / Service details loading 1`] = ` class="MuiFormLabel-root-id MuiFormLabel-disabled-id MuiInputLabel-disabled-id MuiInputLabel-root-id MuiInputLabel-formControl-id MuiInputLabel-animated-id MuiInputLabel-outlined-id" data-shrink="false" > - Account Name + Webhook Name
-
-
-
-
-
- - Service Account Information -
+
+
+

- + + + ​ + + + +

+
+ + ​ + +
+ + +
+
+
+
+
+ +
+ + +
+

+ This URL will recieve webhook POST requests +

+
+
+
+ +
+ + +
+

+ secret key is used to create a hash signature with each payload. *optional field +

-
-
- - - - - - - - - - - - - - - -
- Token Note - - Key - - Actions -
- - ‌ - - - - ‌ - - - -
@@ -107007,7 +107217,7 @@ exports[`Storyshots Views / Services / Service details loading 1`] = ` - Permissions + Events
- Expand or restrict user's permissions to access certain part of saleor system. + Expand or restrict webhooks permissions to register certain events in Saleor system.

-
- -
-
-
-
+ name="allEvents" + type="checkbox" + value="false" + /> + + + All events + + +
@@ -107099,7 +107301,7 @@ exports[`Storyshots Views / Services / Service details loading 1`] = ` @@ -107107,7 +107309,7 @@ exports[`Storyshots Views / Services / Service details loading 1`] = ` - Manage sales and vouchers + ORDER_CANCELLED
@@ -107124,7 +107326,7 @@ exports[`Storyshots Views / Services / Service details loading 1`] = ` @@ -107132,7 +107334,7 @@ exports[`Storyshots Views / Services / Service details loading 1`] = ` - Manage navigation + ORDER_CREATED
@@ -107149,7 +107351,7 @@ exports[`Storyshots Views / Services / Service details loading 1`] = ` @@ -107157,7 +107359,7 @@ exports[`Storyshots Views / Services / Service details loading 1`] = ` - Manage orders + ORDER_FULLY_PAID
@@ -107174,7 +107376,7 @@ exports[`Storyshots Views / Services / Service details loading 1`] = ` @@ -107182,7 +107384,7 @@ exports[`Storyshots Views / Services / Service details loading 1`] = ` - Manage pages + ORDER_UPDATED
@@ -107199,7 +107401,7 @@ exports[`Storyshots Views / Services / Service details loading 1`] = ` @@ -107207,114 +107409,14 @@ exports[`Storyshots Views / Services / Service details loading 1`] = ` - Manage products - - -
-
- -
-
- -
-
- -
-
-
- Account Status + Webhook Status
- If you want to disable this account uncheck the box below + If you want to disable this webhook please uncheck the box below.

@@ -107390,7 +107492,7 @@ exports[`Storyshots Views / Services / Service list default 1`] = `
- Service Accounts + Webhooks
- Create account + Create webhook
@@ -107415,102 +107517,8 @@ exports[`Storyshots Views / Services / Service list default 1`] = `
-
-
-
-
- - -
-
-
-
-
-
-
- - -
-
-
-
+ + - - -
Name + > + Service Account + + Action +
- - Slack - - - active - + Webhook Test + Test Account +
- - Facebook Market - - - active - + Webhook Test 2 - - -
- - Magento Importer - - - inactive - + Test Account 2 @@ -107914,102 +107847,8 @@ exports[`Storyshots Views / Services / Service list loading 1`] = `
-
-
-
-
- - -
-
-
-
-
-
-
- - -
-
-
-
+ +
Name + > + Service Account + + Action +
- - ‌ - + ‌ - + + ‌ + + @@ -108270,102 +108118,8 @@ exports[`Storyshots Views / Services / Service list no data 1`] = `
-
-
-
-
- - -
-
-
-
-
-
-
- - -
-
-
-
+ diff --git a/src/webhooks/components/WebhookCreatePage/WebhooksCreatePage.stories.tsx b/src/webhooks/components/WebhookCreatePage/WebhooksCreatePage.stories.tsx new file mode 100644 index 000000000..58349aa2f --- /dev/null +++ b/src/webhooks/components/WebhookCreatePage/WebhooksCreatePage.stories.tsx @@ -0,0 +1,25 @@ +import { storiesOf } from "@storybook/react"; +import React from "react"; + +import Decorator from "@saleor/storybook/Decorator"; +import { formError } from "@saleor/storybook/misc"; +import WebhookCreatePage, { WebhookCreatePageProps } from "./WebhookCreatePage"; + +const props: WebhookCreatePageProps = { + disabled: false, + errors: [], + onBack: () => undefined, + onSubmit: () => undefined, + saveButtonBarState: "default", + services: [] +}; +storiesOf("Views / Services / Create service", module) + .addDecorator(Decorator) + .add("default", () => ) + .add("loading", () => ) + .add("form errors", () => ( + formError(field))} + /> + )); diff --git a/src/webhooks/components/WebhooksDetailsPage/WebhooksDetailsPage.stories.tsx b/src/webhooks/components/WebhooksDetailsPage/WebhooksDetailsPage.stories.tsx new file mode 100644 index 000000000..dbb865240 --- /dev/null +++ b/src/webhooks/components/WebhooksDetailsPage/WebhooksDetailsPage.stories.tsx @@ -0,0 +1,30 @@ +import { storiesOf } from "@storybook/react"; +import React from "react"; + +import Decorator from "@saleor/storybook/Decorator"; +import { formError } from "@saleor/storybook/misc"; +import WebhooksDetailsPage, { + WebhooksDetailsPageProps +} from "./WebhooksDetailsPage"; + +const props: WebhooksDetailsPageProps = { + disabled: false, + errors: [], + onBack: () => undefined, + onDelete: () => undefined, + onSubmit: () => undefined, + saveButtonBarState: "default", + services: [] +}; +storiesOf("Views / Services / Service details", module) + .addDecorator(Decorator) + .add("default", () => ) + .add("loading", () => ( + + )) + .add("form errors", () => ( + formError(field))} + /> + )); diff --git a/src/webhooks/components/WebhooksListPage/WebhookListPage.stories.tsx b/src/webhooks/components/WebhooksListPage/WebhookListPage.stories.tsx new file mode 100644 index 000000000..93d9eb879 --- /dev/null +++ b/src/webhooks/components/WebhooksListPage/WebhookListPage.stories.tsx @@ -0,0 +1,30 @@ +import { storiesOf } from "@storybook/react"; +import React from "react"; + +import { + listActionsProps, + pageListProps, + searchPageProps, + tabPageProps +} from "@saleor/fixtures"; +import Decorator from "@saleor/storybook/Decorator"; +import { webhookList } from "../../fixtures"; +import WebhooksListPage, { WebhooksListPageProps } from "./WebhooksListPage"; + +const props: WebhooksListPageProps = { + ...listActionsProps, + ...pageListProps.default, + ...searchPageProps, + ...tabPageProps, + onBack: () => undefined, + onRemove: () => undefined, + webhooks: webhookList +}; + +storiesOf("Views / Services / Service list", module) + .addDecorator(Decorator) + .add("default", () => ) + .add("loading", () => ( + + )) + .add("no data", () => ); diff --git a/src/webhooks/fixtures.ts b/src/webhooks/fixtures.ts index 61df7f71b..c92090dd4 100644 --- a/src/webhooks/fixtures.ts +++ b/src/webhooks/fixtures.ts @@ -1,6 +1,21 @@ +import { ServiceList_serviceAccounts_edges_node } from "./types/ServiceList"; import { Webhook_webhook } from "./types/Webhook"; import { Webhooks_webhooks_edges_node } from "./types/Webhooks"; +export const services: ServiceList_serviceAccounts_edges_node[] = [ + { + __typename: "ServiceAccount", + id: "Jzx123sEt==", + isActive: true, + name: "Facebook" + }, + { + __typename: "ServiceAccount", + id: "Jzx123sEt==", + isActive: false, + name: "Twittwe" + } +]; export const webhookList: Webhooks_webhooks_edges_node[] = [ { __typename: "Webhook",
Name + > + Service Account + + Action +
- No service accounts found + No webhooks found