From 1ffd29e266cb2996c09c3e612089d9e17f5d67d7 Mon Sep 17 00:00:00 2001 From: Sachin Chaurasiya Date: Fri, 8 Jul 2022 21:05:53 +0530 Subject: [PATCH] Fix #5956 Long team names go out of the box (#5959) * Fix #5956 Long team names go out of the box * Fix unit test * Minor change * Fix roles page issue * Revert policy change * Fix Long name issue * Minor change * Fix unit test --- .../EntityDeleteModal/EntityDeleteModal.tsx | 4 ++-- .../components/TeamDetails/TeamDetails.tsx | 11 +++++----- .../TeamsAndUsers/TeamsAndUsers.component.tsx | 14 +++++++----- .../src/components/Users/Users.component.tsx | 13 ++++++++--- .../ui/src/components/app-bar/Appbar.tsx | 15 ++++++++----- .../common/DeleteWidget/DeleteWidgetBody.tsx | 13 ++++++----- .../pages/RolesPage/RolesPage.component.tsx | 22 ++++++++++--------- .../resources/ui/src/pages/tags/index.tsx | 13 ++++++++--- .../ui/src/pages/teams/AddUsersModal.tsx | 7 +++--- .../resources/ui/src/pages/teams/UserCard.tsx | 11 ++++++---- .../main/resources/ui/src/styles/tailwind.css | 6 ++++- 11 files changed, 81 insertions(+), 48 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Modals/EntityDeleteModal/EntityDeleteModal.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Modals/EntityDeleteModal/EntityDeleteModal.tsx index 0ea6ddeef68..a8b9e5a34cb 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Modals/EntityDeleteModal/EntityDeleteModal.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Modals/EntityDeleteModal/EntityDeleteModal.tsx @@ -60,7 +60,7 @@ const EntityDeleteModal: FC = ({
-

+

