Skip to content

Commit

Permalink
feat: Link to the release of the currently deployed version in kyma-d…
Browse files Browse the repository at this point in the history
…ashboard version (#3644)

* feat: add link to kyma dashboard version

* use githubLink

* add blank
  • Loading branch information
OliwiaGowor authored Jan 30, 2025
1 parent 0190862 commit 83cc4ac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@ export function Header() {
/>
))}
<MenuItem
onClick={() => {
window.open(githubLink, '_blank', 'noopener, noreferrer');
}}
text={t('common.labels.version')}
additionalText={busolaVersion}
icon="inspect"
Expand Down
12 changes: 10 additions & 2 deletions src/header/SidebarMenu/useGetBusolaVersion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const BUSOLA_GITHUB_LINKS = {
REPOSITORY: 'https://github.com/kyma-project/busola',
PULLS: 'https://github.com/kyma-project/busola/pull',
COMMITS: 'https://github.com/kyma-project/busola/commit',
RELEASE: 'https://github.com/kyma-project/busola/releases/tag/',
RELEASES: 'https://github.com/kyma-project/busola/releases/',
};

function createGithubLink(version: string): string {
Expand All @@ -15,11 +17,17 @@ function createGithubLink(version: string): string {
if (version !== devVersion && version !== unknownVersion) {
if (version.toString().startsWith('PR-')) {
return `${BUSOLA_GITHUB_LINKS.PULLS}/${version.slice(3)}`;
} else if (version.toString().startsWith('v20')) {
} else if (
version.toString().startsWith('v20') &&
version.toString().includes('-')
) {
return `${BUSOLA_GITHUB_LINKS.COMMITS}/${version.substring(
version.length - 8,
)}`;
}
} else if (version.toString().startsWith('v')) {
return `${BUSOLA_GITHUB_LINKS.RELEASE}/${version}`;
} else if (version.toString() === 'latest')
return `${BUSOLA_GITHUB_LINKS.RELEASES}`;
return `${BUSOLA_GITHUB_LINKS.COMMITS}/${version}`;
}
}
Expand Down

0 comments on commit 83cc4ac

Please sign in to comment.