From 6c92d2f9ecdb3a4b718e5dadef3587c34eca122f Mon Sep 17 00:00:00 2001 From: darth-coder00 <86726556+darth-coder00@users.noreply.github.com> Date: Thu, 3 Feb 2022 00:36:11 +0530 Subject: [PATCH] Fix: #2067 No character display limit for column description (#2579) --- .../ui/src/assets/svg/icon-chevron-down.svg | 3 ++ .../AddServiceModal/AddServiceModal.tsx | 7 ++- .../Modals/WhatsNewModal/ChangeLogs.tsx | 5 +- .../Modals/WhatsNewModal/FeaturesCarousel.tsx | 5 +- .../CardListItem/CardWithListItems.tsx | 5 +- .../common/description/Description.tsx | 16 +++++-- .../common/editor/MarkdownWithPreview.tsx | 7 ++- .../RichTextEditorPreviewer.tsx | 48 ++++++++++++++++++- .../table-data-card/TableDataCardBody.tsx | 5 +- .../pages/RolesPage/RolesPage.component.tsx | 1 + .../resources/ui/src/pages/services/index.tsx | 1 + .../main/resources/ui/src/styles/tailwind.css | 4 ++ .../main/resources/ui/src/styles/x-master.css | 35 ++++++++++++++ .../main/resources/ui/src/utils/SvgUtils.tsx | 6 +++ 14 files changed, 136 insertions(+), 12 deletions(-) create mode 100644 openmetadata-ui/src/main/resources/ui/src/assets/svg/icon-chevron-down.svg diff --git a/openmetadata-ui/src/main/resources/ui/src/assets/svg/icon-chevron-down.svg b/openmetadata-ui/src/main/resources/ui/src/assets/svg/icon-chevron-down.svg new file mode 100644 index 00000000000..883bc7bc054 --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/src/assets/svg/icon-chevron-down.svg @@ -0,0 +1,3 @@ + + + diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Modals/AddServiceModal/AddServiceModal.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Modals/AddServiceModal/AddServiceModal.tsx index 1e75c8ad661..a4b740b1227 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Modals/AddServiceModal/AddServiceModal.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Modals/AddServiceModal/AddServiceModal.tsx @@ -1522,7 +1522,12 @@ export const AddServiceModal: FunctionComponent = ({ if (description) { serviceDetailsData.push({ key: 'Description', - value: , + value: ( + + ), }); } diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Modals/WhatsNewModal/ChangeLogs.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Modals/WhatsNewModal/ChangeLogs.tsx index 9c4c777f52c..b4732f45b28 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Modals/WhatsNewModal/ChangeLogs.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Modals/WhatsNewModal/ChangeLogs.tsx @@ -30,7 +30,10 @@ const ChangeLogs = ({ data }: Props) => {

{log}

