Skip to content

Commit d23dbe4

Browse files
committed
Feat: Support button for MCP github issues with info dump
1 parent 41594f4 commit d23dbe4

File tree

5 files changed

+88
-7
lines changed

5 files changed

+88
-7
lines changed

frontend-config.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"backendUrl": "http://localhost:3000",
33
"landscape": "LOCAL",
4-
"documentationBaseUrl": "http://localhost:3000"
5-
}
4+
"documentationBaseUrl": "https://github.tools.sap/openmcp"
5+
}

public/locales/en.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,15 @@
5555
"typeHeader": "Type",
5656
"messageHeader": "Message",
5757
"reasonHeader": "Reason",
58-
"transitionHeader": "Last transition time"
58+
"transitionHeader": "Last transition time",
59+
"createSupportTicketButton": "Create Support Ticket",
60+
"templateId": "1-mcp_issue.yml",
61+
"supportTicketTitle": "Control Plane Not Ready",
62+
"supportTicketTitleIssues": "Issues with Control Plane",
63+
"clusterIdentifierLabel": "cluster-link",
64+
"whatHappenedLabel": "what-happened",
65+
"statusDetailsLabel": "MCP Status",
66+
"detailsLabel": "Details:"
5967
},
6068
"CopyKubeconfigButton": {
6169
"copiedMessage": "Copied to Clipboard",

src/components/ControlPlane/MCPHealthPopoverButton.tsx

Lines changed: 68 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

@@ -29,6 +43,37 @@ export default function MCPHealthPopoverButton({
2943
}
3044
};
3145

46+
const handleCopyStatusClick = () => {
47+
const clusterDetails = `${projectName}/${workspaceName}/${mcpName}`;
48+
49+
const statusDetails = mcpStatus?.conditions
50+
? `${t('MCPHealthPopoverButton.statusDetailsLabel')}: ${mcpStatus.status}\n\n${t('MCPHealthPopoverButton.detailsLabel')}\n` +
51+
mcpStatus.conditions
52+
.map((condition) => {
53+
let text = `- ${condition.type}: ${condition.status}\n`;
54+
if (condition.reason)
55+
text += ` - ${t('MCPHealthPopoverButton.reasonHeader')}: ${condition.reason}\n`;
56+
if (condition.message)
57+
text += ` - ${t('MCPHealthPopoverButton.messageHeader')}: ${condition.message}\n`;
58+
return text;
59+
})
60+
.join('')
61+
: '';
62+
63+
const params = new URLSearchParams({
64+
template: t('MCPHealthPopoverButton.templateId'),
65+
title: `[${clusterDetails}]: ${
66+
mcpStatus?.status === ReadyStatus.NotReady
67+
? t('MCPHealthPopoverButton.supportTicketTitle')
68+
: t('MCPHealthPopoverButton.supportTicketIssues')
69+
}`,
70+
'cluster-link': clusterDetails,
71+
'what-happened': statusDetails,
72+
});
73+
74+
window.open(`${links.COM_PAGE_SUPPORT_ISSUE}?${params}`, '_blank');
75+
};
76+
3277
const statusTableColumns: AnalyticalTableColumnDefinition[] = [
3378
{
3479
Header: t('MCPHealthPopoverButton.statusHeader'),
@@ -73,7 +118,13 @@ export default function MCPHealthPopoverButton({
73118
onClick={handleOpenerClick}
74119
/>
75120
<Popover ref={popoverRef} open={open} placement={PopoverPlacement.Bottom}>
76-
{<StatusTable status={mcpStatus} tableColumns={statusTableColumns} />}
121+
{
122+
<StatusTable
123+
status={mcpStatus}
124+
tableColumns={statusTableColumns}
125+
onCopyClick={handleCopyStatusClick}
126+
/>
127+
}
77128
</Popover>
78129
</div>
79130
);
@@ -82,10 +133,16 @@ export default function MCPHealthPopoverButton({
82133
function StatusTable({
83134
status,
84135
tableColumns,
136+
onCopyClick,
85137
}: {
86138
status: ControlPlaneStatusType | undefined;
87139
tableColumns: AnalyticalTableColumnDefinition[];
140+
onCopyClick: () => void;
88141
}) {
142+
const showSupportButton =
143+
status?.status === ReadyStatus.NotReady ||
144+
status?.status === ReadyStatus.InDeletion;
145+
89146
return (
90147
<div style={{ width: 600 }}>
91148
<AnalyticalTable
@@ -97,6 +154,14 @@ function StatusTable({
97154
}) ?? []
98155
}
99156
/>
157+
{showSupportButton && (
158+
<FlexBox
159+
justifyContent={FlexBoxJustifyContent.End}
160+
style={{ marginTop: '0.5rem' }}
161+
>
162+
<Button onClick={onCopyClick}>Create Support Ticket</Button>
163+
</FlexBox>
164+
)}
100165
</div>
101166
);
102167
}

src/components/ControlPlanes/ControlPlaneCard.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,12 @@ export function ControlPlaneCard({
8383
alignItems="Center"
8484
style={{ paddingTop: '20px' }}
8585
>
86-
<MCPHealthPopoverButton mcpStatus={controlPlane.status} />
86+
<MCPHealthPopoverButton
87+
mcpStatus={controlPlane.status}
88+
projectName={projectName}
89+
workspaceName={workspace.metadata.name ?? ''}
90+
mcpName={controlPlane.metadata.name}
91+
/>
8792
<ConnectButton
8893
disabled={controlPlane.status?.status !== ReadyStatus.Ready}
8994
controlPlaneName={name}

src/lib/shared/links.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,7 @@ export class DocLinkCreator {
2626
'/docs/managed-control-planes/get-started/get-started-mcp#5-create-managedcontrolplane',
2727
);
2828
}
29+
public get COM_PAGE_SUPPORT_ISSUE(): string {
30+
return this.createLink('/support/issues/new');
31+
}
2932
}

0 commit comments

Comments
 (0)