mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-02 13:43:22 +00:00
fix(ui): entity header title should be clickable instead just displayName (#11140)
* fix(ui): entire entity title is link * fix bigquery selector * fix data test id missing for entity displayName * fix data test id missing for entity displayName * remove underline from name for links * fix unit tests
This commit is contained in:
parent
d3db1cb95c
commit
a54237ed9f
@ -39,7 +39,7 @@ describe('BigQuery Ingestion', () => {
|
|||||||
cy.get('.form-group > #root\\/type')
|
cy.get('.form-group > #root\\/type')
|
||||||
.scrollIntoView()
|
.scrollIntoView()
|
||||||
.type('service_account');
|
.type('service_account');
|
||||||
cy.get(':nth-child(3) > .form-group > #root\\/projectId')
|
cy.get('#root\\/projectId')
|
||||||
.scrollIntoView()
|
.scrollIntoView()
|
||||||
.type(Cypress.env('bigqueryProjectId'));
|
.type(Cypress.env('bigqueryProjectId'));
|
||||||
cy.get('#root\\/privateKeyId')
|
cy.get('#root\\/privateKeyId')
|
||||||
|
@ -35,6 +35,7 @@ interface Props {
|
|||||||
titleIsLink?: boolean;
|
titleIsLink?: boolean;
|
||||||
openEntityInNewPage?: boolean;
|
openEntityInNewPage?: boolean;
|
||||||
gutter?: 'default' | 'large';
|
gutter?: 'default' | 'large';
|
||||||
|
serviceName: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const EntityHeader = ({
|
export const EntityHeader = ({
|
||||||
@ -46,6 +47,7 @@ export const EntityHeader = ({
|
|||||||
entityType,
|
entityType,
|
||||||
openEntityInNewPage,
|
openEntityInNewPage,
|
||||||
gutter = 'default',
|
gutter = 'default',
|
||||||
|
serviceName,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
return (
|
return (
|
||||||
<Row className="w-full" gutter={0} justify="space-between">
|
<Row className="w-full" gutter={0} justify="space-between">
|
||||||
@ -73,6 +75,7 @@ export const EntityHeader = ({
|
|||||||
}
|
}
|
||||||
name={entityData.name}
|
name={entityData.name}
|
||||||
openEntityInNewPage={openEntityInNewPage}
|
openEntityInNewPage={openEntityInNewPage}
|
||||||
|
serviceName={serviceName}
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
<Col>{extra}</Col>
|
<Col>{extra}</Col>
|
||||||
|
@ -25,11 +25,16 @@ const EntityHeaderTitle = ({
|
|||||||
link,
|
link,
|
||||||
openEntityInNewPage,
|
openEntityInNewPage,
|
||||||
deleted = false,
|
deleted = false,
|
||||||
|
serviceName,
|
||||||
}: EntityHeaderTitleProps) => {
|
}: EntityHeaderTitleProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
return (
|
const content = (
|
||||||
<Row align="middle" gutter={8} wrap={false}>
|
<Row
|
||||||
|
align="middle"
|
||||||
|
data-testid={`${serviceName}-${name}`}
|
||||||
|
gutter={8}
|
||||||
|
wrap={false}>
|
||||||
<Col>{icon}</Col>
|
<Col>{icon}</Col>
|
||||||
<Col>
|
<Col>
|
||||||
<div>
|
<div>
|
||||||
@ -38,13 +43,11 @@ const EntityHeaderTitle = ({
|
|||||||
data-testid="entity-header-name">
|
data-testid="entity-header-name">
|
||||||
{name}
|
{name}
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
{link ? (
|
|
||||||
<Link
|
<Typography.Text
|
||||||
className="m-b-0 d-block entity-header-display-name text-lg font-bold"
|
className="m-b-0 d-block entity-header-display-name text-lg font-bold"
|
||||||
data-testid="entity-header-display-name"
|
data-testid="entity-header-display-name"
|
||||||
target={openEntityInNewPage ? '_blank' : '_self'}
|
ellipsis={{ tooltip: true }}>
|
||||||
to={link}>
|
|
||||||
<Typography.Text ellipsis={{ tooltip: true }}>
|
|
||||||
{displayName ?? name}
|
{displayName ?? name}
|
||||||
{openEntityInNewPage && (
|
{openEntityInNewPage && (
|
||||||
<IconExternalLink
|
<IconExternalLink
|
||||||
@ -54,15 +57,6 @@ const EntityHeaderTitle = ({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
</Link>
|
|
||||||
) : (
|
|
||||||
<Typography.Text
|
|
||||||
className="m-b-0 d-block entity-header-display-name text-lg font-bold"
|
|
||||||
data-testid="entity-header-display-name"
|
|
||||||
ellipsis={{ tooltip: true }}>
|
|
||||||
{displayName ?? name}
|
|
||||||
</Typography.Text>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</Col>
|
</Col>
|
||||||
{deleted && (
|
{deleted && (
|
||||||
@ -75,6 +69,18 @@ const EntityHeaderTitle = ({
|
|||||||
)}
|
)}
|
||||||
</Row>
|
</Row>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return link ? (
|
||||||
|
<Link
|
||||||
|
className="tw-no-underline"
|
||||||
|
data-testid="entity-link"
|
||||||
|
target={openEntityInNewPage ? '_blank' : '_self'}
|
||||||
|
to={link}>
|
||||||
|
{content}
|
||||||
|
</Link>
|
||||||
|
) : (
|
||||||
|
content
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default EntityHeaderTitle;
|
export default EntityHeaderTitle;
|
||||||
|
@ -17,4 +17,5 @@ export interface EntityHeaderTitleProps {
|
|||||||
link?: string;
|
link?: string;
|
||||||
openEntityInNewPage?: boolean;
|
openEntityInNewPage?: boolean;
|
||||||
deleted?: boolean;
|
deleted?: boolean;
|
||||||
|
serviceName: string;
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ describe('EntityHeaderTitle', () => {
|
|||||||
displayName="Test DisplayName"
|
displayName="Test DisplayName"
|
||||||
icon="test-icon"
|
icon="test-icon"
|
||||||
name="test-name"
|
name="test-name"
|
||||||
|
serviceName="sample-data"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -34,6 +35,7 @@ describe('EntityHeaderTitle', () => {
|
|||||||
displayName="Test DisplayName"
|
displayName="Test DisplayName"
|
||||||
icon="test-icon"
|
icon="test-icon"
|
||||||
name="test-name"
|
name="test-name"
|
||||||
|
serviceName="sample-data"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -46,6 +48,7 @@ describe('EntityHeaderTitle', () => {
|
|||||||
displayName="Test DisplayName"
|
displayName="Test DisplayName"
|
||||||
icon="test-icon"
|
icon="test-icon"
|
||||||
name="test-name"
|
name="test-name"
|
||||||
|
serviceName="sample-data"
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -59,11 +62,12 @@ describe('EntityHeaderTitle', () => {
|
|||||||
icon="test-icon"
|
icon="test-icon"
|
||||||
link="test-link"
|
link="test-link"
|
||||||
name="test-name"
|
name="test-name"
|
||||||
|
serviceName="sample-data"
|
||||||
/>,
|
/>,
|
||||||
{ wrapper: MemoryRouter }
|
{ wrapper: MemoryRouter }
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(screen.getByTestId('entity-header-display-name')).toHaveProperty(
|
expect(screen.getByTestId('entity-link')).toHaveProperty(
|
||||||
'href',
|
'href',
|
||||||
'http://localhost/test-link'
|
'http://localhost/test-link'
|
||||||
);
|
);
|
||||||
|
@ -107,6 +107,7 @@ export default function EntitySummaryPanel({
|
|||||||
entityData={entityDetails.details}
|
entityData={entityDetails.details}
|
||||||
entityType={entityDetails.details.entityType as EntityType}
|
entityType={entityDetails.details.entityType as EntityType}
|
||||||
icon={icon}
|
icon={icon}
|
||||||
|
serviceName={entityDetails.details.serviceType ?? ''}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
width="100%">
|
width="100%">
|
||||||
|
@ -122,6 +122,7 @@ const GlossaryHeader = ({
|
|||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
serviceName=""
|
||||||
/>
|
/>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
|
@ -413,6 +413,7 @@ const EntityPageInfo = ({
|
|||||||
<img className="h-8" src={serviceTypeLogo(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}>
|
||||||
|
@ -163,6 +163,7 @@ const TableDataCardV2: React.FC<TableDataCardPropsV2> = forwardRef<
|
|||||||
}
|
}
|
||||||
icon={serviceIcon}
|
icon={serviceIcon}
|
||||||
openEntityInNewPage={openEntityInNewPage}
|
openEntityInNewPage={openEntityInNewPage}
|
||||||
|
serviceName={source.serviceType ?? ''}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className="tw-pt-3">
|
<div className="tw-pt-3">
|
||||||
|
@ -811,6 +811,7 @@ const DatabaseDetails: FunctionComponent = () => {
|
|||||||
src={serviceTypeLogo(serviceType ?? '')}
|
src={serviceTypeLogo(serviceType ?? '')}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
serviceName={database.service.name ?? ''}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</Col>
|
</Col>
|
||||||
|
@ -1033,6 +1033,7 @@ const ServicePage: FunctionComponent = () => {
|
|||||||
src={serviceTypeLogo(serviceDetails.serviceType)}
|
src={serviceTypeLogo(serviceDetails.serviceType)}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
serviceName={serviceDetails.name}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<Col span={24}>
|
<Col span={24}>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user