{softDelete ? ( Soft delete {entityName} @@ -73,7 +73,7 @@ const EntityDeleteModal: FC = ({

-

+

{bodyText || `Once you delete this ${getTitleCase( entityType diff --git a/openmetadata-ui/src/main/resources/ui/src/components/TeamDetails/TeamDetails.tsx b/openmetadata-ui/src/main/resources/ui/src/components/TeamDetails/TeamDetails.tsx index b232850434a..913b3dde3ff 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/TeamDetails/TeamDetails.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/TeamDetails/TeamDetails.tsx @@ -43,6 +43,7 @@ import { filterEntityAssets, getInfoElements } from '../../utils/EntityUtils'; import SVGIcons from '../../utils/SvgUtils'; import { Button } from '../buttons/Button/Button'; import Description from '../common/description/Description'; +import Ellipses from '../common/Ellipses/Ellipses'; import ErrorPlaceHolder from '../common/error-with-placeholder/ErrorPlaceHolder'; import NextPrevious from '../common/next-previous/NextPrevious'; import NonAdminAction from '../common/non-admin-action/NonAdminAction'; @@ -516,9 +517,7 @@ const TeamDetails = ({ const getTeamHeading = () => { return ( -

+
{isHeadingEditing ? (
) : ( -
- {heading} +
+ + {heading} + {isActionAllowed() && (
-

+ )}`} + data-testid="team-name"> + {team.displayName ?? team.name} -

+
{getCountBadge( getActiveUsers(team.users).length, diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Users/Users.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Users/Users.component.tsx index dd8c1fb4b24..38aed32a6a9 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Users/Users.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Users/Users.component.tsx @@ -57,6 +57,7 @@ import ActivityFeedList from '../ActivityFeed/ActivityFeedList/ActivityFeedList' import { filterListTasks } from '../ActivityFeed/ActivityFeedList/ActivityFeedList.util'; import { Button } from '../buttons/Button/Button'; import Description from '../common/description/Description'; +import Ellipses from '../common/Ellipses/Ellipses'; import ProfilePicture from '../common/ProfilePicture/ProfilePicture'; import { reactSingleSelectCustomStyle } from '../common/react-select-component/reactSelectCustomStyle'; import TabsPane from '../common/TabsPane/TabsPane'; @@ -326,7 +327,9 @@ const Users = ({ data-testid={team.name} key={i}> - {getEntityName(team)} + + {getEntityName(team)} +
))} {isEmpty(userData.teams) && ( @@ -456,7 +459,9 @@ const Users = ({ {userData.roles?.map((role, i) => (
- {getEntityName(role)} + + {getEntityName(role)} +
))} {!userData.isAdmin && isEmpty(userData.roles) && ( @@ -593,7 +598,9 @@ const Users = ({ className="tw-mb-2 tw-flex tw-items-center tw-gap-2" key={i}> - {getEntityName(inheritedRole)} + + {getEntityName(inheritedRole)} +
))}
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/app-bar/Appbar.tsx b/openmetadata-ui/src/main/resources/ui/src/components/app-bar/Appbar.tsx index 037ff222695..34bd0ca6396 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/app-bar/Appbar.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/app-bar/Appbar.tsx @@ -45,6 +45,7 @@ import { } from '../../utils/CommonUtils'; import SVGIcons, { Icons } from '../../utils/SvgUtils'; import { showErrorToast } from '../../utils/ToastUtils'; +import Ellipses from '../common/Ellipses/Ellipses'; import { COOKIE_VERSION } from '../Modals/WhatsNewModal/whatsNewData'; import NavBar from '../nav-bar/NavBar'; import { useWebSocketConnector } from '../web-scoket/web-scoket.provider'; @@ -151,9 +152,9 @@ const Appbar: React.FC = (): JSX.Element => {
{name}
{userRoleArr.map((userRole, i) => ( -

+ {userRole} -

+ ))}
@@ -199,10 +200,12 @@ const Appbar: React.FC = (): JSX.Element => { const teams = getNonDeletedTeams(currentUser?.teams ?? []); return ( -
+
{' '} - {name} + + {name} +
{roles.length > 0 ? getUsersRoles(roles, 'Roles') : null} @@ -213,11 +216,11 @@ const Appbar: React.FC = (): JSX.Element => {
Teams {teams.map((t, i) => ( -

+ {t.displayName || t.name} -

+ ))}
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/DeleteWidget/DeleteWidgetBody.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/DeleteWidget/DeleteWidgetBody.tsx index a8ba800bf31..cb1d7893025 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/DeleteWidget/DeleteWidgetBody.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/DeleteWidget/DeleteWidgetBody.tsx @@ -13,6 +13,7 @@ import React from 'react'; import { TITLE_FOR_NON_ADMIN_ACTION } from '../../../constants/constants'; +import Ellipses from '../Ellipses/Ellipses'; import NonAdminAction from '../non-admin-action/NonAdminAction'; type DeleteWidgetBodyProps = { @@ -35,13 +36,15 @@ const DeleteWidgetBody = ({ return (
-

+ {header} -

+

{description}

diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/RolesPage/RolesPage.component.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/RolesPage/RolesPage.component.tsx index 147f284ae65..ae89dea207d 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/RolesPage/RolesPage.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/RolesPage/RolesPage.component.tsx @@ -35,6 +35,7 @@ import { getTeams, patchTeamDetail } from '../../axiosAPIs/teamsAPI'; import { getUserCounts } from '../../axiosAPIs/userAPI'; import { Button } from '../../components/buttons/Button/Button'; import Description from '../../components/common/description/Description'; +import Ellipses from '../../components/common/Ellipses/Ellipses'; import ErrorPlaceHolder from '../../components/common/error-with-placeholder/ErrorPlaceHolder'; import NonAdminAction from '../../components/common/non-admin-action/NonAdminAction'; import PageContainerV1 from '../../components/containers/PageContainerV1'; @@ -605,11 +606,12 @@ const RolesPage = () => { data-testid="role-name-container" key={role.name} onClick={() => setCurrentRole(role)}> - + {role.displayName}{' '} - + {role.defaultRole ? getDefaultBadge() : null}
))} @@ -994,16 +996,16 @@ const RolesPage = () => { const getRolesComponent = () => { return ( -
+
- {currentRole?.displayName} + + {currentRole?.displayName} + {currentRole?.defaultRole ? getDefaultBadge('tw-ml-2') : null}
-
+
{!currentRole?.defaultRole ? ( { onClick={() => { fetchCurrentCategory(category.name); }}> -

- {category.displayName ?? category.name} -

+ + {getEntityName(category as unknown as EntityReference)} + {getCountBadge( currentCategory?.name === category.name diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/teams/AddUsersModal.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/teams/AddUsersModal.tsx index 32ff2b3acf1..8904e256518 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/teams/AddUsersModal.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/teams/AddUsersModal.tsx @@ -14,6 +14,7 @@ import { toLower } from 'lodash'; import React, { useState } from 'react'; import { Button } from '../../components/buttons/Button/Button'; +import Ellipses from '../../components/common/Ellipses/Ellipses'; import Searchbar from '../../components/common/searchbar/Searchbar'; import { EntityReference as UserTeams } from '../../generated/entity/teams/user'; import { getEntityName } from '../../utils/CommonUtils'; @@ -96,10 +97,10 @@ const AddUsersModal = ({
-
-

+

+ {header} -

+
{ onTitleClick?.(item.fqn); }}> - {item.displayName} + {item.displayName} {item.name && item.name !== item.displayName && ( - {isIconVisible ? item.name : capitalize(item.name)} + + {isIconVisible ? item.name : capitalize(item.name)} + )} diff --git a/openmetadata-ui/src/main/resources/ui/src/styles/tailwind.css b/openmetadata-ui/src/main/resources/ui/src/styles/tailwind.css index ef52d123bfa..3b7542b0131 100644 --- a/openmetadata-ui/src/main/resources/ui/src/styles/tailwind.css +++ b/openmetadata-ui/src/main/resources/ui/src/styles/tailwind.css @@ -496,7 +496,7 @@ /* New Feed Button style */ .tw-refreshButton { - @apply tw-w-full tw-rounded tw-text-info tw-w-full tw-py-1 tw-rounded tw-bg-feed-background tw-border tw-border-feed hover:tw-bg-feed-hover; + @apply tw-w-full tw-rounded tw-text-info tw-py-1 tw-bg-feed-background tw-border tw-border-feed hover:tw-bg-feed-hover; box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.1); transition: background-color 100ms linear; } @@ -510,4 +510,8 @@ top: 0.4rem; left: 1.3rem; } + + .tw-max-w-75 { + max-width: 75%; + } }