mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-14 09:51:13 +00:00
MINOR: fix custom property layout issues (#18065)
* fix custom property layout issues * fix font weight to similar like other * fix the right panel value style issue * fix the edit button alignment issue * changes as per comments and sonar fix (cherry picked from commit 819c405784d520b787042b78cc959445506caf01)
This commit is contained in:
parent
5d8546c135
commit
5ce29219b6
@ -245,22 +245,26 @@ export const CustomPropertyTable = <T extends ExtentionEntitiesKeys>({
|
|||||||
<>
|
<>
|
||||||
{!isEmpty(entityTypeDetail.customProperties) && (
|
{!isEmpty(entityTypeDetail.customProperties) && (
|
||||||
<>
|
<>
|
||||||
<div className="d-flex justify-between m-b-xs">
|
{isRenderedInRightPanel ? (
|
||||||
|
<>
|
||||||
|
<div className="d-flex justify-between m-b-md">
|
||||||
<Typography.Text className="right-panel-label">
|
<Typography.Text className="right-panel-label">
|
||||||
{t('label.custom-property-plural')}
|
{t('label.custom-property-plural')}
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
{viewAllBtn}
|
{viewAllBtn}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{isRenderedInRightPanel ? (
|
|
||||||
<div className="custom-property-right-panel-container">
|
<div className="custom-property-right-panel-container">
|
||||||
{dataSource.map((record, index) => (
|
{dataSource.map((record, index) => (
|
||||||
<Fragment key={record.name}>
|
<Fragment key={record.name}>
|
||||||
<div
|
<div
|
||||||
className={classNames('custom-property-right-panel-card', {
|
className={classNames(
|
||||||
|
'custom-property-right-panel-card',
|
||||||
|
{
|
||||||
'top-border-radius': index === 0,
|
'top-border-radius': index === 0,
|
||||||
'bottom-border-radius': index === dataSource.length - 1,
|
'bottom-border-radius':
|
||||||
})}
|
index === dataSource.length - 1,
|
||||||
|
}
|
||||||
|
)}
|
||||||
key={record.name}>
|
key={record.name}>
|
||||||
<PropertyValue
|
<PropertyValue
|
||||||
extension={extensionObject.extensionObject}
|
extension={extensionObject.extensionObject}
|
||||||
@ -279,6 +283,7 @@ export const CustomPropertyTable = <T extends ExtentionEntitiesKeys>({
|
|||||||
</Fragment>
|
</Fragment>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
</>
|
||||||
) : (
|
) : (
|
||||||
<Row data-testid="custom-properties-card" gutter={[16, 16]}>
|
<Row data-testid="custom-properties-card" gutter={[16, 16]}>
|
||||||
{dataSource.map((record) => (
|
{dataSource.map((record) => (
|
||||||
|
|||||||
@ -317,7 +317,7 @@ describe('Test PropertyValue Component', () => {
|
|||||||
const iconElement = await screen.findByTestId('edit-icon');
|
const iconElement = await screen.findByTestId('edit-icon');
|
||||||
|
|
||||||
expect(await screen.findByTestId('time-interval-value')).toHaveTextContent(
|
expect(await screen.findByTestId('time-interval-value')).toHaveTextContent(
|
||||||
'StartTime: 1736255200000EndTime: 1736255200020'
|
'label.start-entity: 1736255200000label.end-entity: 1736255200020'
|
||||||
);
|
);
|
||||||
|
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
|
|||||||
@ -11,7 +11,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Icon, { DownOutlined, UpOutlined } from '@ant-design/icons';
|
import Icon from '@ant-design/icons';
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@ -29,6 +29,7 @@ import {
|
|||||||
} from 'antd';
|
} from 'antd';
|
||||||
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 { t } from 'i18next';
|
import { t } from 'i18next';
|
||||||
import {
|
import {
|
||||||
isArray,
|
isArray,
|
||||||
@ -50,6 +51,7 @@ import React, {
|
|||||||
useState,
|
useState,
|
||||||
} from 'react';
|
} from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
import { ReactComponent as ArrowIconComponent } from '../../../assets/svg/drop-down.svg';
|
||||||
import { ReactComponent as EditIconComponent } from '../../../assets/svg/edit-new.svg';
|
import { ReactComponent as EditIconComponent } from '../../../assets/svg/edit-new.svg';
|
||||||
import {
|
import {
|
||||||
DE_ACTIVE_COLOR,
|
DE_ACTIVE_COLOR,
|
||||||
@ -865,7 +867,7 @@ export const PropertyValue: FC<PropertyValueProps> = ({
|
|||||||
isTeam={item.type === 'team'}
|
isTeam={item.type === 'team'}
|
||||||
name={item.name ?? ''}
|
name={item.name ?? ''}
|
||||||
type="circle"
|
type="circle"
|
||||||
width="20"
|
width="18"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
searchClassBase.getEntityIcon(item.type)
|
searchClassBase.getEntityIcon(item.type)
|
||||||
@ -874,7 +876,7 @@ export const PropertyValue: FC<PropertyValueProps> = ({
|
|||||||
}
|
}
|
||||||
type="text">
|
type="text">
|
||||||
<Typography.Text
|
<Typography.Text
|
||||||
className="text-left text-lg truncate w-68"
|
className="text-left text-primary truncate w-68"
|
||||||
ellipsis={{ tooltip: true }}>
|
ellipsis={{ tooltip: true }}>
|
||||||
{getEntityName(item)}
|
{getEntityName(item)}
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
@ -916,7 +918,7 @@ export const PropertyValue: FC<PropertyValueProps> = ({
|
|||||||
isTeam={item.type === 'team'}
|
isTeam={item.type === 'team'}
|
||||||
name={item.name ?? ''}
|
name={item.name ?? ''}
|
||||||
type="circle"
|
type="circle"
|
||||||
width="20"
|
width="18"
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
searchClassBase.getEntityIcon(item.type)
|
searchClassBase.getEntityIcon(item.type)
|
||||||
@ -925,7 +927,7 @@ export const PropertyValue: FC<PropertyValueProps> = ({
|
|||||||
}
|
}
|
||||||
type="text">
|
type="text">
|
||||||
<Typography.Text
|
<Typography.Text
|
||||||
className="text-left text-lg truncate w-68"
|
className="text-left text-primary truncate w-68 "
|
||||||
data-testid="entityReference-value-name"
|
data-testid="entityReference-value-name"
|
||||||
ellipsis={{ tooltip: true }}>
|
ellipsis={{ tooltip: true }}>
|
||||||
{getEntityName(item)}
|
{getEntityName(item)}
|
||||||
@ -947,13 +949,17 @@ export const PropertyValue: FC<PropertyValueProps> = ({
|
|||||||
className="break-all"
|
className="break-all"
|
||||||
data-testid="time-interval-value">
|
data-testid="time-interval-value">
|
||||||
<span>
|
<span>
|
||||||
<Typography.Text className="text-xs">{`StartTime: `}</Typography.Text>
|
<Typography.Text>{`${t('label.start-entity', {
|
||||||
<Typography.Text className="text-sm font-medium text-grey-body">
|
entity: t('label.time'),
|
||||||
|
})}: `}</Typography.Text>
|
||||||
|
<Typography.Text className="text-sm text-grey-body property-value">
|
||||||
{timeInterval.start}
|
{timeInterval.start}
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
<Divider className="self-center" type="vertical" />
|
<Divider className="self-center" type="vertical" />
|
||||||
<Typography.Text className="text-xs">{`EndTime: `}</Typography.Text>
|
<Typography.Text>{`${t('label.end-entity', {
|
||||||
<Typography.Text className="text-sm font-medium text-grey-body">
|
entity: t('label.time'),
|
||||||
|
})}: `}</Typography.Text>
|
||||||
|
<Typography.Text className="text-sm text-grey-body property-value">
|
||||||
{timeInterval.end}
|
{timeInterval.end}
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
</span>
|
</span>
|
||||||
@ -973,7 +979,7 @@ export const PropertyValue: FC<PropertyValueProps> = ({
|
|||||||
default:
|
default:
|
||||||
return (
|
return (
|
||||||
<Typography.Text
|
<Typography.Text
|
||||||
className="break-all text-lg font-medium text-grey-body"
|
className="break-all text-grey-body property-value"
|
||||||
data-testid="value">
|
data-testid="value">
|
||||||
{value}
|
{value}
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
@ -1012,10 +1018,10 @@ export const PropertyValue: FC<PropertyValueProps> = ({
|
|||||||
|
|
||||||
const customPropertyInlineElement = (
|
const customPropertyInlineElement = (
|
||||||
<div className="d-flex flex-column gap-2" data-testid={propertyName}>
|
<div className="d-flex flex-column gap-2" data-testid={propertyName}>
|
||||||
<div className="d-flex justify-between w-full">
|
<div className="d-flex justify-between w-full items-center">
|
||||||
<div className="d-flex flex-column gap-1 w-full">
|
<div className="d-flex flex-column gap-1 w-full">
|
||||||
<Typography.Text
|
<Typography.Text
|
||||||
className="text-md text-grey-body"
|
className="property-name text-grey-body"
|
||||||
data-testid="property-name">
|
data-testid="property-name">
|
||||||
{getEntityName(property)}
|
{getEntityName(property)}
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
@ -1039,11 +1045,6 @@ export const PropertyValue: FC<PropertyValueProps> = ({
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<RichTextEditorPreviewer
|
|
||||||
className="text-grey-muted"
|
|
||||||
markdown={property.description || ''}
|
|
||||||
maxLength={70}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -1051,9 +1052,9 @@ export const PropertyValue: FC<PropertyValueProps> = ({
|
|||||||
<Row data-testid={propertyName} gutter={[0, 16]}>
|
<Row data-testid={propertyName} gutter={[0, 16]}>
|
||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
<Row gutter={[0, 2]}>
|
<Row gutter={[0, 2]}>
|
||||||
<Col className="d-flex justify-between w-full" span={24}>
|
<Col className="d-flex justify-between items-center w-full" span={24}>
|
||||||
<Typography.Text
|
<Typography.Text
|
||||||
className="text-md text-grey-body"
|
className="text-grey-body property-name"
|
||||||
data-testid="property-name">
|
data-testid="property-name">
|
||||||
{getEntityName(property)}
|
{getEntityName(property)}
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
@ -1072,18 +1073,30 @@ export const PropertyValue: FC<PropertyValueProps> = ({
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
)}
|
)}
|
||||||
</Col>
|
</Col>
|
||||||
|
{!isRenderedInRightPanel && (
|
||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
<RichTextEditorPreviewer
|
<RichTextEditorPreviewer
|
||||||
className="text-grey-muted"
|
className="text-grey-muted property-description"
|
||||||
markdown={property.description || ''}
|
markdown={property.description || ''}
|
||||||
maxLength={70}
|
maxLength={70}
|
||||||
|
reducePreviewLineClass="max-one-line"
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
|
)}
|
||||||
</Row>
|
</Row>
|
||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
<div className="d-flex justify-between w-full gap-2">
|
<div
|
||||||
|
className={classNames(
|
||||||
|
'd-flex justify-between w-full gap-2',
|
||||||
|
{
|
||||||
|
'items-end': isExpanded,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'items-center': !isExpanded,
|
||||||
|
}
|
||||||
|
)}>
|
||||||
<div
|
<div
|
||||||
className="w-full"
|
className="w-full"
|
||||||
ref={contentRef}
|
ref={contentRef}
|
||||||
@ -1094,14 +1107,15 @@ export const PropertyValue: FC<PropertyValueProps> = ({
|
|||||||
{showInput ? getPropertyInput() : getValueElement()}
|
{showInput ? getPropertyInput() : getValueElement()}
|
||||||
</div>
|
</div>
|
||||||
{isOverflowing && !showInput && (
|
{isOverflowing && !showInput && (
|
||||||
<Button
|
<Icon
|
||||||
className="custom-property-value-toggle-btn"
|
className={classNames('custom-property-value-toggle-btn', {
|
||||||
|
active: isExpanded,
|
||||||
|
})}
|
||||||
|
component={ArrowIconComponent}
|
||||||
data-testid={`toggle-${propertyName}`}
|
data-testid={`toggle-${propertyName}`}
|
||||||
size="small"
|
style={{ color: DE_ACTIVE_COLOR, ...ICON_DIMENSION }}
|
||||||
type="text"
|
onClick={toggleExpand}
|
||||||
onClick={toggleExpand}>
|
/>
|
||||||
{isExpanded ? <UpOutlined /> : <DownOutlined />}
|
|
||||||
</Button>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</Col>
|
</Col>
|
||||||
@ -1111,7 +1125,7 @@ export const PropertyValue: FC<PropertyValueProps> = ({
|
|||||||
if (isRenderedInRightPanel) {
|
if (isRenderedInRightPanel) {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="custom-property-card-right-panel"
|
className="custom-property-card custom-property-card-right-panel"
|
||||||
data-testid="custom-property-right-panel-card">
|
data-testid="custom-property-right-panel-card">
|
||||||
{isInlineProperty ? customPropertyInlineElement : customPropertyElement}
|
{isInlineProperty ? customPropertyInlineElement : customPropertyElement}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -31,14 +31,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-btn-text.custom-property-value-toggle-btn {
|
.custom-property-value-toggle-btn {
|
||||||
border-radius: 100%;
|
svg {
|
||||||
background: @btn-bg-color;
|
|
||||||
border-color: transparent;
|
|
||||||
height: 30px;
|
|
||||||
width: 30px;
|
|
||||||
.anticon {
|
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
|
width: 14px;
|
||||||
|
transition: 0.3s ease-in-out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-property-value-toggle-btn.active {
|
||||||
|
svg {
|
||||||
|
transform: rotate(180deg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,6 +62,14 @@
|
|||||||
.ant-card-body {
|
.ant-card-body {
|
||||||
overflow-x: scroll;
|
overflow-x: scroll;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.property-name {
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
.property-value {
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.custom-property-card-right-panel {
|
.custom-property-card-right-panel {
|
||||||
|
|||||||
@ -111,7 +111,7 @@ const ResizablePanels: React.FC<ResizablePanelsProps> = ({
|
|||||||
}}>
|
}}>
|
||||||
{!hideSecondPanel && (
|
{!hideSecondPanel && (
|
||||||
<PanelContainer overlay={secondPanel.overlay}>
|
<PanelContainer overlay={secondPanel.overlay}>
|
||||||
{secondPanel.children}
|
<div className="p-l-sm">{secondPanel.children}</div>
|
||||||
</PanelContainer>
|
</PanelContainer>
|
||||||
)}
|
)}
|
||||||
</ReflexElement>
|
</ReflexElement>
|
||||||
|
|||||||
@ -37,6 +37,7 @@ export interface PreviewerProp {
|
|||||||
showReadMoreBtn?: boolean;
|
showReadMoreBtn?: boolean;
|
||||||
isDescriptionExpanded?: boolean;
|
isDescriptionExpanded?: boolean;
|
||||||
textVariant?: TextVariant;
|
textVariant?: TextVariant;
|
||||||
|
reducePreviewLineClass?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type PreviewStyle = 'tab' | 'vertical';
|
export type PreviewStyle = 'tab' | 'vertical';
|
||||||
|
|||||||
@ -35,6 +35,7 @@ const RichTextEditorPreviewer = ({
|
|||||||
showReadMoreBtn = true,
|
showReadMoreBtn = true,
|
||||||
maxLength = DESCRIPTION_MAX_PREVIEW_CHARACTERS,
|
maxLength = DESCRIPTION_MAX_PREVIEW_CHARACTERS,
|
||||||
isDescriptionExpanded = false,
|
isDescriptionExpanded = false,
|
||||||
|
reducePreviewLineClass,
|
||||||
}: PreviewerProp) => {
|
}: PreviewerProp) => {
|
||||||
const { t, i18n } = useTranslation();
|
const { t, i18n } = useTranslation();
|
||||||
const [content, setContent] = useState<string>('');
|
const [content, setContent] = useState<string>('');
|
||||||
@ -110,7 +111,11 @@ const RichTextEditorPreviewer = ({
|
|||||||
data-testid="viewer-container"
|
data-testid="viewer-container"
|
||||||
dir={i18n.dir()}>
|
dir={i18n.dir()}>
|
||||||
<div
|
<div
|
||||||
className={classNames('markdown-parser', textVariant)}
|
className={classNames(
|
||||||
|
'markdown-parser',
|
||||||
|
textVariant,
|
||||||
|
readMore ? '' : reducePreviewLineClass
|
||||||
|
)}
|
||||||
data-testid="markdown-parser">
|
data-testid="markdown-parser">
|
||||||
<Viewer
|
<Viewer
|
||||||
extendedAutolinks
|
extendedAutolinks
|
||||||
|
|||||||
@ -262,6 +262,14 @@ a[href].link-text-grey,
|
|||||||
-webkit-box-orient: vertical;
|
-webkit-box-orient: vertical;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.max-one-line {
|
||||||
|
overflow: hidden;
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-line-clamp: 1;
|
||||||
|
line-clamp: 1;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
|
}
|
||||||
|
|
||||||
.mx-auto {
|
.mx-auto {
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user