From 3641fb3c3b11768ff2f3ff54b6bcfa754e3064ec Mon Sep 17 00:00:00 2001 From: Mathieu Suen Date: Tue, 2 Nov 2021 14:28:32 +0100 Subject: [PATCH] SONAR-15508 Fix upgrade being display in the modal --- .../js/components/upgrade/SystemUpgradeForm.tsx | 10 +++++++++- .../js/components/upgrade/SystemUpgradeItem.tsx | 2 +- .../SystemUpgradeItem-test.tsx.snap | 16 ++++++++-------- .../resources/org/sonar/l10n/core.properties | 4 ++-- 4 files changed, 20 insertions(+), 12 deletions(-) diff --git a/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeForm.tsx b/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeForm.tsx index eb6e85ca6b8..985f8d4600f 100644 --- a/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeForm.tsx +++ b/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeForm.tsx @@ -54,7 +54,7 @@ export class SystemUpgradeForm extends React.PureComponent { render() { const { upgrading } = this.state; const { appState, systemUpgrades, latestLTS, updateUseCase } = this.props; - let systemUpgradesWithPatch = systemUpgrades; + let systemUpgradesWithPatch: SystemUpgrade[][] = []; const alertVariant = updateUseCase ? MAP_ALERT[updateUseCase] : undefined; const header = translate('system.system_upgrade'); const parsedVersion = this.versionParser.exec(appState.version); @@ -69,6 +69,14 @@ export class SystemUpgradeForm extends React.PureComponent { .map(upgrades => upgrades.filter(upgrade => !upgrade.version.startsWith(majoMinorVersion))) .filter(negate(isEmpty)); systemUpgradesWithPatch.push(patches); + } else { + let untilLTS = false; + for (const upgrades of systemUpgrades) { + if (untilLTS === false) { + systemUpgradesWithPatch.push(upgrades); + untilLTS = upgrades.some(upgrade => upgrade.version.startsWith(latestLTS)); + } + } } return ( diff --git a/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeItem.tsx b/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeItem.tsx index 049bfa96d86..ffbc2b718f2 100644 --- a/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeItem.tsx +++ b/server/sonar-web/src/main/js/components/upgrade/SystemUpgradeItem.tsx @@ -55,7 +55,7 @@ export default function SystemUpgradeItem(props: SystemUpgradeItemProps) {

{header} - {!isLTSVersion && ( + {!isPatch && ( system.lts_version + + system.see_whats_new +

system.latest_patch - - system.see_whats_new -