fix(ui): fix the ellipses and icon misplacement of entity headers (#11502)

* fix the ellipses and icon misplacement of entity headers

* changes as per commets
This commit is contained in:
Ashish Gupta 2023-05-09 21:28:04 +05:30 committed by GitHub
parent 41438b90b3
commit 100f885138
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 62 additions and 56 deletions

View File

@ -28,6 +28,7 @@ const EntityHeaderTitle = ({
openEntityInNewPage, openEntityInNewPage,
deleted = false, deleted = false,
serviceName, serviceName,
badge,
}: EntityHeaderTitleProps) => { }: EntityHeaderTitleProps) => {
const { t } = useTranslation(); const { t } = useTranslation();
const location = useLocation(); const location = useLocation();
@ -43,29 +44,27 @@ const EntityHeaderTitle = ({
data-testid={`${serviceName}-${name}`} data-testid={`${serviceName}-${name}`}
gutter={8} gutter={8}
wrap={false}> wrap={false}>
<Col flex="45px">{icon}</Col> <Col>{icon}</Col>
<Col flex="auto"> <Col className={deleted || badge ? 'w-max-full-140' : 'w-max-full-45'}>
<div> <Typography.Text
<Typography.Text className="m-b-0 d-block text-grey-muted text-md font-medium"
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>
<Typography.Text <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"
ellipsis={{ tooltip: true }}> ellipsis={{ tooltip: true }}>
{stringToHTML(displayName ?? name)} {stringToHTML(displayName ?? name)}
{openEntityInNewPage && ( {openEntityInNewPage && (
<IconExternalLink <IconExternalLink
className="anticon vertical-baseline m-l-xss" className="anticon vertical-baseline m-l-xss"
height={14} height={14}
width={14} width={14}
/> />
)} )}
</Typography.Text> </Typography.Text>
</div>
</Col> </Col>
{deleted && ( {deleted && (
<Col className="self-end text-xs"> <Col className="self-end text-xs">
@ -75,6 +74,7 @@ const EntityHeaderTitle = ({
</div> </div>
</Col> </Col>
)} )}
{badge && <Col className="self-end">{badge}</Col>}
</Row> </Row>
); );

View File

@ -18,4 +18,5 @@ export interface EntityHeaderTitleProps {
openEntityInNewPage?: boolean; openEntityInNewPage?: boolean;
deleted?: boolean; deleted?: boolean;
serviceName: string; serviceName: string;
badge?: React.ReactNode;
} }

View File

@ -363,12 +363,11 @@ const GlossaryHeader = ({
return ( return (
<> <>
<Row gutter={[0, 16]} justify="space-between" wrap={false}> <Row gutter={[0, 16]} justify="space-between" wrap={false}>
<Col> <Col flex="auto">
<EntityHeader <EntityHeader
breadcrumb={breadcrumb} breadcrumb={breadcrumb}
entityData={selectedData} entityData={selectedData}
entityType={EntityType.GLOSSARY_TERM} entityType={EntityType.GLOSSARY_TERM}
gutter="large"
icon={ icon={
isGlossary ? ( isGlossary ? (
<IconFolder <IconFolder
@ -389,7 +388,7 @@ const GlossaryHeader = ({
serviceName="" serviceName=""
/> />
</Col> </Col>
<Col> <Col flex="270px">
<div style={{ textAlign: 'right' }}> <div style={{ textAlign: 'right' }}>
<div> <div>
{createButtons} {createButtons}

View File

@ -366,8 +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> <Row wrap={false}>
<Col span={18}> <Col flex="auto">
<EntityHeader <EntityHeader
breadcrumb={titleLinks} breadcrumb={titleLinks}
entityData={{ entityData={{
@ -384,7 +384,7 @@ const EntityPageInfo = ({
serviceName={serviceType ?? ''} serviceName={serviceType ?? ''}
/> />
</Col> </Col>
<Col className="d-flex justify-end item-start" span={6}> <Col className="d-flex justify-end item-start" flex="320px">
<Space align="center" id="version-and-follow-section"> <Space align="center" id="version-and-follow-section">
{!isUndefined(version) && ( {!isUndefined(version) && (
<VersionButton <VersionButton

View File

@ -151,8 +151,8 @@ const TableDataCardV2: React.FC<TableDataCardPropsV2> = forwardRef<
onClick={() => { onClick={() => {
handleSummaryPanelDisplay && handleSummaryPanelDisplay(source, tab); handleSummaryPanelDisplay && handleSummaryPanelDisplay(source, tab);
}}> }}>
<Row> <Row wrap={false}>
<Col span={23}> <Col flex="auto">
<EntityHeader <EntityHeader
titleIsLink titleIsLink
breadcrumb={breadcrumbs} breadcrumb={breadcrumbs}
@ -163,11 +163,11 @@ const TableDataCardV2: React.FC<TableDataCardPropsV2> = forwardRef<
serviceName={source.serviceType ?? ''} serviceName={source.serviceType ?? ''}
/> />
</Col> </Col>
<Col className="d-flex justify-end" span={1}> {showCheckboxes && (
{showCheckboxes && ( <Col flex="20px">
<Checkbox checked={checked} className="m-l-auto" /> <Checkbox checked={checked} className="m-l-auto" />
)} </Col>
</Col> )}
</Row> </Row>
<div className="tw-pt-3"> <div className="tw-pt-3">

View File

@ -847,8 +847,8 @@ const DatabaseDetails: FunctionComponent = () => {
) : ( ) : (
<> <>
{database && ( {database && (
<Row className="p-x-xs"> <Row className="p-x-xs" wrap={false}>
<Col span={23}> <Col flex="auto">
<EntityHeader <EntityHeader
breadcrumb={slashedDatabaseName} breadcrumb={slashedDatabaseName}
entityData={database} entityData={database}
@ -862,7 +862,7 @@ const DatabaseDetails: FunctionComponent = () => {
serviceName={database.service.name ?? ''} serviceName={database.service.name ?? ''}
/> />
</Col> </Col>
<Col className="d-flex justify-end" span={1}> <Col flex="30px">
<ManageButton <ManageButton
isRecursiveDelete isRecursiveDelete
allowSoftDelete={false} allowSoftDelete={false}

View File

@ -1090,8 +1090,8 @@ const ServicePage: FunctionComponent = () => {
{servicePermission.ViewAll || servicePermission.ViewBasic ? ( {servicePermission.ViewAll || servicePermission.ViewBasic ? (
<Row data-testid="service-page"> <Row data-testid="service-page">
{serviceDetails && ( {serviceDetails && (
<Row className="w-full m-b-xs"> <Row className="w-full m-b-xs" wrap={false}>
<Col span={22}> <Col flex="auto">
<EntityHeader <EntityHeader
breadcrumb={slashedTableName} breadcrumb={slashedTableName}
entityData={serviceDetails} entityData={serviceDetails}
@ -1104,7 +1104,7 @@ const ServicePage: FunctionComponent = () => {
serviceName={serviceDetails.name} serviceName={serviceDetails.name}
/> />
</Col> </Col>
<Col className="d-flex justify-end" span={2}> <Col flex="80px">
{serviceDetails?.serviceType !== {serviceDetails?.serviceType !==
MetadataServiceType.OpenMetadata && ( MetadataServiceType.OpenMetadata && (
<Tooltip <Tooltip

View File

@ -786,12 +786,18 @@ const TagsPage = () => {
) : ( ) : (
<div className="full-height" data-testid="tags-container"> <div className="full-height" data-testid="tags-container">
{currentClassification && ( {currentClassification && (
<Space <Row data-testid="header" wrap={false}>
align="start" <Col flex="auto">
className="w-full justify-between"
data-testid="header">
<Space align="end">
<EntityHeaderTitle <EntityHeaderTitle
badge={
currentClassification.provider === ProviderType.System ? (
<AppBadge
className="m--t-xss"
icon={<LockIcon height={12} />}
label={capitalize(currentClassification.provider)}
/>
) : null
}
displayName={getEntityName(currentClassification)} displayName={getEntityName(currentClassification)}
icon={ icon={
<IconTag <IconTag
@ -802,15 +808,9 @@ const TagsPage = () => {
name={currentClassification.name} name={currentClassification.name}
serviceName="classification" serviceName="classification"
/> />
{currentClassification.provider === ProviderType.System && ( </Col>
<AppBadge
className="m--t-xss" <Col className="d-flex justify-end item-start" flex="270px">
icon={<LockIcon height={12} />}
label={capitalize(currentClassification.provider)}
/>
)}
</Space>
<div className="flex-center">
<Tooltip <Tooltip
title={ title={
!( !(
@ -881,8 +881,8 @@ const TagsPage = () => {
</Tooltip> </Tooltip>
</Dropdown> </Dropdown>
)} )}
</div> </Col>
</Space> </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">
<Description <Description

View File

@ -132,6 +132,12 @@
.w-max-13 { .w-max-13 {
max-width: 13rem; max-width: 13rem;
} }
.w-max-full-45 {
max-width: calc(100% - 45px);
}
.w-max-full-140 {
max-width: calc(100% - 140px);
}
.w-auto { .w-auto {
width: auto; width: auto;