From 67741eeb890aa91a07dbccb05a4e37d43cf71a50 Mon Sep 17 00:00:00 2001 From: Wouter Admiraal Date: Tue, 30 Mar 2021 10:12:11 +0200 Subject: [PATCH] SONAR-12332 System upgrades should refer to SonarQube Announcements --- .../system-upgrade/SystemUpgradeForm.tsx | 4 +- .../system-upgrade/SystemUpgradeItem.tsx | 21 ++- .../__tests__/SystemUpgradeItem-test.tsx | 10 +- .../SystemUpgradeForm-test.tsx.snap | 4 +- .../SystemUpgradeItem-test.tsx.snap | 151 +++++++++++++++++- .../resources/org/sonar/l10n/core.properties | 1 + 6 files changed, 168 insertions(+), 23 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeForm.tsx b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeForm.tsx index 7f68ae884b8..832ab678dec 100644 --- a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeForm.tsx +++ b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeForm.tsx @@ -56,9 +56,7 @@ export class SystemUpgradeForm extends React.PureComponent { } key={upgrades[upgrades.length - 1].version} systemUpgrades={upgrades} - type={ - idx === 0 ? translate('system.latest_version') : translate('system.lts_version') - } + isLatestVersion={idx === 0} /> ))} diff --git a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeItem.tsx b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeItem.tsx index d2e48694e18..b8d55e570fc 100644 --- a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeItem.tsx +++ b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/SystemUpgradeItem.tsx @@ -30,14 +30,14 @@ import { EditionKey } from '../../../../types/editions'; import { SystemUpgrade } from '../../../../types/system'; import SystemUpgradeIntermediate from './SystemUpgradeIntermediate'; -interface Props { +export interface SystemUpgradeItemProps { edition: EditionKey | undefined; - type: string; + isLatestVersion: boolean; systemUpgrades: SystemUpgrade[]; } -export default function SystemUpgradeItem(props: Props) { - const { edition, type, systemUpgrades } = props; +export default function SystemUpgradeItem(props: SystemUpgradeItemProps) { + const { edition, isLatestVersion, systemUpgrades } = props; const lastUpgrade = systemUpgrades[0]; const downloadUrl = getEditionDownloadUrl( getEdition(edition || EditionKey.community), @@ -47,7 +47,18 @@ export default function SystemUpgradeItem(props: Props) { return (

- {type} + + {isLatestVersion ? translate('system.latest_version') : translate('system.lts_version')} + + {isLatestVersion && ( + + {translate('system.see_whats_new')} + + )}

{ expect(shallowRender()).toMatchSnapshot(); + expect(shallowRender({ isLatestVersion: false })).toMatchSnapshot(); expect(shallowRender({ edition: EditionKey.developer })).toMatchSnapshot(); expect(shallowRender({ edition: EditionKey.enterprise })).toMatchSnapshot(); expect(shallowRender({ edition: EditionKey.datacenter })).toMatchSnapshot(); // Fallback to Community. expect( shallowRender({ - edition: EditionKey.datacenter, systemUpgrades: [ { version: '5.6.7', @@ -44,8 +44,8 @@ it('should display correctly', () => { ).toMatchSnapshot(); }); -function shallowRender(props = {}) { - return shallow( +function shallowRender(props: Partial = {}) { + return shallow( ); diff --git a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/__snapshots__/SystemUpgradeForm-test.tsx.snap b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/__snapshots__/SystemUpgradeForm-test.tsx.snap index 7e777c5a4de..e1c80419910 100644 --- a/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/__snapshots__/SystemUpgradeForm-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/system/components/system-upgrade/__tests__/__snapshots__/SystemUpgradeForm-test.tsx.snap @@ -17,6 +17,7 @@ exports[`should display correctly 1`] = ` >

- Latest Version + system.latest_version + + system.see_whats_new +

- Latest Version + system.lts_version + + +

+ + SonarQube + 5.6.7 + , + } + } + /> +

+

+ Version 5.6.7 description +

+
+ + + + + system.release_notes + +
+ +
+ + system.download_x.5.6.7 + + + system.how_to_upgrade + +
+
+`; + +exports[`should display correctly 3`] = ` +
+

+ + system.latest_version + + system.see_whats_new +

`; -exports[`should display correctly 3`] = ` +exports[`should display correctly 4`] = `

@@ -198,8 +309,16 @@ exports[`should display correctly 3`] = ` className="h1 spacer-bottom" > - Latest Version + system.latest_version + + system.see_whats_new +

`; -exports[`should display correctly 4`] = ` +exports[`should display correctly 5`] = `

@@ -293,8 +412,16 @@ exports[`should display correctly 4`] = ` className="h1 spacer-bottom" > - Latest Version + system.latest_version + + system.see_whats_new +

`; -exports[`should display correctly 5`] = ` +exports[`should display correctly 6`] = `

@@ -388,8 +515,16 @@ exports[`should display correctly 5`] = ` className="h1 spacer-bottom" > - Latest Version + system.latest_version + + system.see_whats_new +