Skip to content

Commit

Permalink
updated support link (rancher#9870)
Browse files Browse the repository at this point in the history
* updated support link

* revert mistakenly removed test

---------

Co-authored-by: Mo Mesgin <mmesgin@Mos-M2-MacBook-Pro.local>
  • Loading branch information
momesgin and Mo Mesgin authored Oct 6, 2023
1 parent 86a448b commit 4892bb7
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 49 deletions.
9 changes: 1 addition & 8 deletions shell/pages/support/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { SETTING } from '@shell/config/settings';
import { addParam } from '@shell/utils/url';
import { isRancherPrime } from '@shell/config/version';
import { hasCspAdapter } from 'mixins/brand';
import { generateSupportLink } from '@shell/utils/version';
export default {
layout: 'home',
Expand Down Expand Up @@ -112,12 +111,6 @@ export default {
sccLink() {
return this.hasAWSSupport ? addParam('https://scc.suse.com', 'from_marketplace', '1') : 'https://scc.suse.com';
},
supportLink() {
const version = this.settings?.find((s) => s.id === SETTING.VERSION_RANCHER)?.value;
return generateSupportLink(version);
}
},
Expand All @@ -139,7 +132,7 @@ export default {
<div class="support-link">
<a
class="support-link"
:href="supportLink"
href="https://www.rancher.com/support"
target="_blank"
rel="noopener noreferrer nofollow"
>{{ t('support.community.learnMore') }}</a>
Expand Down
29 changes: 1 addition & 28 deletions shell/utils/__tests__/version.test.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,4 @@
import { generateSupportLink, isDevBuild } from '@shell/utils/version';

describe('fx: generateSupportLink', () => {
it('should generate support link corresponding to the installed Rancher version', () => {
const version = 'v2.7.5';
const expectation = 'https://www.suse.com/suse-rancher/support-matrix/all-supported-versions/rancher-v2-7-5';

const result = generateSupportLink(version);

expect(result).toStrictEqual(expectation);
});

const latestVersionSupportURL = 'https://rancher.com/support-maintenance-terms';
const testCases = [
['v2.7-0bcf068e1237acafd4aca01385c7c6b432e22fd7-head', latestVersionSupportURL],
['v2.7.5-rc4', latestVersionSupportURL],
[undefined, latestVersionSupportURL],
];

it.each(testCases)(
'should generate support link corresponding to the latest Rancher version when version is unknown or for dev build',
(version, expected) => {
const result = generateSupportLink(version);

expect(result).toBe(expected);
}
);
});
import { isDevBuild } from '@shell/utils/version';

describe('fx: isDevBuild', () => {
it.each([
Expand Down
13 changes: 0 additions & 13 deletions shell/utils/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,3 @@ export async function markReadReleaseNotes(store) {
await store.dispatch('prefs/set', { key: READ_WHATS_NEW, value: getVersionInfo(store).fullVersion });
}
}

export function generateSupportLink(version) {
const defaultSupportURL = 'https://rancher.com/support-maintenance-terms';

if (!version || isDevBuild(version)) {
return defaultSupportURL;
}

const baseUrl = 'https://www.suse.com/suse-rancher/support-matrix/all-supported-versions/rancher-';
const formattedVersion = version.split('.').join('-');

return baseUrl + formattedVersion;
}

0 comments on commit 4892bb7

Please sign in to comment.