]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-12270 Fix confusing deprecated param badge
authorWouter Admiraal <wouter.admiraal@sonarsource.com>
Fri, 15 Jul 2022 10:27:11 +0000 (12:27 +0200)
committersonartech <sonartech@sonarsource.com>
Mon, 18 Jul 2022 20:03:26 +0000 (20:03 +0000)
server/sonar-web/src/main/js/apps/web-api/components/Params.tsx
server/sonar-web/src/main/js/apps/web-api/components/__tests__/Params-test.tsx
server/sonar-web/src/main/js/apps/web-api/components/__tests__/__snapshots__/Params-test.tsx.snap
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 6312309f071cf5adbbe43b378fceafa33d7254a5..b2b63f0ba0fd29f29408374edb7744a24c524fbd 100644 (file)
@@ -47,18 +47,6 @@ export default class Params extends React.PureComponent<Props> {
           </div>
         )}
 
-        {this.props.showDeprecated && param.deprecatedKey && (
-          <div className="little-spacer-top">
-            <code>{param.deprecatedKey}</code>
-          </div>
-        )}
-
-        {this.props.showDeprecated && param.deprecatedKey && param.deprecatedKeySince && (
-          <div className="little-spacer-top">
-            <DeprecatedBadge since={param.deprecatedKeySince} />
-          </div>
-        )}
-
         <div className="note little-spacer-top">{param.required ? 'required' : 'optional'}</div>
 
         {param.since && (
@@ -66,6 +54,18 @@ export default class Params extends React.PureComponent<Props> {
             {translateWithParameters('since_x', param.since)}
           </div>
         )}
+
+        {this.props.showDeprecated && param.deprecatedKey && (
+          <div className="big-spacer-top spacer-left">
+            <div className="note little-spacer-bottom">{translate('replaces')}:</div>
+            <code>{param.deprecatedKey}</code>
+            {param.deprecatedKeySince && (
+              <div className="little-spacer-top">
+                <DeprecatedBadge since={param.deprecatedKeySince} />
+              </div>
+            )}
+          </div>
+        )}
       </td>
     );
   }
index f4e8284be00ae1f21cf7079fccfbd2220e7d4ebb..70c17c3cb231dff097cad0b8be21ead6fdcb7f15 100644 (file)
@@ -48,7 +48,7 @@ it('should not render deprecated parameters', () => {
 
 it('should render deprecated key', () => {
   const params = [
-    { ...DEFAULT_PARAM, deprecatedKey: 'foo-deprecated', deprecatedSince: '5.0' },
+    { ...DEFAULT_PARAM, deprecatedKey: 'foo-deprecated', deprecatedKeySince: '5.0' },
     { ...DEFAULT_PARAM, deprecatedSince: '5.0', internal: true }
   ];
   expect(
index 67798d734fb6ccb199ee86c08ec43fd2fbe7bc79..fa3689854974d823b62b5f649899ecad119e7b5d 100644 (file)
@@ -137,23 +137,29 @@ exports[`should render deprecated key 1`] = `
             foo
           </code>
           <div
-            className="little-spacer-top"
+            className="note little-spacer-top"
           >
-            <DeprecatedBadge
-              since="5.0"
-            />
+            optional
           </div>
           <div
-            className="little-spacer-top"
+            className="big-spacer-top spacer-left"
           >
+            <div
+              className="note little-spacer-bottom"
+            >
+              replaces
+              :
+            </div>
             <code>
               foo-deprecated
             </code>
-          </div>
-          <div
-            className="note little-spacer-top"
-          >
-            optional
+            <div
+              className="little-spacer-top"
+            >
+              <DeprecatedBadge
+                since="5.0"
+              />
+            </div>
           </div>
         </td>
         <td>
index 43a38d5a5c94fde3b39fc2b856daf2d2902cfd89..8ed3dc0259ca4fb45edd2c5ad4623a8d7b955779 100644 (file)
@@ -162,6 +162,7 @@ refresh=Refresh
 reload=Reload
 remove=Remove
 rename=Rename
+replaces=Replaces
 reset_verb=Reset
 reset_to_default=Reset To Default
 resolution=Resolution