Skip to content

Commit 83cc4ac

Browse files
authored
feat: Link to the release of the currently deployed version in kyma-dashboard version (#3644)
* feat: add link to kyma dashboard version * use githubLink * add blank
1 parent 0190862 commit 83cc4ac

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/header/Header.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,9 @@ export function Header() {
265265
/>
266266
))}
267267
<MenuItem
268+
onClick={() => {
269+
window.open(githubLink, '_blank', 'noopener, noreferrer');
270+
}}
268271
text={t('common.labels.version')}
269272
additionalText={busolaVersion}
270273
icon="inspect"

src/header/SidebarMenu/useGetBusolaVersion.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ const BUSOLA_GITHUB_LINKS = {
66
REPOSITORY: 'https://github.com/kyma-project/busola',
77
PULLS: 'https://github.com/kyma-project/busola/pull',
88
COMMITS: 'https://github.com/kyma-project/busola/commit',
9+
RELEASE: 'https://github.com/kyma-project/busola/releases/tag/',
10+
RELEASES: 'https://github.com/kyma-project/busola/releases/',
911
};
1012

1113
function createGithubLink(version: string): string {
@@ -15,11 +17,17 @@ function createGithubLink(version: string): string {
1517
if (version !== devVersion && version !== unknownVersion) {
1618
if (version.toString().startsWith('PR-')) {
1719
return `${BUSOLA_GITHUB_LINKS.PULLS}/${version.slice(3)}`;
18-
} else if (version.toString().startsWith('v20')) {
20+
} else if (
21+
version.toString().startsWith('v20') &&
22+
version.toString().includes('-')
23+
) {
1924
return `${BUSOLA_GITHUB_LINKS.COMMITS}/${version.substring(
2025
version.length - 8,
2126
)}`;
22-
}
27+
} else if (version.toString().startsWith('v')) {
28+
return `${BUSOLA_GITHUB_LINKS.RELEASE}/${version}`;
29+
} else if (version.toString() === 'latest')
30+
return `${BUSOLA_GITHUB_LINKS.RELEASES}`;
2331
return `${BUSOLA_GITHUB_LINKS.COMMITS}/${version}`;
2432
}
2533
}

0 commit comments

Comments
 (0)