From d66f159e6010a65b488a8964554c2819046d6b33 Mon Sep 17 00:00:00 2001 From: Viktor Vorona Date: Wed, 10 Apr 2024 11:20:43 +0200 Subject: [PATCH] SONAR-22017 Show link to SonarQube downloads for no longer active version --- .../components/__tests__/UpdateNotification-it.tsx | 3 +++ .../js/components/upgrade/SystemUpgradeButton.tsx | 11 ++++++++++- server/sonar-web/src/main/js/helpers/testMocks.ts | 3 +-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/server/sonar-web/src/main/js/app/components/__tests__/UpdateNotification-it.tsx b/server/sonar-web/src/main/js/app/components/__tests__/UpdateNotification-it.tsx index 91e350399c9..9673352c29d 100644 --- a/server/sonar-web/src/main/js/app/components/__tests__/UpdateNotification-it.tsx +++ b/server/sonar-web/src/main/js/app/components/__tests__/UpdateNotification-it.tsx @@ -39,6 +39,7 @@ jest.mock('../../../api/system', () => ({ const ui = { updateMessage: byRole('alert'), openDialogBtn: byRole('button', { name: 'learn_more' }), + learnMoreLink: byRole('link', { name: /learn_more/ }), dialog: byRole('dialog', { name: 'system.system_upgrade' }), latestHeader: byRole('heading', { name: /system.latest_version/ }), latestLTAHeader: byRole('heading', { name: /system.lta_version/ }), @@ -83,6 +84,7 @@ it('should show error message if upgrades call failed and the version has reache `admin_notification.update.${UpdateUseCase.CurrentVersionInactive}`, ); expect(ui.openDialogBtn.query()).not.toBeInTheDocument(); + expect(ui.learnMoreLink.get()).toBeInTheDocument(); }); it('should not show the notification banner if there is no network connection and version has not reached the eol', () => { @@ -106,6 +108,7 @@ it('should show the error banner if there is no network connection and version h `admin_notification.update.${UpdateUseCase.CurrentVersionInactive}`, ); expect(ui.openDialogBtn.query()).not.toBeInTheDocument(); + expect(ui.learnMoreLink.get()).toBeInTheDocument(); }); it('active / latest / patch', async () => { diff --git a/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeButton.tsx b/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeButton.tsx index 7744d356114..9e318506cd2 100644 --- a/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeButton.tsx +++ b/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeButton.tsx @@ -17,6 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +import { Link } from '@sonarsource/echoes-react'; import { ButtonSecondary } from 'design-system'; import * as React from 'react'; import { translate } from '../../helpers/l10n'; @@ -44,7 +45,15 @@ export default function SystemUpgradeButton(props: Readonly) { }, [setSystemUpgradeFormOpen]); if (systemUpgrades.length === 0) { - return null; + return ( + + {translate('learn_more')} + + ); } return ( diff --git a/server/sonar-web/src/main/js/helpers/testMocks.ts b/server/sonar-web/src/main/js/helpers/testMocks.ts index 7cb81dfb4b7..313cb7f03bd 100644 --- a/server/sonar-web/src/main/js/helpers/testMocks.ts +++ b/server/sonar-web/src/main/js/helpers/testMocks.ts @@ -17,7 +17,6 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import { addMonths, formatISO } from 'date-fns'; import { omit } from 'lodash'; import { To } from 'react-router-dom'; import { CompareResponse } from '../api/quality-profiles'; @@ -95,7 +94,7 @@ export function mockAppState(overrides: Partial = {}): AppState { qualifiers: [ComponentQualifier.Project], settings: {}, version: '1.0', - versionEOL: formatISO(addMonths(new Date(), 1), { representation: 'date' }), + versionEOL: '2020-01-01', documentationUrl: 'https://docs.sonarsource.com/sonarqube/10.0', ...overrides, }; -- 2.39.5