Skip to content

Commit 03fa49c

Browse files
committed
Update MCPHealthPopoverButton.tsx
1 parent 4050434 commit 03fa49c

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

src/components/ControlPlane/MCPHealthPopoverButton.tsx

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,32 @@ import {
77
Button,
88
PopoverDomRef,
99
} from '@ui5/webcomponents-react';
10-
import { AnalyticalTableColumnDefinition, AnalyticalTableCell } from '@ui5/webcomponents-react/wrappers';
10+
import { AnalyticalTableColumnDefinition } from '@ui5/webcomponents-react/wrappers';
1111
import PopoverPlacement from '@ui5/webcomponents/dist/types/PopoverPlacement.js';
1212
import '@ui5/webcomponents-icons/dist/copy';
13-
import { JSX, useRef, useState, MouseEvent } from 'react';
14-
import { ControlPlaneStatusType, ReadyStatus, ControlPlaneCondition } from '../../lib/api/types/crate/controlPlanes';
13+
import { JSX, useRef, useState, MouseEvent, ReactNode } from 'react';
14+
import {
15+
ControlPlaneStatusType,
16+
ReadyStatus,
17+
ControlPlaneStatusCondition,
18+
} from '../../lib/api/types/crate/controlPlanes';
1519
import ReactTimeAgo from 'react-time-ago';
1620
import { AnimatedHoverTextButton } from '../Helper/AnimatedHoverTextButton.tsx';
1721
import { useTranslation } from 'react-i18next';
1822
import { useLink } from '../../lib/shared/useLink.ts';
1923
import TooltipCell from '../Shared/TooltipCell.tsx';
2024

25+
interface CellData<T> {
26+
cell: {
27+
value: ReactNode;
28+
};
29+
row: {
30+
original: T;
31+
[key: string]: unknown;
32+
};
33+
[key: string]: unknown;
34+
}
35+
2136
type MCPHealthPopoverButtonProps = {
2237
mcpStatus: ControlPlaneStatusType | undefined;
2338
projectName: string;
@@ -57,7 +72,7 @@ const MCPHealthPopoverButton = ({ mcpStatus, projectName, workspaceName, mcpName
5772
const statusDetails = mcpStatus?.conditions
5873
? `${t('MCPHealthPopoverButton.statusDetailsLabel')}: ${mcpStatus.status}\n\n${t('MCPHealthPopoverButton.detailsLabel')}\n` +
5974
mcpStatus.conditions
60-
.map((condition: ControlPlaneCondition) => {
75+
.map((condition: ControlPlaneStatusCondition) => {
6176
let text = `- ${condition.type}: ${condition.status}\n`;
6277
if (condition.reason) text += ` - ${t('MCPHealthPopoverButton.reasonHeader')}: ${condition.reason}\n`;
6378
if (condition.message) text += ` - ${t('MCPHealthPopoverButton.messageHeader')}: ${condition.message}\n`;
@@ -81,7 +96,7 @@ const MCPHealthPopoverButton = ({ mcpStatus, projectName, workspaceName, mcpName
8196
Header: t('MCPHealthPopoverButton.statusHeader'),
8297
accessor: 'status',
8398
width: 50,
84-
Cell: (instance: AnalyticalTableCell<ControlPlaneCondition>) => {
99+
Cell: (instance: CellData<ControlPlaneStatusCondition>) => {
85100
const isReady = instance.cell.value === 'True';
86101
return (
87102
<Icon
@@ -95,33 +110,33 @@ const MCPHealthPopoverButton = ({ mcpStatus, projectName, workspaceName, mcpName
95110
Header: t('MCPHealthPopoverButton.typeHeader'),
96111
accessor: 'type',
97112
width: 150,
98-
Cell: (instance: AnalyticalTableCell<ControlPlaneCondition>) => {
113+
Cell: (instance: CellData<ControlPlaneStatusCondition>) => {
99114
return <TooltipCell>{instance.cell.value}</TooltipCell>;
100115
},
101116
},
102117
{
103118
Header: t('MCPHealthPopoverButton.messageHeader'),
104119
accessor: 'message',
105120
width: 350,
106-
Cell: (instance: AnalyticalTableCell<ControlPlaneCondition>) => {
121+
Cell: (instance: CellData<ControlPlaneStatusCondition>) => {
107122
return <TooltipCell>{instance.cell.value}</TooltipCell>;
108123
},
109124
},
110125
{
111126
Header: t('MCPHealthPopoverButton.reasonHeader'),
112127
accessor: 'reason',
113128
width: 100,
114-
Cell: (instance: AnalyticalTableCell<ControlPlaneCondition>) => {
129+
Cell: (instance: CellData<ControlPlaneStatusCondition>) => {
115130
return <TooltipCell>{instance.cell.value}</TooltipCell>;
116131
},
117132
},
118133
{
119134
Header: t('MCPHealthPopoverButton.transitionHeader'),
120135
accessor: 'lastTransitionTime',
121136
width: 110,
122-
Cell: (instance: AnalyticalTableCell<ControlPlaneCondition>) => {
137+
Cell: (instance: CellData<ControlPlaneStatusCondition>) => {
123138
const rawDate = instance.cell.value;
124-
const date = new Date(rawDate);
139+
const date = new Date(rawDate as string);
125140
return (
126141
<TooltipCell>
127142
<ReactTimeAgo date={date} />

0 commit comments

Comments
 (0)