Fix (ui) :- Tag dropdown overflow issue and added localisation (#8173)

* Fix Tag dropdown overflow issue and added localisation

* added missing colon
This commit is contained in:
Ashish Gupta 2022-10-18 18:02:51 +05:30 committed by GitHub
parent 9cc90e42fc
commit c7f1c56c94
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 45 additions and 19 deletions

View File

@ -24,6 +24,7 @@ import React, {
useMemo, useMemo,
useState, useState,
} from 'react'; } from 'react';
import { useTranslation } from 'react-i18next';
import { Link, useHistory } from 'react-router-dom'; import { Link, useHistory } from 'react-router-dom';
import { FQN_SEPARATOR_CHAR } from '../../constants/char.constants'; import { FQN_SEPARATOR_CHAR } from '../../constants/char.constants';
import { getTableDetailsPath } from '../../constants/constants'; import { getTableDetailsPath } from '../../constants/constants';
@ -80,6 +81,7 @@ const EntityTable = ({
entityFieldTasks, entityFieldTasks,
}: EntityTableProps) => { }: EntityTableProps) => {
const history = useHistory(); const history = useHistory();
const { t } = useTranslation();
const [searchedColumns, setSearchedColumns] = useState<Column[]>([]); const [searchedColumns, setSearchedColumns] = useState<Column[]>([]);
@ -391,14 +393,14 @@ const EntityTable = ({
destroyTooltipOnHide destroyTooltipOnHide
content={ content={
hasDescription hasDescription
? 'Request update description' ? t('label.request-update-description')
: 'Request description' : t('label.request-description')
} }
overlayClassName="ant-popover-request-description" overlayClassName="ant-popover-request-description"
trigger="hover" trigger="hover"
zIndex={9999}> zIndex={9999}>
<SVGIcons <SVGIcons
alt="request-description" alt={t('label.request-description')}
icon={Icons.REQUEST} icon={Icons.REQUEST}
width="16px" width="16px"
/> />
@ -409,7 +411,9 @@ const EntityTable = ({
const getRequestTagsElement = (cell: Column) => { const getRequestTagsElement = (cell: Column) => {
const hasTags = !isEmpty(cell?.tags || []); const hasTags = !isEmpty(cell?.tags || []);
const text = hasTags ? 'Update request tags' : 'Request tags'; const text = hasTags
? t('label.update-request-tags')
: t('label.request-tags');
return ( return (
<button <button
@ -424,7 +428,11 @@ const EntityTable = ({
overlayClassName="ant-popover-request-description" overlayClassName="ant-popover-request-description"
trigger="hover" trigger="hover"
zIndex={9999}> zIndex={9999}>
<SVGIcons alt="request-tags" icon={Icons.REQUEST} width="16px" /> <SVGIcons
alt={t('label.request-tags')}
icon={Icons.REQUEST}
width="16px"
/>
</Popover> </Popover>
</button> </button>
); );
@ -489,7 +497,9 @@ const EntityTable = ({
{record?.description ? ( {record?.description ? (
<RichTextEditorPreviewer markdown={record?.description} /> <RichTextEditorPreviewer markdown={record?.description} />
) : ( ) : (
<span className="tw-no-description">No description</span> <span className="tw-no-description">
{t('label.no-description')}
</span>
)} )}
</div> </div>
<div className="tw-flex tw--mt-1.5"> <div className="tw-flex tw--mt-1.5">
@ -501,9 +511,9 @@ const EntityTable = ({
className="tw-self-start tw-w-7 tw-h-7 focus:tw-outline-none tw-flex-none hover-cell-icon" className="tw-self-start tw-w-7 tw-h-7 focus:tw-outline-none tw-flex-none hover-cell-icon"
onClick={() => handleUpdate(record, index)}> onClick={() => handleUpdate(record, index)}>
<SVGIcons <SVGIcons
alt="edit" alt={t('label.edit')}
icon="icon-edit" icon="icon-edit"
title="Edit" title={t('label.edit')}
width="16px" width="16px"
/> />
</button> </button>
@ -543,7 +553,7 @@ const EntityTable = ({
{checkIfJoinsAvailable(record?.name) && ( {checkIfJoinsAvailable(record?.name) && (
<div className="tw-mt-3" data-testid="frequently-joined-columns"> <div className="tw-mt-3" data-testid="frequently-joined-columns">
<span className="tw-text-grey-muted tw-mr-1"> <span className="tw-text-grey-muted tw-mr-1">
Frequently joined columns: {t('label.frequently-joined-columns')}:
</span> </span>
<span> <span>
{getFrequentlyJoinedWithColumns(record?.name) {getFrequentlyJoinedWithColumns(record?.name)
@ -640,6 +650,7 @@ const EntityTable = ({
} }
}}> }}>
<TagsContainer <TagsContainer
className="w-max-256"
editable={editColumnTag?.index === index} editable={editColumnTag?.index === index}
isLoading={isTagLoading && editColumnTag?.index === index} isLoading={isTagLoading && editColumnTag?.index === index}
selectedTags={record?.tags || []} selectedTags={record?.tags || []}
@ -724,7 +735,7 @@ const EntityTable = ({
const columns = useMemo( const columns = useMemo(
() => [ () => [
{ {
title: 'Name', title: t('label.name'),
dataIndex: 'name', dataIndex: 'name',
key: 'name', key: 'name',
accessor: 'name', accessor: 'name',
@ -734,7 +745,7 @@ const EntityTable = ({
renderCell(TABLE_HEADERS_V1.name, record, index), renderCell(TABLE_HEADERS_V1.name, record, index),
}, },
{ {
title: 'Type', title: t('label.type'),
dataIndex: 'dataTypeDisplay', dataIndex: 'dataTypeDisplay',
key: 'dataTypeDisplay', key: 'dataTypeDisplay',
accessor: 'dataTypeDisplay', accessor: 'dataTypeDisplay',
@ -745,7 +756,7 @@ const EntityTable = ({
}, },
}, },
{ {
title: 'Description', title: t('label.description'),
dataIndex: 'description', dataIndex: 'description',
key: 'description', key: 'description',
accessor: 'description', accessor: 'description',
@ -753,7 +764,7 @@ const EntityTable = ({
renderCell(TABLE_HEADERS_V1.description, record, index), renderCell(TABLE_HEADERS_V1.description, record, index),
}, },
{ {
title: 'Tags', title: t('label.tags'),
dataIndex: 'tags', dataIndex: 'tags',
key: 'tags', key: 'tags',
accessor: 'tags', accessor: 'tags',
@ -801,8 +812,8 @@ const EntityTable = ({
/> />
{editColumn && ( {editColumn && (
<ModalWithMarkdownEditor <ModalWithMarkdownEditor
header={`Edit column: "${editColumn.column.name}"`} header={`${t('label:edit-column')}: "${editColumn.column.name}"`}
placeholder="Enter Column Description" placeholder={t('label.enter-column-description')}
value={editColumn.column.description as string} value={editColumn.column.description as string}
onCancel={closeEditColumnModal} onCancel={closeEditColumnModal}
onSave={handleEditColumnChange} onSave={handleEditColumnChange}

View File

@ -59,7 +59,7 @@ const Tags: FunctionComponent<TagProps> = ({
); );
const tagName = showOnlyName const tagName = showOnlyName
? tag.split(FQN_SEPARATOR_CHAR).slice(-2).join(FQN_SEPARATOR_CHAR) ? tag.split(FQN_SEPARATOR_CHAR).slice(-2).join(FQN_SEPARATOR_CHAR)
: getTagDisplay(tag); : tag;
return ( return (
<span <span
@ -81,7 +81,7 @@ const Tags: FunctionComponent<TagProps> = ({
)} )}
data-testid={editable && isRemovable ? `tag-${tag}` : `add-tag`}> data-testid={editable && isRemovable ? `tag-${tag}` : `add-tag`}>
{startIcon} {startIcon}
<span>{tagName}</span> <span>{getTagDisplay(tagName)}</span>
</span> </span>
{editable && isRemovable && ( {editable && isRemovable && (
<span <span

View File

@ -29,7 +29,7 @@ export const SUCCESS_COLOR = '#008376';
export const SUPPORTED_FIELD_TYPES = ['string', 'markdown', 'integer']; export const SUPPORTED_FIELD_TYPES = ['string', 'markdown', 'integer'];
export const TAG_VIEW_CAP = 35; export const TAG_VIEW_CAP = 33;
export const FOLLOWERS_VIEW_CAP = 20; export const FOLLOWERS_VIEW_CAP = 20;
export const INITIAL_PAGING_VALUE = 1; export const INITIAL_PAGING_VALUE = 1;
export const JSON_TAB_SIZE = 2; export const JSON_TAB_SIZE = 2;

View File

@ -1,5 +1,8 @@
{ {
"label": { "label": {
"name": "Name",
"type": "Type",
"description": "Description",
"docs": "Docs", "docs": "Docs",
"api-uppercase": "API", "api-uppercase": "API",
"slack": "Slack", "slack": "Slack",
@ -9,6 +12,8 @@
"glossary": "Glossary", "glossary": "Glossary",
"tags": "Tags", "tags": "Tags",
"settings": "Settings", "settings": "Settings",
"edit": "Edit",
"edit-column": "Edit column",
"search-global": "Search for Tables, Topics, Dashboards, Pipelines and ML Models", "search-global": "Search for Tables, Topics, Dashboards, Pipelines and ML Models",
"om-description": "Centralized Metadata Store, Discover, Collaborate and get your Data Right", "om-description": "Centralized Metadata Store, Discover, Collaborate and get your Data Right",
"login": "Login", "login": "Login",
@ -28,7 +33,14 @@
"no-description": "No description", "no-description": "No description",
"data-type": "Data type", "data-type": "Data type",
"table-metrics-summary": "Table Metrics Summary", "table-metrics-summary": "Table Metrics Summary",
"table-tests-summary": "Table Tests Summary" "table-tests-summary": "Table Tests Summary",
"frequently-joined-columns": "Frequently joined columns",
"no-description": "No description",
"request-tags": "Request tags",
"update-request-tags": "Update request tags",
"request-description": "Request description",
"request-update-description": "Request update description",
"enter-column-description": "Enter Column Description"
}, },
"message": {}, "message": {},
"server": {}, "server": {},

View File

@ -99,6 +99,9 @@
.w-full { .w-full {
width: 100%; width: 100%;
} }
.w-max-256 {
max-width: 256px;
}
//Height //Height
.h-7 { .h-7 {