mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-27 01:45:32 +00:00
fix(ui): fix the icon squeezing issue in entity headers and only name in right panel header (#11480)
* fix the icon squeezing issue in service pages * minor fixes
This commit is contained in:
parent
3bef880dca
commit
890433a8d6
@ -11,7 +11,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Col, Row } from 'antd';
|
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import TitleBreadcrumb from 'components/common/title-breadcrumb/title-breadcrumb.component';
|
import TitleBreadcrumb from 'components/common/title-breadcrumb/title-breadcrumb.component';
|
||||||
import { TitleBreadcrumbProps } from 'components/common/title-breadcrumb/title-breadcrumb.interface';
|
import { TitleBreadcrumbProps } from 'components/common/title-breadcrumb/title-breadcrumb.interface';
|
||||||
@ -22,7 +21,6 @@ import { getEncodedFqn } from 'utils/StringsUtils';
|
|||||||
import EntityHeaderTitle from '../EntityHeaderTitle/EntityHeaderTitle.component';
|
import EntityHeaderTitle from '../EntityHeaderTitle/EntityHeaderTitle.component';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
extra?: ReactNode;
|
|
||||||
breadcrumb: TitleBreadcrumbProps['titleLinks'];
|
breadcrumb: TitleBreadcrumbProps['titleLinks'];
|
||||||
entityData: {
|
entityData: {
|
||||||
displayName?: string;
|
displayName?: string;
|
||||||
@ -41,7 +39,6 @@ interface Props {
|
|||||||
export const EntityHeader = ({
|
export const EntityHeader = ({
|
||||||
breadcrumb,
|
breadcrumb,
|
||||||
entityData,
|
entityData,
|
||||||
extra,
|
|
||||||
icon,
|
icon,
|
||||||
titleIsLink = false,
|
titleIsLink = false,
|
||||||
entityType,
|
entityType,
|
||||||
@ -50,12 +47,7 @@ export const EntityHeader = ({
|
|||||||
serviceName,
|
serviceName,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
return (
|
return (
|
||||||
<Row
|
<div className="w-full font-medium">
|
||||||
className="w-full font-medium"
|
|
||||||
gutter={0}
|
|
||||||
justify="space-between"
|
|
||||||
wrap={false}>
|
|
||||||
<Col>
|
|
||||||
<div
|
<div
|
||||||
className={classNames(
|
className={classNames(
|
||||||
'tw-text-link tw-text-base glossary-breadcrumb',
|
'tw-text-link tw-text-base glossary-breadcrumb',
|
||||||
@ -81,8 +73,6 @@ export const EntityHeader = ({
|
|||||||
openEntityInNewPage={openEntityInNewPage}
|
openEntityInNewPage={openEntityInNewPage}
|
||||||
serviceName={serviceName}
|
serviceName={serviceName}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</div>
|
||||||
<Col>{extra}</Col>
|
|
||||||
</Row>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -43,11 +43,11 @@ const EntityHeaderTitle = ({
|
|||||||
data-testid={`${serviceName}-${name}`}
|
data-testid={`${serviceName}-${name}`}
|
||||||
gutter={8}
|
gutter={8}
|
||||||
wrap={false}>
|
wrap={false}>
|
||||||
<Col>{icon}</Col>
|
<Col flex="45px">{icon}</Col>
|
||||||
<Col span={20}>
|
<Col flex="auto">
|
||||||
<div>
|
<div>
|
||||||
<Typography.Text
|
<Typography.Text
|
||||||
className="m-b-0 d-block tw-text-xs tw-text-grey-muted"
|
className="m-b-0 d-block text-grey-muted text-md font-medium"
|
||||||
data-testid="entity-header-name">
|
data-testid="entity-header-name">
|
||||||
{stringToHTML(name)}
|
{stringToHTML(name)}
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
@ -80,7 +80,7 @@ const EntityHeaderTitle = ({
|
|||||||
|
|
||||||
return link && !isTourRoute ? (
|
return link && !isTourRoute ? (
|
||||||
<Link
|
<Link
|
||||||
className="tw-no-underline"
|
className="no-underline"
|
||||||
data-testid="entity-link"
|
data-testid="entity-link"
|
||||||
target={openEntityInNewPage ? '_blank' : '_self'}
|
target={openEntityInNewPage ? '_blank' : '_self'}
|
||||||
to={link}>
|
to={link}>
|
||||||
|
@ -12,8 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { CloseOutlined } from '@ant-design/icons';
|
import { CloseOutlined } from '@ant-design/icons';
|
||||||
import { Drawer } from 'antd';
|
import { Drawer, Typography } from 'antd';
|
||||||
import { EntityHeader } from 'components/Entity/EntityHeader/EntityHeader.component';
|
|
||||||
import { EntityType } from 'enums/entity.enum';
|
import { EntityType } from 'enums/entity.enum';
|
||||||
import { Tag } from 'generated/entity/classification/tag';
|
import { Tag } from 'generated/entity/classification/tag';
|
||||||
import { Container } from 'generated/entity/data/container';
|
import { Container } from 'generated/entity/data/container';
|
||||||
@ -22,9 +21,9 @@ import { GlossaryTerm } from 'generated/entity/data/glossaryTerm';
|
|||||||
import { Table } from 'generated/entity/data/table';
|
import { Table } from 'generated/entity/data/table';
|
||||||
import { get } from 'lodash';
|
import { get } from 'lodash';
|
||||||
import React, { useMemo } from 'react';
|
import React, { useMemo } from 'react';
|
||||||
import { useParams } from 'react-router-dom';
|
import { Link, useParams } from 'react-router-dom';
|
||||||
import { getEntityBreadcrumbs } from 'utils/EntityUtils';
|
import { getEntityLinkFromType, getEntityName } from 'utils/EntityUtils';
|
||||||
import { getServiceIcon } from 'utils/TableUtils';
|
import { getEncodedFqn } from 'utils/StringsUtils';
|
||||||
import { Mlmodel } from '../../../generated/entity/data/mlmodel';
|
import { Mlmodel } from '../../../generated/entity/data/mlmodel';
|
||||||
import { Pipeline } from '../../../generated/entity/data/pipeline';
|
import { Pipeline } from '../../../generated/entity/data/pipeline';
|
||||||
import { Topic } from '../../../generated/entity/data/topic';
|
import { Topic } from '../../../generated/entity/data/topic';
|
||||||
@ -78,9 +77,17 @@ export default function EntitySummaryPanel({
|
|||||||
}
|
}
|
||||||
}, [tab, entityDetails]);
|
}, [tab, entityDetails]);
|
||||||
|
|
||||||
const icon = useMemo(() => {
|
const entityLink = useMemo(
|
||||||
return getServiceIcon(entityDetails.details);
|
() =>
|
||||||
}, [entityDetails]);
|
(entityDetails.details.fullyQualifiedName &&
|
||||||
|
entityDetails.details.entityType &&
|
||||||
|
getEntityLinkFromType(
|
||||||
|
getEncodedFqn(entityDetails.details.fullyQualifiedName),
|
||||||
|
entityDetails.details.entityType as EntityType
|
||||||
|
)) ??
|
||||||
|
'',
|
||||||
|
[entityDetails, getEntityLinkFromType, getEncodedFqn]
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Drawer
|
<Drawer
|
||||||
@ -98,19 +105,14 @@ export default function EntitySummaryPanel({
|
|||||||
headerStyle={{ padding: 16 }}
|
headerStyle={{ padding: 16 }}
|
||||||
mask={false}
|
mask={false}
|
||||||
title={
|
title={
|
||||||
<div className="d-grid">
|
<Link
|
||||||
<EntityHeader
|
className="no-underline"
|
||||||
titleIsLink
|
data-testid="entity-link"
|
||||||
breadcrumb={getEntityBreadcrumbs(
|
to={entityLink}>
|
||||||
entityDetails.details,
|
<Typography.Text className="m-b-0 d-block entity-header-display-name">
|
||||||
entityDetails.details.entityType as EntityType
|
{getEntityName(entityDetails.details)}
|
||||||
)}
|
</Typography.Text>
|
||||||
entityData={entityDetails.details}
|
</Link>
|
||||||
entityType={entityDetails.details.entityType as EntityType}
|
|
||||||
icon={icon}
|
|
||||||
serviceName={entityDetails.details.serviceType ?? ''}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
}
|
}
|
||||||
width="100%">
|
width="100%">
|
||||||
{summaryComponent}
|
{summaryComponent}
|
||||||
|
@ -48,6 +48,14 @@ jest.mock('./DashboardSummary/DashboardSummary.component', () =>
|
|||||||
))
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
jest.mock('utils/EntityUtils', () => ({
|
||||||
|
getEntityLinkFromType: jest.fn().mockImplementation(() => 'link'),
|
||||||
|
getEntityName: jest.fn().mockImplementation(() => 'displayName'),
|
||||||
|
}));
|
||||||
|
jest.mock('utils/StringsUtils', () => ({
|
||||||
|
getEncodedFqn: jest.fn().mockImplementation((fqn) => fqn),
|
||||||
|
}));
|
||||||
|
|
||||||
jest.mock('./PipelineSummary/PipelineSummary.component', () =>
|
jest.mock('./PipelineSummary/PipelineSummary.component', () =>
|
||||||
jest
|
jest
|
||||||
.fn()
|
.fn()
|
||||||
@ -66,10 +74,7 @@ jest.mock('./MlModelSummary/MlModelSummary.component', () =>
|
|||||||
|
|
||||||
jest.mock('react-router-dom', () => ({
|
jest.mock('react-router-dom', () => ({
|
||||||
useParams: jest.fn().mockImplementation(() => ({ tab: 'table' })),
|
useParams: jest.fn().mockImplementation(() => ({ tab: 'table' })),
|
||||||
}));
|
Link: jest.fn().mockImplementation(({ children }) => <>{children}</>),
|
||||||
|
|
||||||
jest.mock('components/Entity/EntityHeader/EntityHeader.component', () => ({
|
|
||||||
EntityHeader: jest.fn().mockImplementation(() => <p>EntityHeader</p>),
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('EntitySummaryPanel component tests', () => {
|
describe('EntitySummaryPanel component tests', () => {
|
||||||
@ -83,11 +88,9 @@ describe('EntitySummaryPanel component tests', () => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
const entityHeader = screen.getByText('EntityHeader');
|
|
||||||
const tableSummary = screen.getByTestId('TableSummary');
|
const tableSummary = screen.getByTestId('TableSummary');
|
||||||
const closeIcon = screen.getByTestId('summary-panel-close-icon');
|
const closeIcon = screen.getByTestId('summary-panel-close-icon');
|
||||||
|
|
||||||
expect(entityHeader).toBeInTheDocument();
|
|
||||||
expect(tableSummary).toBeInTheDocument();
|
expect(tableSummary).toBeInTheDocument();
|
||||||
expect(closeIcon).toBeInTheDocument();
|
expect(closeIcon).toBeInTheDocument();
|
||||||
|
|
||||||
|
@ -362,13 +362,34 @@ const GlossaryHeader = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Row gutter={[0, 16]}>
|
<Row gutter={[0, 16]} justify="space-between" wrap={false}>
|
||||||
<Col span={24}>
|
<Col>
|
||||||
<EntityHeader
|
<EntityHeader
|
||||||
breadcrumb={breadcrumb}
|
breadcrumb={breadcrumb}
|
||||||
entityData={selectedData}
|
entityData={selectedData}
|
||||||
entityType={EntityType.GLOSSARY_TERM}
|
entityType={EntityType.GLOSSARY_TERM}
|
||||||
extra={
|
gutter="large"
|
||||||
|
icon={
|
||||||
|
isGlossary ? (
|
||||||
|
<IconFolder
|
||||||
|
color={DE_ACTIVE_COLOR}
|
||||||
|
height={36}
|
||||||
|
name="folder"
|
||||||
|
width={32}
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<IconFlatDoc
|
||||||
|
color={DE_ACTIVE_COLOR}
|
||||||
|
height={36}
|
||||||
|
name="doc"
|
||||||
|
width={32}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
serviceName=""
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col>
|
||||||
<div style={{ textAlign: 'right' }}>
|
<div style={{ textAlign: 'right' }}>
|
||||||
<div>
|
<div>
|
||||||
{createButtons}
|
{createButtons}
|
||||||
@ -405,27 +426,6 @@ const GlossaryHeader = ({
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
}
|
|
||||||
gutter="large"
|
|
||||||
icon={
|
|
||||||
isGlossary ? (
|
|
||||||
<IconFolder
|
|
||||||
color={DE_ACTIVE_COLOR}
|
|
||||||
height={36}
|
|
||||||
name="folder"
|
|
||||||
width={32}
|
|
||||||
/>
|
|
||||||
) : (
|
|
||||||
<IconFlatDoc
|
|
||||||
color={DE_ACTIVE_COLOR}
|
|
||||||
height={36}
|
|
||||||
name="doc"
|
|
||||||
width={32}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
serviceName=""
|
|
||||||
/>
|
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
{selectedData && (
|
{selectedData && (
|
||||||
|
@ -366,6 +366,8 @@ const EntityPageInfo = ({
|
|||||||
className="w-full"
|
className="w-full"
|
||||||
data-testid="entity-page-info"
|
data-testid="entity-page-info"
|
||||||
direction="vertical">
|
direction="vertical">
|
||||||
|
<Row>
|
||||||
|
<Col span={18}>
|
||||||
<EntityHeader
|
<EntityHeader
|
||||||
breadcrumb={titleLinks}
|
breadcrumb={titleLinks}
|
||||||
entityData={{
|
entityData={{
|
||||||
@ -374,7 +376,15 @@ const EntityPageInfo = ({
|
|||||||
deleted,
|
deleted,
|
||||||
}}
|
}}
|
||||||
entityType={(entityType as EntityType) ?? EntityType.TABLE}
|
entityType={(entityType as EntityType) ?? EntityType.TABLE}
|
||||||
extra={
|
icon={
|
||||||
|
serviceType && (
|
||||||
|
<img className="h-8" src={serviceTypeLogo(serviceType)} />
|
||||||
|
)
|
||||||
|
}
|
||||||
|
serviceName={serviceType ?? ''}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col className="d-flex justify-end item-start" span={6}>
|
||||||
<Space align="center" id="version-and-follow-section">
|
<Space align="center" id="version-and-follow-section">
|
||||||
{!isUndefined(version) && (
|
{!isUndefined(version) && (
|
||||||
<VersionButton
|
<VersionButton
|
||||||
@ -437,14 +447,8 @@ const EntityPageInfo = ({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Space>
|
</Space>
|
||||||
}
|
</Col>
|
||||||
icon={
|
</Row>
|
||||||
serviceType && (
|
|
||||||
<img className="h-8" src={serviceTypeLogo(serviceType)} />
|
|
||||||
)
|
|
||||||
}
|
|
||||||
serviceName={serviceType ?? ''}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Space wrap className="justify-between w-full" size={16}>
|
<Space wrap className="justify-between w-full" size={16}>
|
||||||
<Space direction="vertical">
|
<Space direction="vertical">
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Checkbox } from 'antd';
|
import { Checkbox, Col, Row } from 'antd';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { EntityHeader } from 'components/Entity/EntityHeader/EntityHeader.component';
|
import { EntityHeader } from 'components/Entity/EntityHeader/EntityHeader.component';
|
||||||
import { isString, startCase, uniqueId } from 'lodash';
|
import { isString, startCase, uniqueId } from 'lodash';
|
||||||
@ -151,20 +151,24 @@ const TableDataCardV2: React.FC<TableDataCardPropsV2> = forwardRef<
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
handleSummaryPanelDisplay && handleSummaryPanelDisplay(source, tab);
|
handleSummaryPanelDisplay && handleSummaryPanelDisplay(source, tab);
|
||||||
}}>
|
}}>
|
||||||
|
<Row>
|
||||||
|
<Col span={23}>
|
||||||
<EntityHeader
|
<EntityHeader
|
||||||
titleIsLink
|
titleIsLink
|
||||||
breadcrumb={breadcrumbs}
|
breadcrumb={breadcrumbs}
|
||||||
entityData={source}
|
entityData={source}
|
||||||
entityType={source.entityType as EntityType}
|
entityType={source.entityType as EntityType}
|
||||||
extra={
|
|
||||||
showCheckboxes && (
|
|
||||||
<Checkbox checked={checked} className="m-l-auto" />
|
|
||||||
)
|
|
||||||
}
|
|
||||||
icon={serviceIcon}
|
icon={serviceIcon}
|
||||||
openEntityInNewPage={openEntityInNewPage}
|
openEntityInNewPage={openEntityInNewPage}
|
||||||
serviceName={source.serviceType ?? ''}
|
serviceName={source.serviceType ?? ''}
|
||||||
/>
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col className="d-flex justify-end" span={1}>
|
||||||
|
{showCheckboxes && (
|
||||||
|
<Checkbox checked={checked} className="m-l-auto" />
|
||||||
|
)}
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
|
||||||
<div className="tw-pt-3">
|
<div className="tw-pt-3">
|
||||||
<TableDataCardBody
|
<TableDataCardBody
|
||||||
|
@ -846,13 +846,23 @@ const DatabaseDetails: FunctionComponent = () => {
|
|||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Col span={24}>
|
|
||||||
{database && (
|
{database && (
|
||||||
|
<Row className="p-x-xs">
|
||||||
|
<Col span={23}>
|
||||||
<EntityHeader
|
<EntityHeader
|
||||||
breadcrumb={slashedDatabaseName}
|
breadcrumb={slashedDatabaseName}
|
||||||
entityData={database}
|
entityData={database}
|
||||||
entityType={EntityType.DATABASE}
|
entityType={EntityType.DATABASE}
|
||||||
extra={
|
icon={
|
||||||
|
<img
|
||||||
|
className="h-8"
|
||||||
|
src={serviceTypeLogo(serviceType ?? '')}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
serviceName={database.service.name ?? ''}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col className="d-flex justify-end" span={1}>
|
||||||
<ManageButton
|
<ManageButton
|
||||||
isRecursiveDelete
|
isRecursiveDelete
|
||||||
allowSoftDelete={false}
|
allowSoftDelete={false}
|
||||||
@ -862,18 +872,9 @@ const DatabaseDetails: FunctionComponent = () => {
|
|||||||
entityName={databaseName}
|
entityName={databaseName}
|
||||||
entityType={EntityType.DATABASE}
|
entityType={EntityType.DATABASE}
|
||||||
/>
|
/>
|
||||||
}
|
|
||||||
icon={
|
|
||||||
<img
|
|
||||||
className="h-8"
|
|
||||||
src={serviceTypeLogo(serviceType ?? '')}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
serviceName={database.service.name ?? ''}
|
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</Col>
|
</Col>
|
||||||
|
</Row>
|
||||||
|
)}
|
||||||
<Col className="m-t-xs" span={24}>
|
<Col className="m-t-xs" span={24}>
|
||||||
<Space wrap align="center" data-testid="extrainfo" size={4}>
|
<Space wrap align="center" data-testid="extrainfo" size={4}>
|
||||||
{extraInfo.map((info, index) => (
|
{extraInfo.map((info, index) => (
|
||||||
|
@ -1088,13 +1088,24 @@ const ServicePage: FunctionComponent = () => {
|
|||||||
entity: getEntityName(serviceDetails),
|
entity: getEntityName(serviceDetails),
|
||||||
})}>
|
})}>
|
||||||
{servicePermission.ViewAll || servicePermission.ViewBasic ? (
|
{servicePermission.ViewAll || servicePermission.ViewBasic ? (
|
||||||
<Row data-testid="service-page" gutter={[0, 12]}>
|
<Row data-testid="service-page">
|
||||||
{serviceDetails && (
|
{serviceDetails && (
|
||||||
|
<Row className="w-full m-b-xs">
|
||||||
|
<Col span={22}>
|
||||||
<EntityHeader
|
<EntityHeader
|
||||||
breadcrumb={slashedTableName}
|
breadcrumb={slashedTableName}
|
||||||
entityData={serviceDetails}
|
entityData={serviceDetails}
|
||||||
extra={
|
icon={
|
||||||
serviceDetails?.serviceType !==
|
<img
|
||||||
|
className="h-8"
|
||||||
|
src={serviceTypeLogo(serviceDetails.serviceType)}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
serviceName={serviceDetails.name}
|
||||||
|
/>
|
||||||
|
</Col>
|
||||||
|
<Col className="d-flex justify-end" span={2}>
|
||||||
|
{serviceDetails?.serviceType !==
|
||||||
MetadataServiceType.OpenMetadata && (
|
MetadataServiceType.OpenMetadata && (
|
||||||
<Tooltip
|
<Tooltip
|
||||||
placement="topRight"
|
placement="topRight"
|
||||||
@ -1120,17 +1131,11 @@ const ServicePage: FunctionComponent = () => {
|
|||||||
{t('label.delete')}
|
{t('label.delete')}
|
||||||
</Button>
|
</Button>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
)
|
|
||||||
}
|
|
||||||
icon={
|
|
||||||
<img
|
|
||||||
className="h-8"
|
|
||||||
src={serviceTypeLogo(serviceDetails.serviceType)}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
serviceName={serviceDetails.name}
|
|
||||||
/>
|
|
||||||
)}
|
)}
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
)}
|
||||||
|
|
||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
<Space>
|
<Space>
|
||||||
{extraInfo.map((info) => (
|
{extraInfo.map((info) => (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user