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
feat: list history versions in the history page sidebar #19421
Conversation
Size Change: 0 B Total Size: 2.44 MB ℹ️ View Unchanged
|
packages/core/admin/admin/src/content-manager/history/components/VersionsList.tsx
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.
I think your approach to passing the locale is too strict, the CM shouldn't really ever be doing query.i18n.XXX
instead i would just pass all the plugin params because it's extensible without doing anything extra e.g. if someone extends the endpoints they have to somehow modify the FE to pass their plugins params which they can't do.
in short, I really don't believe we should be passing locale around because the CM shouldn't know about the concept of a locale.
@joshuaellis currently my history versions endpoint expects a |
I would do something similar in the CM already where we run a func called const buildValidParams = <TQuery extends Query>(query: TQuery): TransformedQuery<TQuery> => {
if (!query) return query;
// Extract pluginOptions from the query, they shouldn't be part of the URL
const { plugins: _, ...validQueryParams } = {
...query,
...Object.values(query?.plugins ?? {}).reduce<Record<string, string>>(
(acc, current) => Object.assign(acc, current),
{}
),
};
if ('_q' in validQueryParams) {
// Encode the search query here since the paramsSerializer will not
// @ts-expect-error – TODO: fix this type error
validQueryParams._q = encodeURIComponent(validQueryParams._q);
}
return validQueryParams;
}; it basically takes the query object that could have |
packages/core/admin/admin/src/content-manager/history/components/VersionsList.tsx
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/history/components/VersionsList.tsx
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.
Not QAd but the code looks good 💃🏼 I left a comment about the author which might make it more consistent with the rest of the product.
packages/core/admin/admin/src/content-manager/history/components/VersionsList.tsx
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/history/components/VersionsList.tsx
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/history/components/VersionsList.tsx
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/history/components/VersionsList.tsx
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/history/components/VersionsList.tsx
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/history/components/VersionsList.tsx
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/history/components/VersionDetails.tsx
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/history/components/VersionsList.tsx
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/history/components/VersionsList.tsx
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/history/components/VersionsList.tsx
Outdated
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/history/components/VersionDetails.tsx
Show resolved
Hide resolved
packages/core/admin/admin/src/content-manager/history/pages/History.tsx
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.
Looks good to me. Tested locally.
packages/core/admin/admin/src/content-manager/history/components/VersionsList.tsx
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.
Great work @remidej 👏🏼
What does it do?
Displays a list of history versions in the history page sidebar
How to test it?
For any entry, open the history page by clicking on the "history" button in the edit view.
(current)