mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-28 10:56:02 +00:00
parent
05dfd4ddfd
commit
14b204ff83
@ -16,7 +16,7 @@ import ButtonGroup from 'antd/lib/button/button-group';
|
|||||||
import { ColumnsType } from 'antd/lib/table';
|
import { ColumnsType } from 'antd/lib/table';
|
||||||
import { AxiosError } from 'axios';
|
import { AxiosError } from 'axios';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { capitalize, isUndefined, toString } from 'lodash';
|
import { capitalize, isEmpty, isUndefined, toString } from 'lodash';
|
||||||
import React, {
|
import React, {
|
||||||
forwardRef,
|
forwardRef,
|
||||||
useCallback,
|
useCallback,
|
||||||
@ -93,7 +93,6 @@ const ClassificationDetails = forwardRef(
|
|||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const [tags, setTags] = useState<Tag[]>([]);
|
const [tags, setTags] = useState<Tag[]>([]);
|
||||||
const [isTagsLoading, setIsTagsLoading] = useState(false);
|
const [isTagsLoading, setIsTagsLoading] = useState(false);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
currentPage,
|
currentPage,
|
||||||
paging,
|
paging,
|
||||||
@ -478,7 +477,6 @@ const ClassificationDetails = forwardRef(
|
|||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="m-b-sm m-t-xs" data-testid="description-container">
|
<div className="m-b-sm m-t-xs" data-testid="description-container">
|
||||||
<DescriptionV1
|
<DescriptionV1
|
||||||
className={classNames({
|
className={classNames({
|
||||||
@ -488,6 +486,7 @@ const ClassificationDetails = forwardRef(
|
|||||||
entityName={getEntityName(currentClassification)}
|
entityName={getEntityName(currentClassification)}
|
||||||
entityType={EntityType.CLASSIFICATION}
|
entityType={EntityType.CLASSIFICATION}
|
||||||
hasEditAccess={editDescriptionPermission}
|
hasEditAccess={editDescriptionPermission}
|
||||||
|
isDescriptionExpanded={isEmpty(tags)}
|
||||||
isEdit={isEditClassification}
|
isEdit={isEditClassification}
|
||||||
showCommentsIcon={false}
|
showCommentsIcon={false}
|
||||||
onCancel={handleCancelEditDescription}
|
onCancel={handleCancelEditDescription}
|
||||||
|
@ -558,6 +558,7 @@ const DashboardDetails = ({
|
|||||||
hasEditTagAccess,
|
hasEditTagAccess,
|
||||||
handleUpdateChart,
|
handleUpdateChart,
|
||||||
handleChartTagSelection,
|
handleChartTagSelection,
|
||||||
|
charts,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -607,6 +608,7 @@ const DashboardDetails = ({
|
|||||||
entityName={entityName}
|
entityName={entityName}
|
||||||
entityType={EntityType.DASHBOARD}
|
entityType={EntityType.DASHBOARD}
|
||||||
hasEditAccess={editDescriptionPermission}
|
hasEditAccess={editDescriptionPermission}
|
||||||
|
isDescriptionExpanded={isEmpty(charts)}
|
||||||
isEdit={isEdit}
|
isEdit={isEdit}
|
||||||
owner={dashboardDetails.owner}
|
owner={dashboardDetails.owner}
|
||||||
showActions={!deleted}
|
showActions={!deleted}
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
import { Card, Col, Row, Tabs } from 'antd';
|
import { Card, Col, Row, Tabs } from 'antd';
|
||||||
import { AxiosError } from 'axios';
|
import { AxiosError } from 'axios';
|
||||||
import { isUndefined, toString } from 'lodash';
|
import { isEmpty, isUndefined, toString } from 'lodash';
|
||||||
import { EntityTags } from 'Models';
|
import { EntityTags } from 'Models';
|
||||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
@ -220,6 +220,7 @@ const DataModelDetails = ({
|
|||||||
entityName={entityName}
|
entityName={entityName}
|
||||||
entityType={EntityType.DASHBOARD_DATA_MODEL}
|
entityType={EntityType.DASHBOARD_DATA_MODEL}
|
||||||
hasEditAccess={editDescriptionPermission}
|
hasEditAccess={editDescriptionPermission}
|
||||||
|
isDescriptionExpanded={isEmpty(dataModelData.columns)}
|
||||||
isEdit={isEditDescription}
|
isEdit={isEditDescription}
|
||||||
owner={owner}
|
owner={owner}
|
||||||
showActions={!deleted}
|
showActions={!deleted}
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Col, Row, Space, Tabs } from 'antd';
|
import { Col, Row, Space, Tabs } from 'antd';
|
||||||
import { noop } from 'lodash';
|
import { isEmpty, noop } from 'lodash';
|
||||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useHistory, useParams } from 'react-router-dom';
|
import { useHistory, useParams } from 'react-router-dom';
|
||||||
@ -152,6 +152,7 @@ const GlossaryDetails = ({
|
|||||||
entityName={getEntityName(glossary)}
|
entityName={getEntityName(glossary)}
|
||||||
entityType={EntityType.GLOSSARY}
|
entityType={EntityType.GLOSSARY}
|
||||||
hasEditAccess={permissions.EditDescription || permissions.EditAll}
|
hasEditAccess={permissions.EditDescription || permissions.EditAll}
|
||||||
|
isDescriptionExpanded={isEmpty(glossaryTerms)}
|
||||||
isEdit={isDescriptionEditable}
|
isEdit={isDescriptionEditable}
|
||||||
owner={glossary?.owner}
|
owner={glossary?.owner}
|
||||||
showActions={!glossary.deleted}
|
showActions={!glossary.deleted}
|
||||||
|
@ -404,6 +404,7 @@ const MlModelDetail: FC<MlModelDetailProp> = ({
|
|||||||
entityName={mlModelName}
|
entityName={mlModelName}
|
||||||
entityType={EntityType.MLMODEL}
|
entityType={EntityType.MLMODEL}
|
||||||
hasEditAccess={editDescriptionPermission}
|
hasEditAccess={editDescriptionPermission}
|
||||||
|
isDescriptionExpanded={isEmpty(mlModelDetail.mlFeatures)}
|
||||||
isEdit={isEdit}
|
isEdit={isEdit}
|
||||||
owner={mlModelDetail.owner}
|
owner={mlModelDetail.owner}
|
||||||
showActions={!deleted}
|
showActions={!deleted}
|
||||||
|
@ -582,6 +582,7 @@ const PipelineDetails = ({
|
|||||||
entityName={entityName}
|
entityName={entityName}
|
||||||
entityType={EntityType.PIPELINE}
|
entityType={EntityType.PIPELINE}
|
||||||
hasEditAccess={editDescriptionPermission}
|
hasEditAccess={editDescriptionPermission}
|
||||||
|
isDescriptionExpanded={isEmpty(tasksInternal)}
|
||||||
isEdit={isEdit}
|
isEdit={isEdit}
|
||||||
owner={owner}
|
owner={owner}
|
||||||
showActions={!deleted}
|
showActions={!deleted}
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
import { Col, Row, Tabs } from 'antd';
|
import { Col, Row, Tabs } from 'antd';
|
||||||
import { AxiosError } from 'axios';
|
import { AxiosError } from 'axios';
|
||||||
|
import { isEmpty } from 'lodash';
|
||||||
import { EntityTags } from 'Models';
|
import { EntityTags } from 'Models';
|
||||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
@ -313,6 +314,9 @@ const TopicDetails: React.FC<TopicDetailsProps> = ({
|
|||||||
entityName={entityName}
|
entityName={entityName}
|
||||||
entityType={EntityType.TOPIC}
|
entityType={EntityType.TOPIC}
|
||||||
hasEditAccess={editDescriptionPermission}
|
hasEditAccess={editDescriptionPermission}
|
||||||
|
isDescriptionExpanded={isEmpty(
|
||||||
|
topicDetails.messageSchema?.schemaFields
|
||||||
|
)}
|
||||||
isEdit={isEdit}
|
isEdit={isEdit}
|
||||||
owner={topicDetails.owner}
|
owner={topicDetails.owner}
|
||||||
showActions={!deleted}
|
showActions={!deleted}
|
||||||
|
@ -36,4 +36,5 @@ export interface DescriptionProps {
|
|||||||
reduceDescription?: boolean;
|
reduceDescription?: boolean;
|
||||||
className?: string;
|
className?: string;
|
||||||
showSuggestions?: boolean;
|
showSuggestions?: boolean;
|
||||||
|
isDescriptionExpanded?: boolean;
|
||||||
}
|
}
|
||||||
|
@ -57,6 +57,7 @@ const DescriptionV1 = ({
|
|||||||
showCommentsIcon = true,
|
showCommentsIcon = true,
|
||||||
reduceDescription,
|
reduceDescription,
|
||||||
showSuggestions = false,
|
showSuggestions = false,
|
||||||
|
isDescriptionExpanded,
|
||||||
}: DescriptionProps) => {
|
}: DescriptionProps) => {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const { suggestions = [], selectedUserSuggestions = [] } =
|
const { suggestions = [], selectedUserSuggestions = [] } =
|
||||||
@ -191,13 +192,14 @@ const DescriptionV1 = ({
|
|||||||
<RichTextEditorPreviewer
|
<RichTextEditorPreviewer
|
||||||
className={reduceDescription ? 'max-two-lines' : ''}
|
className={reduceDescription ? 'max-two-lines' : ''}
|
||||||
enableSeeMoreVariant={!removeBlur}
|
enableSeeMoreVariant={!removeBlur}
|
||||||
|
isDescriptionExpanded={isDescriptionExpanded}
|
||||||
markdown={description}
|
markdown={description}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<span>{t('label.no-description')}</span>
|
<span>{t('label.no-description')}</span>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}, [description, suggestionData]);
|
}, [description, suggestionData, isDescriptionExpanded]);
|
||||||
|
|
||||||
const content = (
|
const content = (
|
||||||
<Space
|
<Space
|
||||||
|
@ -35,6 +35,7 @@ export interface PreviewerProp {
|
|||||||
className?: string;
|
className?: string;
|
||||||
enableSeeMoreVariant?: boolean;
|
enableSeeMoreVariant?: boolean;
|
||||||
showReadMoreBtn?: boolean;
|
showReadMoreBtn?: boolean;
|
||||||
|
isDescriptionExpanded?: boolean;
|
||||||
textVariant?: TextVariant;
|
textVariant?: TextVariant;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ const mockProp: PreviewerProp = {
|
|||||||
className: '',
|
className: '',
|
||||||
maxLength: 300,
|
maxLength: 300,
|
||||||
enableSeeMoreVariant: true,
|
enableSeeMoreVariant: true,
|
||||||
|
isDescriptionExpanded: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('Test RichTextEditor Previewer Component', () => {
|
describe('Test RichTextEditor Previewer Component', () => {
|
||||||
@ -457,4 +458,27 @@ describe('Test RichTextEditor Previewer Component', () => {
|
|||||||
|
|
||||||
expect(screen.getByTestId('code-block-copy-icon')).toBeInTheDocument();
|
expect(screen.getByTestId('code-block-copy-icon')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Should render read less button if isDescriptionExpanded is true', async () => {
|
||||||
|
const { container } = render(
|
||||||
|
<RichTextEditorPreviewer {...mockProp} isDescriptionExpanded />,
|
||||||
|
{
|
||||||
|
wrapper: MemoryRouter,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
const readLessButton = await findByTestId(container, 'read-less-button');
|
||||||
|
|
||||||
|
expect(readLessButton).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should render read more button if isDescriptionExpanded is false', async () => {
|
||||||
|
const { container } = render(<RichTextEditorPreviewer {...mockProp} />, {
|
||||||
|
wrapper: MemoryRouter,
|
||||||
|
});
|
||||||
|
|
||||||
|
const readMoreButton = await findByTestId(container, 'read-more-button');
|
||||||
|
|
||||||
|
expect(readMoreButton).toBeInTheDocument();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -31,10 +31,10 @@ const RichTextEditorPreviewer = ({
|
|||||||
textVariant = 'black',
|
textVariant = 'black',
|
||||||
showReadMoreBtn = true,
|
showReadMoreBtn = true,
|
||||||
maxLength = DESCRIPTION_MAX_PREVIEW_CHARACTERS,
|
maxLength = DESCRIPTION_MAX_PREVIEW_CHARACTERS,
|
||||||
|
isDescriptionExpanded = false,
|
||||||
}: PreviewerProp) => {
|
}: PreviewerProp) => {
|
||||||
const { t, i18n } = useTranslation();
|
const { t, i18n } = useTranslation();
|
||||||
const [content, setContent] = useState<string>('');
|
const [content, setContent] = useState<string>('');
|
||||||
|
|
||||||
// initially read more will be false
|
// initially read more will be false
|
||||||
const [readMore, setReadMore] = useState<boolean>(false);
|
const [readMore, setReadMore] = useState<boolean>(false);
|
||||||
|
|
||||||
@ -95,6 +95,10 @@ const RichTextEditorPreviewer = ({
|
|||||||
return () => window.removeEventListener('mousedown', handleMouseDownEvent);
|
return () => window.removeEventListener('mousedown', handleMouseDownEvent);
|
||||||
}, [handleMouseDownEvent]);
|
}, [handleMouseDownEvent]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setReadMore(Boolean(isDescriptionExpanded));
|
||||||
|
}, [isDescriptionExpanded]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={classNames('rich-text-editor-container', className, {
|
className={classNames('rich-text-editor-container', className, {
|
||||||
|
@ -566,6 +566,7 @@ const ContainerPage = () => {
|
|||||||
entityName={entityName}
|
entityName={entityName}
|
||||||
entityType={EntityType.CONTAINER}
|
entityType={EntityType.CONTAINER}
|
||||||
hasEditAccess={editDescriptionPermission}
|
hasEditAccess={editDescriptionPermission}
|
||||||
|
isDescriptionExpanded={isEmpty(containerChildrenData)}
|
||||||
isEdit={isEditDescription}
|
isEdit={isEditDescription}
|
||||||
owner={owner}
|
owner={owner}
|
||||||
showActions={!deleted}
|
showActions={!deleted}
|
||||||
|
@ -516,6 +516,7 @@ const DatabaseDetails: FunctionComponent = () => {
|
|||||||
entityName={getEntityName(database)}
|
entityName={getEntityName(database)}
|
||||||
entityType={EntityType.DATABASE}
|
entityType={EntityType.DATABASE}
|
||||||
hasEditAccess={editDescriptionPermission}
|
hasEditAccess={editDescriptionPermission}
|
||||||
|
isDescriptionExpanded={isEmpty(database)}
|
||||||
isEdit={isEdit}
|
isEdit={isEdit}
|
||||||
showActions={!database.deleted}
|
showActions={!database.deleted}
|
||||||
onCancel={onCancel}
|
onCancel={onCancel}
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
import { Col, Row, Switch, Typography } from 'antd';
|
import { Col, Row, Switch, Typography } from 'antd';
|
||||||
import { ColumnsType } from 'antd/lib/table';
|
import { ColumnsType } from 'antd/lib/table';
|
||||||
|
import { isEmpty } from 'lodash';
|
||||||
import { PagingResponse } from 'Models';
|
import { PagingResponse } from 'Models';
|
||||||
import React, { useMemo } from 'react';
|
import React, { useMemo } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
@ -114,6 +115,7 @@ function SchemaTablesTab({
|
|||||||
description={description}
|
description={description}
|
||||||
entityFqn={databaseSchemaDetails.fullyQualifiedName}
|
entityFqn={databaseSchemaDetails.fullyQualifiedName}
|
||||||
entityType={EntityType.DATABASE_SCHEMA}
|
entityType={EntityType.DATABASE_SCHEMA}
|
||||||
|
isDescriptionExpanded={isEmpty(tableData.data)}
|
||||||
showActions={false}
|
showActions={false}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
@ -123,6 +125,7 @@ function SchemaTablesTab({
|
|||||||
entityName={getEntityName(databaseSchemaDetails)}
|
entityName={getEntityName(databaseSchemaDetails)}
|
||||||
entityType={EntityType.DATABASE_SCHEMA}
|
entityType={EntityType.DATABASE_SCHEMA}
|
||||||
hasEditAccess={editDescriptionPermission}
|
hasEditAccess={editDescriptionPermission}
|
||||||
|
isDescriptionExpanded={isEmpty(tableData.data)}
|
||||||
isEdit={isEdit}
|
isEdit={isEdit}
|
||||||
showActions={!databaseSchemaDetails.deleted}
|
showActions={!databaseSchemaDetails.deleted}
|
||||||
onCancel={onCancel}
|
onCancel={onCancel}
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
import { Col, Row, Tabs } from 'antd';
|
import { Col, Row, Tabs } from 'antd';
|
||||||
import { AxiosError } from 'axios';
|
import { AxiosError } from 'axios';
|
||||||
import { compare } from 'fast-json-patch';
|
import { compare } from 'fast-json-patch';
|
||||||
import { isEqual, isUndefined, omitBy } from 'lodash';
|
import { isEmpty, isEqual, isUndefined, omitBy } from 'lodash';
|
||||||
import { EntityTags } from 'Models';
|
import { EntityTags } from 'Models';
|
||||||
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
@ -392,6 +392,7 @@ function SearchIndexDetailsPage() {
|
|||||||
entityName={entityName}
|
entityName={entityName}
|
||||||
entityType={EntityType.SEARCH_INDEX}
|
entityType={EntityType.SEARCH_INDEX}
|
||||||
hasEditAccess={editDescriptionPermission}
|
hasEditAccess={editDescriptionPermission}
|
||||||
|
isDescriptionExpanded={isEmpty(searchIndexDetails?.fields)}
|
||||||
isEdit={isEdit}
|
isEdit={isEdit}
|
||||||
owner={searchIndexDetails?.owner}
|
owner={searchIndexDetails?.owner}
|
||||||
showActions={!searchIndexDetails?.deleted}
|
showActions={!searchIndexDetails?.deleted}
|
||||||
|
@ -22,6 +22,7 @@ import { ActivityFeedTab } from '../../components/ActivityFeed/ActivityFeedTab/A
|
|||||||
import ActivityThreadPanel from '../../components/ActivityFeed/ActivityThreadPanel/ActivityThreadPanel';
|
import ActivityThreadPanel from '../../components/ActivityFeed/ActivityThreadPanel/ActivityThreadPanel';
|
||||||
import { withActivityFeed } from '../../components/AppRouter/withActivityFeed';
|
import { withActivityFeed } from '../../components/AppRouter/withActivityFeed';
|
||||||
|
|
||||||
|
import { isEmpty } from 'lodash';
|
||||||
import { CustomPropertyTable } from '../../components/common/CustomPropertyTable/CustomPropertyTable';
|
import { CustomPropertyTable } from '../../components/common/CustomPropertyTable/CustomPropertyTable';
|
||||||
import DescriptionV1 from '../../components/common/EntityDescription/DescriptionV1';
|
import DescriptionV1 from '../../components/common/EntityDescription/DescriptionV1';
|
||||||
import ErrorPlaceHolder from '../../components/common/ErrorWithPlaceholder/ErrorPlaceHolder';
|
import ErrorPlaceHolder from '../../components/common/ErrorWithPlaceholder/ErrorPlaceHolder';
|
||||||
@ -550,6 +551,7 @@ const StoredProcedurePage = () => {
|
|||||||
entityName={entityName}
|
entityName={entityName}
|
||||||
entityType={EntityType.STORED_PROCEDURE}
|
entityType={EntityType.STORED_PROCEDURE}
|
||||||
hasEditAccess={editDescriptionPermission}
|
hasEditAccess={editDescriptionPermission}
|
||||||
|
isDescriptionExpanded={isEmpty(code)}
|
||||||
isEdit={isEdit}
|
isEdit={isEdit}
|
||||||
owner={owner}
|
owner={owner}
|
||||||
showActions={!deleted}
|
showActions={!deleted}
|
||||||
|
@ -518,6 +518,7 @@ const TableDetailsPageV1: React.FC = () => {
|
|||||||
entityName={entityName}
|
entityName={entityName}
|
||||||
entityType={EntityType.TABLE}
|
entityType={EntityType.TABLE}
|
||||||
hasEditAccess={editDescriptionPermission}
|
hasEditAccess={editDescriptionPermission}
|
||||||
|
isDescriptionExpanded={isEmpty(tableDetails?.columns)}
|
||||||
isEdit={isEdit}
|
isEdit={isEdit}
|
||||||
owner={tableDetails?.owner}
|
owner={tableDetails?.owner}
|
||||||
showActions={!deleted}
|
showActions={!deleted}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user