-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Webhooks] Refactor Edit view #16800
Conversation
feat(webhooks/EditView): remove the reducer feat(webhooks/EditView): disable save button until form is modified
Size Change: +129 B (0%) Total Size: 1.5 MB
ℹ️ View Unchanged
|
return acc; | ||
}, {}); | ||
|
||
const StyledTable = styled.table` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need a custom table here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think we should be using the Table or RawTable from the DS?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it is possible - yes definitely. In case something is missing we could check if we can add it to the DS. I'd say in the CMS consistency wins in a case like this.
There is also a Table component in the helper-plugin that already has even more defaults.
...s/core/admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/Events/index.js
Outdated
Show resolved
Hide resolved
...s/core/admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/Events/index.js
Outdated
Show resolved
Hide resolved
...s/core/admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/Events/index.js
Outdated
Show resolved
Hide resolved
...s/core/admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/Events/index.js
Outdated
Show resolved
Hide resolved
.../admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/HeadersInput/index.js
Outdated
Show resolved
Hide resolved
...e/admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/WebhookForm/index.js
Show resolved
Hide resolved
...e/admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/WebhookForm/index.js
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/index.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shaping up really nicely, left some thoughts in line 👍🏼
...s/core/admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/Events/index.js
Outdated
Show resolved
Hide resolved
...s/core/admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/Events/index.js
Outdated
Show resolved
Hide resolved
...s/core/admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/Events/index.js
Outdated
Show resolved
Hide resolved
...s/core/admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/Events/index.js
Show resolved
Hide resolved
...s/core/admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/Events/index.js
Outdated
Show resolved
Hide resolved
...min/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/HeadersInput/Combobox.js
Outdated
Show resolved
Hide resolved
.../admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/HeadersInput/index.js
Outdated
Show resolved
Hide resolved
.../admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/WebhookForm/Layout/index.js
Outdated
Show resolved
Hide resolved
...admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/WebhookForm/Layout/Layout.js
Outdated
Show resolved
Hide resolved
...e/admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/WebhookForm/index.js
Show resolved
Hide resolved
packages/core/admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/index.js
Outdated
Show resolved
Hide resolved
packages/core/content-type-builder/admin/src/components/FormModal/forms/index.js
Outdated
Show resolved
Hide resolved
...s/core/admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/Events/index.js
Show resolved
Hide resolved
...s/core/admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/Events/index.js
Outdated
Show resolved
Hide resolved
...s/core/admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/Events/index.js
Outdated
Show resolved
Hide resolved
...s/core/admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/Events/index.js
Outdated
Show resolved
Hide resolved
...s/core/admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/Events/index.js
Outdated
Show resolved
Hide resolved
...s/core/admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/Events/index.js
Outdated
Show resolved
Hide resolved
...in/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/HeadersInput/constants.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some QA feedback:
-
I'm not able to remove the last header. Is this on purpose? If so, IMO we should disable / hide (to check with Maeva) remove button. cc @maevalienard
-
Adding multiple headers: (This was caused by potentially duplicate keys for the header inputs)
- Click "Add new header" 3 times, but don't fill in values
- Click to the second to the last combobox and select a header
- Now 4 headers have been added and the combobox did not close
- Review workflow "stage change" events throw a validation error
...s/core/admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/Events/index.js
Outdated
Show resolved
Hide resolved
.../admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/HeadersInput/index.js
Outdated
Show resolved
Hide resolved
.../admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/HeadersInput/index.js
Outdated
Show resolved
Hide resolved
...e/admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/WebhookForm/index.js
Outdated
Show resolved
Hide resolved
...e/admin/admin/src/pages/SettingsPage/pages/Webhooks/EditView/components/WebhookForm/index.js
Outdated
Show resolved
Hide resolved
...in/src/pages/SettingsPage/pages/Webhooks/EditView/components/WebhookForm/tests/index.test.js
Outdated
Show resolved
Hide resolved
...in/src/pages/SettingsPage/pages/Webhooks/EditView/components/WebhookForm/tests/index.test.js
Outdated
Show resolved
Hide resolved
jest.mock('../../../../../../../../hooks', () => ({ | ||
useThemeToggle: jest.fn(() => ({ currentTheme: 'light', themes: { light: lightTheme } })), | ||
})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe you can also get rid of this, if you wrap the test below into ThemeProvider
instead of ThemeToggleProvider
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you still need the mock now that ThemeToggleProvider
is gone?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More QA:
- When I change something in the edit-view, go to the list view and immediately back to the webook edit view the changes are not displayed; have to reload the page to see them.
Other than that I couldn't really find anything. I'm gonna use the opportunity to say: great work! I think this looks much better than before and it's great to see how easy it will become to extend the view. The pattern can probably be improved a bit further, but it's a great first step!
jest.mock('../../../../../../../../hooks', () => ({ | ||
useThemeToggle: jest.fn(() => ({ currentTheme: 'light', themes: { light: lightTheme } })), | ||
})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you still need the mock now that ThemeToggleProvider
is gone?
const getStoredPrivateAttributes = (model) => | ||
union( | ||
strapi?.config?.get('api.responses.privateAttributes', []) ?? [], | ||
getOr([], 'options.privateAttributes', model) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what happened here? Eslint?
return ( | ||
<> | ||
<EventTable.Headers isDraftAndPublish={isDraftAndPublish} /> | ||
<EventTable.Body isDraftAndPublish={isDraftAndPublish} extraEvents={events} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can improve this further (maybe discuss it with Josh next week), but I think to get this merged it is ok for now.
renderChildren={({ isDraftAndPublish }) => ( | ||
<> | ||
<EventTable.Headers isDraftAndPublish={isDraftAndPublish} /> | ||
<EventTable.Body isDraftAndPublish={isDraftAndPublish} /> | ||
</> | ||
)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This API is a bit odd for me imo, firstly, it'd be good to understand why we've opted for a render children pattern as opposed to using Context
? Secondly, is there a reason children couldn't just be used as a function?
<EventTable.Root>
{(props) => <Children {...props} />}
</EventTable.Root>
What does it do?
Refactor the web-hooks settings page edit view
Why is it needed?
To maintain the components and enable review workflow webhook events
BE review workflows webhooks implementation must be merged first