]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-15508 Fix upgrade being display in the modal
authorMathieu Suen <mathieu.suen@sonarsource.com>
Tue, 2 Nov 2021 13:28:32 +0000 (14:28 +0100)
committersonartech <sonartech@sonarsource.com>
Fri, 5 Nov 2021 20:03:28 +0000 (20:03 +0000)
server/sonar-web/src/main/js/components/upgrade/SystemUpgradeForm.tsx
server/sonar-web/src/main/js/components/upgrade/SystemUpgradeItem.tsx
server/sonar-web/src/main/js/components/upgrade/__tests__/__snapshots__/SystemUpgradeItem-test.tsx.snap
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index eb6e85ca6b80ff1d10b586074c0168bf0c86b0b3..985f8d4600fb12eb8cb594b7004ab9cbbd414c4a 100644 (file)
@@ -54,7 +54,7 @@ export class SystemUpgradeForm extends React.PureComponent<Props, State> {
   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<Props, State> {
         .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 (
index 049bfa96d867736eda48633fddcc67d13ab0dbc3..ffbc2b718f27063a311b05cbe7b2ed36af1ea787 100644 (file)
@@ -55,7 +55,7 @@ export default function SystemUpgradeItem(props: SystemUpgradeItemProps) {
     <div className="system-upgrade-version it__upgrade-list-item">
       <h3 className="h1 spacer-bottom">
         <strong>{header}</strong>
-        {!isLTSVersion && (
+        {!isPatch && (
           <a
             className="spacer-left medium"
             href="https://www.sonarqube.org/whats-new/?referrer=sonarqube"
index 697c8eb33753721cae795b81e4154eca3de01c29..849ff677a1d174df7bd74a60721a836baf0f630a 100644 (file)
@@ -113,6 +113,14 @@ exports[`should display correctly 2`] = `
     <strong>
       system.lts_version
     </strong>
+    <a
+      className="spacer-left medium"
+      href="https://www.sonarqube.org/whats-new/?referrer=sonarqube"
+      rel="noopener noreferrer"
+      target="_blank"
+    >
+      system.see_whats_new
+    </a>
   </h3>
   <p>
     <FormattedMessage
@@ -208,14 +216,6 @@ exports[`should display correctly 3`] = `
     <strong>
       system.latest_patch
     </strong>
-    <a
-      className="spacer-left medium"
-      href="https://www.sonarqube.org/whats-new/?referrer=sonarqube"
-      rel="noopener noreferrer"
-      target="_blank"
-    >
-      system.see_whats_new
-    </a>
   </h3>
   <p>
     <FormattedMessage
index 57e437717457eee3c02de82ba4363632c4917c5b..3ee7dde2d20f50c88e0c8c9a03131582d578b7cd 100644 (file)
@@ -3020,8 +3020,8 @@ system.forcing_shutdown_not_recommended=Forcing the shutdown is not recommended
 system.hide_intermediate_versions=Hide intermediate versions
 system.how_to_upgrade=How to upgrade?
 system.latest_version=Latest Version
-system.latest_patch=Latest Patch Release
-system.lts_version=LTS Version
+system.latest_patch=Patch Release
+system.lts_version=Latest LTS Version
 system.log_level.warning=This level has performance impacts, please make sure to get back to INFO level once your investigation is done. Please note that when the server is restarted, logging will revert to the level configured in sonar.properties.
 system.log_level.warning.short=Current logs level has performance impacts, get back to INFO level.
 system.log_level.info=Your selection does not affect the Search Engine.