mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-07-03 23:26:54 +00:00
Minor(ui): Close profile dropdown on redirection to user profile page (#21733)
* close dropdown on redirection * address comment
This commit is contained in:
parent
b72dff93b8
commit
e2abddd0ac
@ -505,4 +505,24 @@ test.describe('User Profile Feed Interactions', () => {
|
|||||||
adminPage.locator('[data-testid="user-display-name"]')
|
adminPage.locator('[data-testid="user-display-name"]')
|
||||||
).toHaveText(fullyQualifiedName);
|
).toHaveText(fullyQualifiedName);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Close the profile dropdown after redirecting to user profile page', async ({
|
||||||
|
adminPage,
|
||||||
|
}) => {
|
||||||
|
await redirectToHomePage(adminPage);
|
||||||
|
await adminPage.locator('[data-testid="dropdown-profile"] svg').click();
|
||||||
|
await adminPage.waitForSelector('[role="menu"].profile-dropdown', {
|
||||||
|
state: 'visible',
|
||||||
|
});
|
||||||
|
const userResponse = adminPage.waitForResponse(
|
||||||
|
'/api/v1/users/name/*?fields=*&include=all'
|
||||||
|
);
|
||||||
|
await adminPage.getByTestId('user-name').click();
|
||||||
|
await userResponse;
|
||||||
|
await adminPage.waitForLoadState('networkidle');
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
adminPage.locator('.user-profile-dropdown-overlay')
|
||||||
|
).not.toBeVisible();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -116,6 +116,7 @@ export const UserProfileIcon = () => {
|
|||||||
currentUser?.profile?.images
|
currentUser?.profile?.images
|
||||||
);
|
);
|
||||||
const [showAllPersona, setShowAllPersona] = useState<boolean>(false);
|
const [showAllPersona, setShowAllPersona] = useState<boolean>(false);
|
||||||
|
const [isDropdownOpen, setIsDropdownOpen] = useState<boolean>(false);
|
||||||
|
|
||||||
const handleOnImageError = useCallback(() => {
|
const handleOnImageError = useCallback(() => {
|
||||||
setIsImgUrlValid(false);
|
setIsImgUrlValid(false);
|
||||||
@ -207,6 +208,10 @@ export const UserProfileIcon = () => {
|
|||||||
[currentUser]
|
[currentUser]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const handleCloseDropdown = useCallback(() => {
|
||||||
|
setIsDropdownOpen(false);
|
||||||
|
}, []);
|
||||||
|
|
||||||
const items: ItemType[] = useMemo(
|
const items: ItemType[] = useMemo(
|
||||||
() => [
|
() => [
|
||||||
{
|
{
|
||||||
@ -215,7 +220,8 @@ export const UserProfileIcon = () => {
|
|||||||
label: (
|
label: (
|
||||||
<Link
|
<Link
|
||||||
data-testid="user-name"
|
data-testid="user-name"
|
||||||
to={getUserPath(currentUser?.name as string)}>
|
to={getUserPath(currentUser?.name as string)}
|
||||||
|
onClick={handleCloseDropdown}>
|
||||||
<Typography.Paragraph
|
<Typography.Paragraph
|
||||||
className="ant-typography-ellipsis-custom font-medium cursor-pointer text-link-color m-b-0"
|
className="ant-typography-ellipsis-custom font-medium cursor-pointer text-link-color m-b-0"
|
||||||
ellipsis={{ rows: 1, tooltip: true }}>
|
ellipsis={{ rows: 1, tooltip: true }}>
|
||||||
@ -354,7 +360,10 @@ export const UserProfileIcon = () => {
|
|||||||
defaultOpenKeys: ['personas', 'roles', 'inheritedRoles', 'teams'],
|
defaultOpenKeys: ['personas', 'roles', 'inheritedRoles', 'teams'],
|
||||||
rootClassName: 'profile-dropdown w-68 p-x-md p-y-sm',
|
rootClassName: 'profile-dropdown w-68 p-x-md p-y-sm',
|
||||||
}}
|
}}
|
||||||
trigger={['click']}>
|
open={isDropdownOpen}
|
||||||
|
overlayClassName="user-profile-dropdown-overlay"
|
||||||
|
trigger={['click']}
|
||||||
|
onOpenChange={setIsDropdownOpen}>
|
||||||
<Button
|
<Button
|
||||||
className="user-profile-btn flex-center"
|
className="user-profile-btn flex-center"
|
||||||
data-testid="dropdown-profile"
|
data-testid="dropdown-profile"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user