- + ))} diff --git a/openmetadata-ui/src/main/resources/ui/src/components/Modals/WhatsNewModal/FeaturesCarousel.tsx b/openmetadata-ui/src/main/resources/ui/src/components/Modals/WhatsNewModal/FeaturesCarousel.tsx index 348408f5bbb..1cf83a3e9b7 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/Modals/WhatsNewModal/FeaturesCarousel.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/Modals/WhatsNewModal/FeaturesCarousel.tsx @@ -67,7 +67,10 @@ const FeaturesCarousel = ({ data }: Props) => {

{d.title}

- +
{d.path ? ( diff --git a/openmetadata-ui/src/main/resources/ui/src/components/card-list/CardListItem/CardWithListItems.tsx b/openmetadata-ui/src/main/resources/ui/src/components/card-list/CardListItem/CardWithListItems.tsx index fdf043b7a27..7e078c35dd6 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/card-list/CardListItem/CardWithListItems.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/card-list/CardListItem/CardWithListItems.tsx @@ -50,7 +50,10 @@ const CardListItem: FunctionComponent = ({ cardStyle.body.base, isActive ? cardStyle.body.active : cardStyle.body.default )}> - +
); diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/description/Description.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/description/Description.tsx index 918f41de1fd..2f07b6fff12 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/description/Description.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/description/Description.tsx @@ -26,7 +26,7 @@ type Props = { owner?: Table['owner']; hasEditAccess?: boolean; blurWithBodyBG?: boolean; - removeBlurOnScroll?: boolean; + removeBlur?: boolean; description: string; isEdit?: boolean; onDescriptionEdit?: () => void; @@ -46,29 +46,35 @@ const Description = ({ onDescriptionUpdate, isReadOnly = false, blurWithBodyBG = false, - removeBlurOnScroll = false, + removeBlur = false, entityName, }: Props) => { return (
- {!removeBlurOnScroll && description.length > 800 && ( + {/* {!removeBlur && description.length > 800 && (
- )} + )} */}
{description?.trim() ? ( ) : ( diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/editor/MarkdownWithPreview.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/editor/MarkdownWithPreview.tsx index a79d6060365..10c5da4bda9 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/editor/MarkdownWithPreview.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/editor/MarkdownWithPreview.tsx @@ -56,7 +56,12 @@ const MarkdownWithPreview = forwardRef( return 'Nothing to preview'; } - return ; + return ( + + ); }; useImperativeHandle(ref, () => ({ diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/rich-text-editor/RichTextEditorPreviewer.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/rich-text-editor/RichTextEditorPreviewer.tsx index 56278f26270..c32fc0da95d 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/rich-text-editor/RichTextEditorPreviewer.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/rich-text-editor/RichTextEditorPreviewer.tsx @@ -18,21 +18,43 @@ import { Link } from 'react-router-dom'; import rehypeRaw from 'rehype-raw'; import gfm from 'remark-gfm'; import { isValidUrl } from '../../../utils/CommonUtils'; +import SVGIcons, { Icons } from '../../../utils/SvgUtils'; + +const MAX_LENGTH = 300; /*eslint-disable */ const RichTextEditorPreviewer = ({ markdown, className = '', + blurClasses = 'see-more-blur', + maxHtClass = 'tw-h-24', + maxLen = MAX_LENGTH, + enableSeeMoreVariant = true, }: { markdown: string; className?: string; + blurClasses?: string; + maxHtClass?: string; + maxLen?: number; + enableSeeMoreVariant?: boolean; }) => { const [content, setContent] = useState(''); + const [displayMoreText, setDisplayMoreText] = useState(false); useEffect(() => { setContent(markdown); }, [markdown]); return ( -
+
maxLen && !displayMoreText + ? `${maxHtClass} tw-overflow-hidden` + : null, + { + 'tw-mb-5': displayMoreText, + } + )}> + {enableSeeMoreVariant && markdown.length > MAX_LENGTH && ( +
+

setDisplayMoreText((pre) => !pre)}> + + + +

+
+ )}
); }; diff --git a/openmetadata-ui/src/main/resources/ui/src/components/common/table-data-card/TableDataCardBody.tsx b/openmetadata-ui/src/main/resources/ui/src/components/common/table-data-card/TableDataCardBody.tsx index 1818c17dd8b..8079c356afb 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/common/table-data-card/TableDataCardBody.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/common/table-data-card/TableDataCardBody.tsx @@ -62,7 +62,10 @@ const TableDataCardBody: FunctionComponent = ({
{description.trim() ? ( - + ) : ( No description added )} 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 b8c33d54405..a97ff7be3d7 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 @@ -557,6 +557,7 @@ const RolesPage = () => { className="tw-mb-3 tw--ml-5" data-testid="description-container"> { data-testid="service-description"> {service.description ? ( ) : ( 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 7e72ec469a5..a5036c6efbb 100644 --- a/openmetadata-ui/src/main/resources/ui/src/styles/tailwind.css +++ b/openmetadata-ui/src/main/resources/ui/src/styles/tailwind.css @@ -333,6 +333,10 @@ animation: highlight 3000ms ease-out; } + .rotate-inverse { + transform: rotate(180deg); + } + @keyframes highlight { 0% { @apply tw-bg-warning-lite; diff --git a/openmetadata-ui/src/main/resources/ui/src/styles/x-master.css b/openmetadata-ui/src/main/resources/ui/src/styles/x-master.css index 8049dcf4c9e..b886912e918 100644 --- a/openmetadata-ui/src/main/resources/ui/src/styles/x-master.css +++ b/openmetadata-ui/src/main/resources/ui/src/styles/x-master.css @@ -844,3 +844,38 @@ body .profiler-graph .recharts-active-dot circle { ); pointer-events: none; /* so the text is still selectable */ } + +.see-more-blur-white { + background: linear-gradient( + to top, + rgba(255, 255, 255, 1) 10%, + rgba(255, 255, 255, 0) 36% + ); + pointer-events: none; /* so the text is still selectable */ +} + +.see-more-blur-body { + background: linear-gradient( + to top, + rgba(248, 249, 250, 1) 10%, + rgba(255, 255, 255, 0) 36% + ); + pointer-events: none; /* so the text is still selectable */ +} + +.see-more-blur { + background: linear-gradient( + to top, + rgba(255, 255, 255, 1) 20%, + rgba(255, 255, 255, 0) 42% + ); + pointer-events: none; /* so the text is still selectable */ +} +.tableBody-row:hover .see-more-blur { + background: linear-gradient( + to top, + rgba(245, 246, 248, 1) 20%, + rgba(255, 255, 255, 0) 42% + ); + pointer-events: none; /* so the text is still selectable */ +} diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/SvgUtils.tsx b/openmetadata-ui/src/main/resources/ui/src/utils/SvgUtils.tsx index bc0e41c19a0..f1ad94f6e05 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/SvgUtils.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/utils/SvgUtils.tsx @@ -76,6 +76,7 @@ import IconTrends from '../assets/svg/ic-trends.svg'; import IconUpArrow from '../assets/svg/ic-up-arrow.svg'; import IconVEllipsis from '../assets/svg/ic-v-ellipsis.svg'; import IconWorkflows from '../assets/svg/ic-workflows.svg'; +import IconChevronDown from '../assets/svg/icon-chevron-down.svg'; import IconKey from '../assets/svg/icon-key.svg'; import IconNotNull from '../assets/svg/icon-notnull.svg'; import IconTour from '../assets/svg/icon-tour.svg'; @@ -229,6 +230,7 @@ export const Icons = { ARROW_DOWN_PRIMARY: 'icon-arrow-down-primary', ANNOUNCEMENT: 'icon-announcement', ANNOUNCEMENT_WHITE: 'icon-announcement-white', + CHEVRON_DOWN: 'icon-chevron-down', }; const SVGIcons: FunctionComponent = ({ @@ -660,6 +662,10 @@ const SVGIcons: FunctionComponent = ({ case Icons.ANNOUNCEMENT_WHITE: IconComponent = IconAnnouncementWhite; + break; + case Icons.CHEVRON_DOWN: + IconComponent = IconChevronDown; + break; default: