Skip to content

Commit 71e82f5

Browse files
committed
Requested Changes Added
1 parent f74d8bd commit 71e82f5

File tree

6 files changed

+49
-26
lines changed

6 files changed

+49
-26
lines changed

frontend-config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"backendUrl": "http://localhost:3000",
33
"landscape": "LOCAL",
4-
"documentationBaseUrl": "http://localhost:3000"
4+
"documentationBaseUrl": "http://localhost:3000",
5+
"githubBaseUrl": "http://localhost:3000"
56
}

src/components/ControlPlane/MCPHealthPopoverButton.tsx

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default function MCPHealthPopoverButton({
4343
}
4444
};
4545

46-
const handleCopyStatusClick = () => {
46+
const constructGithubIssuesLink = () => {
4747
const clusterDetails = `${projectName}/${workspaceName}/${mcpName}`;
4848

4949
const statusDetails = mcpStatus?.conditions
@@ -61,17 +61,17 @@ export default function MCPHealthPopoverButton({
6161
: '';
6262

6363
const params = new URLSearchParams({
64-
template: t('MCPHealthPopoverButton.templateId'),
64+
template: '1-mcp_issue.yml',
6565
title: `[${clusterDetails}]: ${
6666
mcpStatus?.status === ReadyStatus.NotReady
6767
? t('MCPHealthPopoverButton.supportTicketTitle')
68-
: t('MCPHealthPopoverButton.supportTicketIssues')
68+
: t('MCPHealthPopoverButton.supportTicketTitleIssues')
6969
}`,
7070
'cluster-link': clusterDetails,
7171
'what-happened': statusDetails,
7272
});
7373

74-
window.open(`${links.COM_PAGE_SUPPORT_ISSUE}?${params}`, '_blank');
74+
return `${links.COM_PAGE_SUPPORT_GITHUB_ISSUE}?${params}`;
7575
};
7676

7777
const statusTableColumns: AnalyticalTableColumnDefinition[] = [
@@ -122,7 +122,7 @@ export default function MCPHealthPopoverButton({
122122
<StatusTable
123123
status={mcpStatus}
124124
tableColumns={statusTableColumns}
125-
onCopyClick={handleCopyStatusClick}
125+
githubIssuesLink={constructGithubIssuesLink()}
126126
/>
127127
}
128128
</Popover>
@@ -133,16 +133,18 @@ export default function MCPHealthPopoverButton({
133133
function StatusTable({
134134
status,
135135
tableColumns,
136-
onCopyClick,
136+
githubIssuesLink,
137137
}: {
138138
status: ControlPlaneStatusType | undefined;
139139
tableColumns: AnalyticalTableColumnDefinition[];
140-
onCopyClick: () => void;
140+
githubIssuesLink: string;
141141
}) {
142142
const showSupportButton =
143143
status?.status === ReadyStatus.NotReady ||
144144
status?.status === ReadyStatus.InDeletion;
145145

146+
const { t } = useTranslation();
147+
146148
return (
147149
<div style={{ width: 600 }}>
148150
<AnalyticalTable
@@ -159,7 +161,11 @@ function StatusTable({
159161
justifyContent={FlexBoxJustifyContent.End}
160162
style={{ marginTop: '0.5rem' }}
161163
>
162-
<Button onClick={onCopyClick}>Create Support Ticket</Button>
164+
<a href={githubIssuesLink} target="_blank" rel="noreferrer">
165+
<Button>
166+
{t('MCPHealthPopoverButton.createSupportTicketButton')}
167+
</Button>
168+
</a>
163169
</FlexBox>
164170
)}
165171
</div>

src/context/FrontendConfigContext.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ReactNode, createContext, use } from 'react';
2-
import { DocLinkCreator } from '../lib/shared/links';
2+
import { LinkCreator } from '../lib/shared/links';
33

44
export enum Landscape {
55
Live = 'LIVE',
@@ -13,28 +13,33 @@ interface FrontendConfigContextProps {
1313
backendUrl: string;
1414
landscape?: Landscape;
1515
documentationBaseUrl: string;
16-
links: DocLinkCreator;
16+
githubBaseUrl: string;
17+
links: LinkCreator;
1718
}
1819

19-
export const FrontendConfigContext = createContext<FrontendConfigContextProps | null>(
20-
null,
21-
);
22-
20+
export const FrontendConfigContext =
21+
createContext<FrontendConfigContextProps | null>(null);
2322

2423
const fetchPromise = fetch('/frontend-config.json').then((res) => res.json());
2524

2625
interface FrontendConfigProviderProps {
2726
children: ReactNode;
2827
}
2928

30-
export function FrontendConfigProvider({ children }: FrontendConfigProviderProps) {
29+
export function FrontendConfigProvider({
30+
children,
31+
}: FrontendConfigProviderProps) {
3132
const config = use(fetchPromise);
32-
const docLinks = new DocLinkCreator(config.documentationBaseUrl);
33+
const docLinks = new LinkCreator(
34+
config.documentationBaseUrl,
35+
config.githubBaseUrl,
36+
);
3337
const value: FrontendConfigContextProps = {
3438
links: docLinks,
3539
backendUrl: config.backendUrl,
3640
landscape: config.landscape,
3741
documentationBaseUrl: config.documentationBaseUrl,
42+
githubBaseUrl: config.githubBaseUrl,
3843
};
3944

4045
return (

src/lib/shared/links.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
1-
export class DocLinkCreator {
1+
export class LinkCreator {
22
private baseUrl: string;
3+
private githubBaseUrl: string;
34

4-
constructor(baseUrl: string) {
5+
constructor(baseUrl: string, githubBaseUrl: string) {
56
this.baseUrl = baseUrl;
7+
this.githubBaseUrl = githubBaseUrl;
68
}
79
private createLink(path: string) {
810
return `${this.baseUrl}${path}`;
911
}
1012

13+
private createGithubLink(path: string) {
14+
return `${this.githubBaseUrl}${path}`;
15+
}
16+
1117
public get COMMUNITY_PAGE(): string {
1218
return this.createLink('/');
1319
}
@@ -26,7 +32,7 @@ export class DocLinkCreator {
2632
'/docs/managed-control-planes/get-started/get-started-mcp#5-create-managedcontrolplane',
2733
);
2834
}
29-
public get COM_PAGE_SUPPORT_ISSUE(): string {
30-
return this.createLink('/support/issues/new');
35+
public get COM_PAGE_SUPPORT_GITHUB_ISSUE(): string {
36+
return this.createGithubLink('/support/issues/new');
3137
}
3238
}

src/utils/testing.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { DocLinkCreator } from '../lib/shared/links.ts';
1+
import { LinkCreator } from '../lib/shared/links.ts';
22
import { Landscape } from '../context/FrontendConfigContext.tsx';
33

4-
export const isInTestingMode: Boolean = !!window.Cypress;
4+
export const isInTestingMode: boolean = !!window.Cypress;
55
const documentationBaseUrl = 'http://localhost:3000';
66
export const mockedFrontendConfig = {
77
backendUrl: 'http://localhost:3000',
88
landscape: Landscape.Local,
99
documentationBaseUrl: 'http://localhost:3000',
10-
links: new DocLinkCreator(documentationBaseUrl),
11-
};
10+
links: new LinkCreator(documentationBaseUrl),
11+
};

src/views/ControlPlanes/ControlPlaneView.tsx

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

0 commit comments

Comments
 (0)