Skip to content

Commit

Permalink
fix argocd full url function (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
medo-freiheit authored Jul 26, 2022
1 parent 66baa64 commit fea920c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ describe('Argocd Link', () => {
// when
const { container } = getWrapper({ baseUrl, applicationName, environmentName });
// then
const url = getFullUrl(applicationName, environmentName, baseUrl);
const url = getFullUrl(baseUrl, environmentName, applicationName);
testcase.expect(container, url);
});
});
Expand Down
6 changes: 3 additions & 3 deletions services/frontend-service/src/legacy-ui/ReleaseDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -310,21 +310,21 @@ export const getUndeployedUpstream = (
return '';
};

export const getFullUrl = (applicationName: string, environmentName: string, baseUrl?: string): string =>
export const getFullUrl = (baseUrl: string, environmentName: string, applicationName: string): string =>
`${baseUrl}/applications/${environmentName}-${applicationName}`;

export const ArgoCdLink = (props: { baseUrl?: string; applicationName: string; environmentName: string }) => {
const { baseUrl, applicationName, environmentName } = props;

const navigate = React.useCallback(() => {
window.open(getFullUrl(baseUrl || '', applicationName, environmentName));
window.open(getFullUrl(baseUrl || '', environmentName, applicationName));
}, [baseUrl, environmentName, applicationName]);

return !!baseUrl ? (
<Tooltip
arrow
key={`${applicationName}-${environmentName}`}
title={`${baseUrl}/applications/${environmentName}-${applicationName}`}>
title={getFullUrl(baseUrl || '', environmentName, applicationName)}>
<IconButton onClick={navigate} data-testid={`argocd-link`}>
<Avatar
src={`https://cncf-branding.netlify.app/img/projects/argo/icon/color/argo-icon-color.svg`}
Expand Down

0 comments on commit fea920c

Please sign in to comment.