Skip to content

Commit 70b7d34

Browse files
fix: MCP Status - Tooltip and Table width change (#154)
1 parent 14e6dd3 commit 70b7d34

File tree

3 files changed

+67
-4
lines changed

3 files changed

+67
-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: 27 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,44 @@ 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+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
128+
Cell: (instance: any) => {
129+
return <TooltipCell>{instance.cell.value}</TooltipCell>;
130+
},
115131
},
116132
{
117133
Header: t('MCPHealthPopoverButton.transitionHeader'),
118134
accessor: 'lastTransitionTime',
135+
width: 110,
119136
// eslint-disable-next-line @typescript-eslint/no-explicit-any
120137
Cell: (instance: any) => {
121-
return <ReactTimeAgo date={new Date(instance.cell.value)} />;
138+
const rawDate = instance.cell.value;
139+
const date = new Date(rawDate);
140+
141+
return (
142+
<TooltipCell>
143+
<ReactTimeAgo date={date} />
144+
</TooltipCell>
145+
);
122146
},
123147
},
124148
];
@@ -155,9 +179,9 @@ function StatusTable({
155179
const { t } = useTranslation();
156180

157181
return (
158-
<div style={{ width: 600 }}>
182+
<div style={{ width: 770 }}>
159183
<AnalyticalTable
160-
scaleWidthMode="Smart"
184+
scaleWidthMode="Default"
161185
columns={tableColumns}
162186
data={
163187
status?.conditions?.sort((a, b) => {

src/components/Shared/TooltipCell.tsx

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)