Skip to content

Commit d24efe6

Browse files
authored
Render mouseover tooltip for the new tables (#1454)
* Render mouseover tooltip for the new tables * Refactor WfoDataCell * Added tooltips to WFO list components * Renamed prop to tooltipContent * Added changeset * Replace description with resource type name * Show tooltip for all columns that are strings, refactoring, removed title from icons that showed default tooltip
1 parent c9810f0 commit d24efe6

File tree

18 files changed

+118
-22
lines changed

18 files changed

+118
-22
lines changed

.changeset/tender-cats-camp.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@orchestrator-ui/orchestrator-ui-components': minor
3+
---
4+
5+
1381 Render mouseover tooltip for the new tables

packages/orchestrator-ui-components/src/components/WfoBadges/WfoBadge/WfoBadge.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const WfoBadge: FC<WfoBadgeProps> = ({
1818
...restProps
1919
}) => (
2020
<EuiBadge {...restProps}>
21-
<EuiText color={textColor} size={size ?? 'xs'}>
21+
<EuiText title="" color={textColor} size={size ?? 'xs'}>
2222
<b>{children}</b>
2323
</EuiText>
2424
</EuiBadge>
Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
import React, { FC } from 'react';
22

3-
import {
4-
getDate,
5-
parseDateOrTimeRelativeToToday,
6-
parseDateToLocaleDateTimeString,
7-
} from '@/utils';
3+
import { getDate, parseDateOrTimeRelativeToToday } from '@/utils';
84

95
export type WfoDateTimeProps = {
106
dateOrIsoString: Date | string | null;
@@ -13,9 +9,5 @@ export type WfoDateTimeProps = {
139
export const WfoDateTime: FC<WfoDateTimeProps> = ({ dateOrIsoString }) => {
1410
const date = getDate(dateOrIsoString);
1511

16-
return (
17-
<span title={parseDateToLocaleDateTimeString(date)}>
18-
{parseDateOrTimeRelativeToToday(date)}
19-
</span>
20-
);
12+
return <span>{parseDateOrTimeRelativeToToday(date)}</span>;
2113
};

packages/orchestrator-ui-components/src/components/WfoProcessList/WfoProcessesList.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ export const WfoProcessesList = ({
113113
columnType: ColumnType.DATA,
114114
label: t('step'),
115115
width: '15%',
116+
renderTooltip: (value) => value,
116117
},
117118
lastStatus: {
118119
columnType: ColumnType.DATA,
@@ -184,6 +185,7 @@ export const WfoProcessesList = ({
184185
width: '90',
185186
renderData: (value) => <WfoFirstPartUUID UUID={value} />,
186187
renderDetails: (value) => value,
188+
renderTooltip: (value) => value,
187189
},
188190
startedAt: {
189191
columnType: ColumnType.DATA,
@@ -192,6 +194,7 @@ export const WfoProcessesList = ({
192194
renderData: (value) => <WfoDateTime dateOrIsoString={value} />,
193195
renderDetails: parseDateToLocaleDateTimeString,
194196
clipboardText: parseDateToLocaleDateTimeString,
197+
renderTooltip: (value) => value.toString(),
195198
},
196199
lastModifiedAt: {
197200
columnType: ColumnType.DATA,
@@ -200,6 +203,7 @@ export const WfoProcessesList = ({
200203
renderData: (value) => <WfoDateTime dateOrIsoString={value} />,
201204
renderDetails: parseDateToLocaleDateTimeString,
202205
clipboardText: parseDateToLocaleDateTimeString,
206+
renderTooltip: (value) => value.toString(),
203207
},
204208
};
205209

packages/orchestrator-ui-components/src/components/WfoSubscription/WfoRelatedSubscriptions.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ export const WfoRelatedSubscriptions = ({
101101
columnType: ColumnType.DATA,
102102
label: t('id'),
103103
renderData: (value) => <WfoFirstPartUUID UUID={value} />,
104+
renderTooltip: (value) => value,
104105
},
105106
description: {
106107
columnType: ColumnType.DATA,
@@ -129,6 +130,7 @@ export const WfoRelatedSubscriptions = ({
129130
customerFullname: {
130131
columnType: ColumnType.DATA,
131132
label: t('customer'),
133+
renderTooltip: (value) => value,
132134
},
133135
tag: {
134136
columnType: ColumnType.DATA,
@@ -139,6 +141,7 @@ export const WfoRelatedSubscriptions = ({
139141
columnType: ColumnType.DATA,
140142
label: t('startDate'),
141143
renderData: parseDateToLocaleDateString,
144+
renderTooltip: parseDateToLocaleDateString,
142145
},
143146
};
144147

packages/orchestrator-ui-components/src/components/WfoSubscriptionsList/WfoSubscriptionsList.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ export const WfoSubscriptionsList: FC<WfoSubscriptionsListProps> = ({
8282
label: t('id'),
8383
renderData: (value) => <WfoFirstPartUUID UUID={value} />,
8484
renderDetails: (value) => value,
85+
renderTooltip: (value) => value,
8586
},
8687
description: {
8788
columnType: ColumnType.DATA,
@@ -130,13 +131,15 @@ export const WfoSubscriptionsList: FC<WfoSubscriptionsListProps> = ({
130131
renderData: (value) => <WfoDateTime dateOrIsoString={value} />,
131132
renderDetails: parseDateToLocaleDateTimeString,
132133
clipboardText: parseDateToLocaleDateTimeString,
134+
renderTooltip: (cellValue) => cellValue?.toString(),
133135
},
134136
endDate: {
135137
columnType: ColumnType.DATA,
136138
label: t('endDate'),
137139
renderData: (value) => <WfoDateTime dateOrIsoString={value} />,
138140
renderDetails: parseDateToLocaleDateTimeString,
139141
clipboardText: parseDateToLocaleDateTimeString,
142+
renderTooltip: (cellValue) => cellValue?.toString(),
140143
},
141144
note: {
142145
columnType: ColumnType.DATA,

packages/orchestrator-ui-components/src/components/WfoTable/WfoFirstPartUUID/WfoFirstPartUUID.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,5 @@ export type WfoFirstUUIDPartProps = {
1212
export const WfoFirstPartUUID: FC<WfoFirstUUIDPartProps> = ({ UUID }) => {
1313
const { uuidFieldStyle } = useWithOrchestratorTheme(getStyles);
1414

15-
return (
16-
<span css={uuidFieldStyle} title={UUID}>
17-
{getFirstUuidPart(UUID)}
18-
</span>
19-
);
15+
return <span css={uuidFieldStyle}>{getFirstUuidPart(UUID)}</span>;
2016
};
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import React, { FC, ReactNode } from 'react';
2+
3+
import { EuiToolTip } from '@elastic/eui';
4+
5+
interface WfoDataCellProps {
6+
customTooltip: ReactNode;
7+
children: ReactNode;
8+
}
9+
10+
export const WfoDataCell: FC<WfoDataCellProps> = ({
11+
customTooltip,
12+
children,
13+
}) => {
14+
const tooltipContent =
15+
customTooltip || (typeof children === 'string' ? children : <></>);
16+
17+
if (tooltipContent) {
18+
return (
19+
<EuiToolTip
20+
position="bottom"
21+
delay="long"
22+
content={tooltipContent}
23+
css={{ maxWidth: 'fit-content' }}
24+
repositionOnScroll
25+
>
26+
<>{children}</>
27+
</EuiToolTip>
28+
);
29+
}
30+
return <>{children}</>;
31+
};

packages/orchestrator-ui-components/src/components/WfoTable/WfoTable/WfoTable.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export type WfoTableDataColumnConfigItem<
4646
isSortable?: boolean;
4747
isFilterable?: boolean;
4848
renderData?: (cellValue: T[Property], row: T) => ReactNode;
49+
renderTooltip?: (cellValue: T[Property], row: T) => ReactNode;
4950
};
5051

5152
export type WfoTableControlColumnConfigItem<T extends object> =

packages/orchestrator-ui-components/src/components/WfoTable/WfoTable/WfoTableDataRows.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, { Fragment } from 'react';
22

3+
import { WfoDataCell } from '@/components';
34
import { useWithOrchestratorTheme } from '@/hooks';
45
import { toOptionalArrayEntry } from '@/utils';
56

@@ -91,10 +92,17 @@ export const WfoTableDataRows = <T extends object>({
9192
]}
9293
>
9394
<div>
94-
{columnConfig.renderData?.(
95-
result,
96-
row,
97-
) ?? result?.toString()}
95+
<WfoDataCell
96+
customTooltip={columnConfig.renderTooltip?.(
97+
result,
98+
row,
99+
)}
100+
>
101+
{columnConfig.renderData?.(
102+
result,
103+
row,
104+
) ?? result?.toString()}
105+
</WfoDataCell>
98106
</div>
99107
</td>
100108
);

0 commit comments

Comments
 (0)