Skip to content

Commit 998c017

Browse files
committed
Merge branch 'main' into refactor/rework-doclinkcreator-class
2 parents ce67582 + 3d5a974 commit 998c017

File tree

8 files changed

+106
-16
lines changed

8 files changed

+106
-16
lines changed

frontend-config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
"issuerUrl": "issuer-url",
99
"scopes": []
1010
}
11-
}
11+
}

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"@types/js-yaml": "^4.0.9",
5454
"@types/node": "^22.13.5",
5555
"@types/react": "^19.0.10",
56-
"@types/react-dom": "19.1.2",
56+
"@types/react-dom": "19.1.3",
5757
"@types/react-syntax-highlighter": "^15.5.13",
5858
"@ui5/webcomponents-cypress-commands": "^2.7.2",
5959
"@vitejs/plugin-react": "^4.3.4",

public/locales/en.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,14 @@
6262
"typeHeader": "Type",
6363
"messageHeader": "Message",
6464
"reasonHeader": "Reason",
65-
"transitionHeader": "Last transition time"
65+
"transitionHeader": "Last transition time",
66+
"createSupportTicketButton": "Create Support Ticket",
67+
"supportTicketTitleReady": "MCP Ready",
68+
"supportTicketTitleNotReady": "MCP Not Ready",
69+
"supportTicketTitleDeletion": "MCP in Deletion",
70+
"supportTicketTitleIssues": "Issues with Control Plane",
71+
"statusDetailsLabel": "MCP Status",
72+
"detailsLabel": "Details:"
6673
},
6774
"CopyKubeconfigButton": {
6875
"copiedMessage": "Copied to Clipboard",

src/components/ControlPlane/MCPHealthPopoverButton.tsx

Lines changed: 77 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
import { AnalyticalTable, Icon, Popover } from '@ui5/webcomponents-react';
1+
import {
2+
AnalyticalTable,
3+
Icon,
4+
Popover,
5+
FlexBox,
6+
FlexBoxJustifyContent,
7+
Button,
8+
} from '@ui5/webcomponents-react';
29
import { AnalyticalTableColumnDefinition } from '@ui5/webcomponents-react/wrappers';
310
import PopoverPlacement from '@ui5/webcomponents/dist/types/PopoverPlacement.js';
411
import '@ui5/webcomponents-icons/dist/copy';
@@ -10,14 +17,21 @@ import {
1017
import ReactTimeAgo from 'react-time-ago';
1118
import { AnimatedHoverTextButton } from '../Helper/AnimatedHoverTextButton.tsx';
1219
import { useTranslation } from 'react-i18next';
13-
20+
import { useFrontendConfig } from '../../context/FrontendConfigContext.tsx';
1421
export default function MCPHealthPopoverButton({
1522
mcpStatus,
23+
projectName,
24+
workspaceName,
25+
mcpName,
1626
}: {
1727
mcpStatus: ControlPlaneStatusType | undefined;
28+
projectName: string;
29+
workspaceName: string;
30+
mcpName: string;
1831
}) {
1932
const popoverRef = useRef(null);
2033
const [open, setOpen] = useState(false);
34+
const { links } = useFrontendConfig();
2135

2236
const { t } = useTranslation();
2337

@@ -31,6 +45,46 @@ export default function MCPHealthPopoverButton({
3145
}
3246
};
3347

48+
const getTicketTitle = () => {
49+
switch (mcpStatus?.status) {
50+
case ReadyStatus.Ready:
51+
return t('MCPHealthPopoverButton.supportTicketTitleReady');
52+
case ReadyStatus.NotReady:
53+
return t('MCPHealthPopoverButton.supportTicketTitleNotReady');
54+
case ReadyStatus.InDeletion:
55+
return t('MCPHealthPopoverButton.supportTicketTitleDeletion');
56+
default:
57+
return t('MCPHealthPopoverButton.supportTicketTitleIssues');
58+
}
59+
};
60+
61+
const constructGithubIssuesLink = () => {
62+
const clusterDetails = `${projectName}/${workspaceName}/${mcpName}`;
63+
64+
const statusDetails = mcpStatus?.conditions
65+
? `${t('MCPHealthPopoverButton.statusDetailsLabel')}: ${mcpStatus.status}\n\n${t('MCPHealthPopoverButton.detailsLabel')}\n` +
66+
mcpStatus.conditions
67+
.map((condition) => {
68+
let text = `- ${condition.type}: ${condition.status}\n`;
69+
if (condition.reason)
70+
text += ` - ${t('MCPHealthPopoverButton.reasonHeader')}: ${condition.reason}\n`;
71+
if (condition.message)
72+
text += ` - ${t('MCPHealthPopoverButton.messageHeader')}: ${condition.message}\n`;
73+
return text;
74+
})
75+
.join('')
76+
: '';
77+
78+
const params = new URLSearchParams({
79+
template: '1-mcp_issue.yml',
80+
title: `[${clusterDetails}]: ${getTicketTitle()}`,
81+
'cluster-link': clusterDetails,
82+
'what-happened': statusDetails,
83+
});
84+
85+
return `${links.COM_PAGE_SUPPORT_GITHUB_ISSUE}?${params}`;
86+
};
87+
3488
const statusTableColumns: AnalyticalTableColumnDefinition[] = [
3589
{
3690
Header: t('MCPHealthPopoverButton.statusHeader'),
@@ -77,7 +131,13 @@ export default function MCPHealthPopoverButton({
77131
onClick={handleOpenerClick}
78132
/>
79133
<Popover ref={popoverRef} open={open} placement={PopoverPlacement.Bottom}>
80-
{<StatusTable status={mcpStatus} tableColumns={statusTableColumns} />}
134+
{
135+
<StatusTable
136+
status={mcpStatus}
137+
tableColumns={statusTableColumns}
138+
githubIssuesLink={constructGithubIssuesLink()}
139+
/>
140+
}
81141
</Popover>
82142
</div>
83143
);
@@ -86,10 +146,14 @@ export default function MCPHealthPopoverButton({
86146
function StatusTable({
87147
status,
88148
tableColumns,
149+
githubIssuesLink,
89150
}: {
90151
status: ControlPlaneStatusType | undefined;
91152
tableColumns: AnalyticalTableColumnDefinition[];
153+
githubIssuesLink: string;
92154
}) {
155+
const { t } = useTranslation();
156+
93157
return (
94158
<div style={{ width: 600 }}>
95159
<AnalyticalTable
@@ -101,6 +165,16 @@ function StatusTable({
101165
}) ?? []
102166
}
103167
/>
168+
<FlexBox
169+
justifyContent={FlexBoxJustifyContent.End}
170+
style={{ marginTop: '0.5rem' }}
171+
>
172+
<a href={githubIssuesLink} target="_blank" rel="noreferrer">
173+
<Button>
174+
{t('MCPHealthPopoverButton.createSupportTicketButton')}
175+
</Button>
176+
</a>
177+
</FlexBox>
104178
</div>
105179
);
106180
}

src/components/ControlPlanes/ControlPlaneCard/ControlPlaneCard.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,12 @@ export function ControlPlaneCard({
8787
alignItems="Center"
8888
className={styles.row}
8989
>
90-
<MCPHealthPopoverButton mcpStatus={controlPlane.status} />
90+
<MCPHealthPopoverButton
91+
mcpStatus={controlPlane.status}
92+
projectName={projectName}
93+
workspaceName={workspace.metadata.name ?? ''}
94+
mcpName={controlPlane.metadata.name}
95+
/>
9196
<FlexBox
9297
direction="Row"
9398
justifyContent="SpaceBetween"

src/context/FrontendConfigContext.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export function FrontendConfigProvider({
2323
children,
2424
}: FrontendConfigProviderProps) {
2525
const config = use(fetchPromise);
26-
2726
return (
2827
<FrontendConfigContext.Provider value={config}>
2928
{children}

src/views/ControlPlanes/ControlPlaneView.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,12 @@ export default function ControlPlaneView() {
8181
justifyContent: 'space-between',
8282
}}
8383
>
84-
<MCPHealthPopoverButton mcpStatus={mcp?.status} />
84+
<MCPHealthPopoverButton
85+
mcpStatus={mcp?.status}
86+
projectName={projectName}
87+
workspaceName={workspaceName ?? ''}
88+
mcpName={controlPlaneName}
89+
/>
8590

8691
<CopyKubeconfigButton />
8792
</div>

0 commit comments

Comments
 (0)