-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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(ui) Create page for managing home page posts #8707
feat(ui) Create page for managing home page posts #8707
Conversation
@@ -107,7 +107,31 @@ public static boolean canEditGroupMembers(@Nonnull String groupUrnStr, @Nonnull | |||
} | |||
|
|||
public static boolean canCreateGlobalAnnouncements(@Nonnull QueryContext context) { | |||
return isAuthorized(context, Optional.empty(), PoliciesConfig.CREATE_GLOBAL_ANNOUNCEMENTS_PRIVILEGE); | |||
final DisjunctivePrivilegeGroup orPrivilegeGroups = new DisjunctivePrivilegeGroup( | |||
ImmutableList.of( |
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.
nice!
@@ -74,19 +79,21 @@ export const PostLinkCard = ({ linkPost }: Props) => { | |||
const link = linkPost?.content?.link || ''; | |||
|
|||
return ( | |||
<CardContainer type="link" href={link}> | |||
<CardContainer type="link" href={link} target="_blank" rel="noopener noreferrer"> |
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.
thank you!! so much better than redirecting.
@@ -143,6 +147,11 @@ export const SettingsPage = () => { | |||
<TeamOutlined /> <ItemTitle>Ownership Types</ItemTitle> | |||
</Menu.Item> | |||
)} | |||
{showHomePagePosts && ( | |||
<Menu.Item key="posts"> |
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.
fire!
</SubFormItem> | ||
</> | ||
)} | ||
</Form> |
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 great. copy also improved!
thanks for adding the select with conditional fields
}) | ||
.catch((e) => { | ||
message.destroy(); | ||
message.error({ content: `Failed to create Post!: \n ${e.message || ''}`, duration: 3 }); |
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.
minor: i've been trying to remove places where we print the raw backend message, and replace with a console.error + An unknown error occurred for the end user
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.
(tiny)
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.
hear that
|
||
// Handle the Enter press | ||
useEnterKeyListener({ | ||
querySelectorToExecuteClick: '#createPostButton', |
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.
nice!!
<PageContainer> | ||
<PageHeaderContainer> | ||
<PageTitle level={3}>Home Page Posts</PageTitle> | ||
<Typography.Paragraph type="secondary">View and manage your DataHub Posts.</Typography.Paragraph> |
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.
Maybe add something about the posts appearing on the landing page.
"View and manage pinned posts that appear to all users on the landing page. "
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.
oh yeah so much better
export default function PostItemMenu({ title, urn, onDelete }: Props) { | ||
const [deletePostMutation] = useDeletePostMutation(); | ||
|
||
const deleteDomain = () => { |
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.
nit: deletePost
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.
nicee
title: 'Type', | ||
dataIndex: '', | ||
key: 'type', | ||
render: (record: PostEntry) => PostColumn(record.contentType), |
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.
reminder: we should make sure the copy shown aligns with what the user created (Announcement vs Link)
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.
definitely good call will update this
export const DESCRIPTION_FIELD_NAME = 'description'; | ||
export const LINK_FIELD_NAME = 'link'; | ||
export const LOCATION_FIELD_NAME = 'location'; | ||
export const TYPE_FIELD_NAME = 'switch'; |
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.
it's called "switch"? does type not work?
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.
it does lol it used to be called SWITCH_FIELD_NAME
but i changed it and forgot to update the value here (even though technically it doesn't matter cuz it's just a const that's used) - but updating!
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.
Overall looks great. Minor comments only.
e12d910
into
datahub-project:master
First off I want to give a HUGE shoutout to @PatrickfBraz for his work that went into this PR here. He did the vast majority of this in his PR here: #8292
His work is what enabled us to push this over the finish line otherwise who knows how long it would take before we got there. So thanks so much again!
This PR creates a new page in settings where users that have the platform privilege for managing home page posts can go to in order to create and delete home page posts of either text or link kind. Right now we don't allow editing since that resolver doesn't exist yet.
This also makes some styling updates to make posts look nicer.
Screenshots:
![image](https://private-user-images.githubusercontent.com/28656603/262791939-dff1795a-73b1-47ca-b225-38e08a790bff.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjI1OTI0NzksIm5iZiI6MTcyMjU5MjE3OSwicGF0aCI6Ii8yODY1NjYwMy8yNjI3OTE5MzktZGZmMTc5NWEtNzNiMS00N2NhLWIyMjUtMzhlMDhhNzkwYmZmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MDIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODAyVDA5NDkzOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWYzZTc1NDBiYWQ3NTU3MThiMGZlZjMzYzU2NDY4ODZkNmY4YmZmNzYyMmM5OGQ5Mzg3YWRmODU2ZDE1NWM3OGMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.kLgvfVdvIgjrmm4FaMzG1yBoQ-bs7cpbOt4pJAdGU-I)
Checklist