Skip to content

Commit 8437bc6

Browse files
authored
Long text handling (MarquezProject#2942)
* Deferred copy revert. Signed-off-by: phixMe <[email protected]> * Long text handling. Signed-off-by: phixMe <[email protected]> * Adding search back in. Signed-off-by: phixMe <[email protected]> --------- Signed-off-by: phixMe <[email protected]>
1 parent 1659d20 commit 8437bc6

File tree

5 files changed

+25
-11
lines changed

5 files changed

+25
-11
lines changed

web/src/components/datasets/DatasetVersions.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { formatUpdatedAt } from '../../helpers'
2323
import { useTheme } from '@emotion/react'
2424
import DatasetInfo from './DatasetInfo'
2525
import IconButton from '@mui/material/IconButton'
26+
import MQTooltip from '../core/tooltip/MQTooltip'
2627
import MqCopy from '../core/copy/MqCopy'
2728
import MqPaging from '../paging/MqPaging'
2829
import MqText from '../core/text/MqText'
@@ -144,7 +145,9 @@ const DatasetVersions: FunctionComponent<DatasetVersionsProps & DispatchProps> =
144145
>
145146
<TableCell align='left'>
146147
<Box display={'flex'} alignItems={'center'}>
147-
{version.version.substring(0, 8)}...
148+
<MQTooltip title={version.version}>
149+
<MqText font={'mono'}>{version.version.substring(0, 8)}...</MqText>
150+
</MQTooltip>
148151
<MqCopy string={version.version} />
149152
</Box>
150153
</TableCell>
@@ -154,7 +157,7 @@ const DatasetVersions: FunctionComponent<DatasetVersionsProps & DispatchProps> =
154157
<Box display={'flex'} alignItems={'center'}>
155158
{version.createdByRun ? (
156159
<>
157-
{version.createdByRun.id.substring(0, 8)}...
160+
<MqText font={'mono'}>{version.createdByRun.id.substring(0, 8)}...</MqText>
158161
<MqCopy string={version.createdByRun.id} />
159162
</>
160163
) : (

web/src/helpers/text.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ export const truncateText = (text: string, maxLength: number) => {
55
return text
66
}
77

8+
export const truncateTextFront = (text: string, maxLength: number) => {
9+
if (text.length > maxLength) {
10+
return `...${text.substring(text.length - maxLength)}`
11+
}
12+
return text
13+
}
14+
815
export const pluralize = (count: number, singular: string, plural: string) => {
916
const noun = count === 1 ? singular : plural
1017
return `${count} ${noun}`

web/src/routes/dashboard/JobRunItem.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,13 @@ const JobRunItem: React.FC<Props> = ({ job }) => {
4545
>
4646
<Box display={'flex'} alignItems={'center'} justifyContent={'space-between'} mb={1}>
4747
<Box display={'flex'} alignItems={'center'}>
48-
<MqText bold font='mono' sx={{ mr: 2 }}>
49-
{truncateText(job.name, 40)}
50-
</MqText>
48+
<MQTooltip title={job.name} placement={'top'}>
49+
<Box>
50+
<MqText bold font='mono' sx={{ mr: 2 }}>
51+
{truncateText(job.name, 75)}
52+
</MqText>
53+
</Box>
54+
</MQTooltip>
5155
{job.tags.slice(0, 3).map((tag, index) => (
5256
<Chip key={index} sx={{ mr: 1 }} size={'small'} label={tag} />
5357
))}

web/src/routes/table-level/TableLineageDatasetNode.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { datasetFacetsQualityAssertions, datasetFacetsStatus } from '../../helpe
1515
import { faDatabase } from '@fortawesome/free-solid-svg-icons/faDatabase'
1616
import { fetchDataset, resetDataset } from '../../store/actionCreators'
1717
import { formatUpdatedAt } from '../../helpers'
18-
import { truncateText } from '../../helpers/text'
18+
import { truncateText, truncateTextFront } from '../../helpers/text'
1919
import { useNavigate, useParams, useSearchParams } from 'react-router-dom'
2020
import Box from '@mui/system/Box'
2121
import IconButton from '@mui/material/IconButton'
@@ -72,15 +72,15 @@ const TableLineageDatasetNode = ({
7272
Namespace:
7373
</MqText>
7474
<MqText block font={'mono'}>
75-
{truncateText(lineageDataset.namespace, 40)}
75+
{truncateTextFront(lineageDataset.namespace, 40)}
7676
</MqText>
7777
</Box>
7878
<Box display={'flex'} justifyContent={'space-between'}>
7979
<MqText block bold sx={{ mr: 6 }}>
8080
Name:
8181
</MqText>
8282
<MqText block font={'mono'}>
83-
{truncateText(lineageDataset.name, 40)}
83+
{truncateTextFront(lineageDataset.name, 40)}
8484
</MqText>
8585
</Box>
8686
{lineageDataset.description && (

web/src/routes/table-level/TableLineageJobNode.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { faCog } from '@fortawesome/free-solid-svg-icons/faCog'
1010
import { formatUpdatedAt } from '../../helpers'
1111
import { runStateColor } from '../../helpers/nodes'
1212
import { theme } from '../../helpers/theme'
13-
import { truncateText } from '../../helpers/text'
13+
import { truncateText, truncateTextFront } from '../../helpers/text'
1414
import { useNavigate, useParams } from 'react-router-dom'
1515
import Box from '@mui/system/Box'
1616
import MQTooltip from '../../components/core/tooltip/MQTooltip'
@@ -49,15 +49,15 @@ const TableLineageJobNode = ({ node }: TableLineageJobNodeProps & StateProps) =>
4949
Namespace:
5050
</MqText>
5151
<MqText block font={'mono'}>
52-
{truncateText(job.namespace, 40)}
52+
{truncateTextFront(job.namespace, 40)}
5353
</MqText>
5454
</Box>
5555
<Box display={'flex'} justifyContent={'space-between'}>
5656
<MqText block bold sx={{ mr: 6 }}>
5757
Name:
5858
</MqText>
5959
<MqText block font={'mono'}>
60-
{truncateText(job.name, 40)}
60+
{truncateTextFront(job.name, 40)}
6161
</MqText>
6262
</Box>
6363
{job.description && (

0 commit comments

Comments
 (0)