Skip to content
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

Enable list header actions hook #3048

Merged
merged 9 commits into from
May 27, 2020

Conversation

MadeByMike
Copy link
Contributor

@gautamsi I had a little git slip and I had to revert and re-open this one. We're still looking at moving forward with it. Forgive me for the confusion.

@MadeByMike MadeByMike requested a review from gautamsi May 26, 2020 07:23
@changeset-bot
Copy link

changeset-bot bot commented May 26, 2020

🦋 Changeset is good to go

Latest commit: 1332df1

We got this.

This PR includes changesets to release 1 package
Name Type
@keystonejs/app-admin-ui Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

list: { access },
openCreateItemModal,
} = useList();
if (!access.create) return null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We re taking care of access control here instead of List->index

@@ -70,7 +68,7 @@ export function ListLayout(props) {
<HeaderInset>
<FlexGroup align="center" justify="space-between">
<PageTitle>{list.plural}</PageTitle>
{list.access.create ? listHeaderActions ? listHeaderActions() : <CreateItem /> : null}
{listHeaderActions ? listHeaderActions() : <CreateItem />}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not want to remove all the header items which dev may have created, list create access check is moved to <CreateItem/> which will not render itself if there is no access for create.

we can leave this to hook author to decide whether they need action for create access or not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call to move it to create item.

Copy link
Contributor Author

@MadeByMike MadeByMike left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge it :)

Copy link
Contributor

@timleslie timleslie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@MadeByMike MadeByMike merged commit 3262425 into keystonejs:master May 27, 2020
This was referenced May 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants