Skip to content

Commit ea02736

Browse files
Tooltip and width of the table
1 parent 14e6dd3 commit ea02736

File tree

3 files changed

+68
-4
lines changed

3 files changed

+68
-4
lines changed

public/locales/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
"typeHeader": "Type",
6666
"messageHeader": "Message",
6767
"reasonHeader": "Reason",
68-
"transitionHeader": "Last transition time",
68+
"transitionHeader": "Last change",
6969
"createSupportTicketButton": "Create Support Ticket",
7070
"supportTicketTitleReady": "MCP Ready",
7171
"supportTicketTitleNotReady": "MCP Not Ready",

src/components/ControlPlane/MCPHealthPopoverButton.tsx

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import ReactTimeAgo from 'react-time-ago';
1818
import { AnimatedHoverTextButton } from '../Helper/AnimatedHoverTextButton.tsx';
1919
import { useTranslation } from 'react-i18next';
2020
import { useLink } from '../../lib/shared/useLink.ts';
21+
import TooltipCell from '../Shared/TooltipCell.tsx';
2122
export default function MCPHealthPopoverButton({
2223
mcpStatus,
2324
projectName,
@@ -104,21 +105,45 @@ export default function MCPHealthPopoverButton({
104105
{
105106
Header: t('MCPHealthPopoverButton.typeHeader'),
106107
accessor: 'type',
108+
width: 150,
109+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
110+
Cell: (instance: any) => {
111+
return <TooltipCell>{instance.cell.value}</TooltipCell>;
112+
},
107113
},
108114
{
109115
Header: t('MCPHealthPopoverButton.messageHeader'),
110116
accessor: 'message',
117+
width: 350,
118+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
119+
Cell: (instance: any) => {
120+
return <TooltipCell>{instance.cell.value}</TooltipCell>;
121+
},
111122
},
112123
{
113124
Header: t('MCPHealthPopoverButton.reasonHeader'),
114125
accessor: 'reason',
126+
width: 100,
127+
headerTooltip: 'sgs',
128+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
129+
Cell: (instance: any) => {
130+
return <TooltipCell>{instance.cell.value}</TooltipCell>;
131+
},
115132
},
116133
{
117134
Header: t('MCPHealthPopoverButton.transitionHeader'),
118135
accessor: 'lastTransitionTime',
136+
width: 110,
119137
// eslint-disable-next-line @typescript-eslint/no-explicit-any
120138
Cell: (instance: any) => {
121-
return <ReactTimeAgo date={new Date(instance.cell.value)} />;
139+
const rawDate = instance.cell.value;
140+
const date = new Date(rawDate);
141+
142+
return (
143+
<TooltipCell>
144+
<ReactTimeAgo date={date} />
145+
</TooltipCell>
146+
);
122147
},
123148
},
124149
];
@@ -155,9 +180,9 @@ function StatusTable({
155180
const { t } = useTranslation();
156181

157182
return (
158-
<div style={{ width: 600 }}>
183+
<div style={{ width: 760 }}>
159184
<AnalyticalTable
160-
scaleWidthMode="Smart"
185+
scaleWidthMode="Default"
161186
columns={tableColumns}
162187
data={
163188
status?.conditions?.sort((a, b) => {
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import React from 'react';
2+
3+
interface TooltipCellProps {
4+
children: React.ReactNode;
5+
title?: string;
6+
}
7+
8+
const TooltipCell: React.FC<TooltipCellProps> = ({ children, title }) => {
9+
const resolvedTitle =
10+
typeof children === 'string' || typeof children === 'number'
11+
? String(children)
12+
: title;
13+
14+
return (
15+
<div
16+
title={resolvedTitle}
17+
style={{
18+
display: 'flex',
19+
alignItems: 'center',
20+
height: '100%',
21+
width: '100%',
22+
overflow: 'hidden',
23+
}}
24+
>
25+
<span
26+
style={{
27+
whiteSpace: 'nowrap',
28+
overflow: 'hidden',
29+
textOverflow: 'ellipsis',
30+
width: '100%',
31+
}}
32+
>
33+
{children}
34+
</span>
35+
</div>
36+
);
37+
};
38+
39+
export default TooltipCell;

0 commit comments

Comments
 (0)