]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-16254 - Explicit the content of the Last Analysis warning
authorBelen Pruvost <belen.pruvost@sonarsource.com>
Fri, 8 Apr 2022 15:07:50 +0000 (17:07 +0200)
committersonartech <sonartech@sonarsource.com>
Fri, 8 Apr 2022 20:02:59 +0000 (20:02 +0000)
server/sonar-web/src/main/js/app/components/nav/component/ComponentNavWarnings.tsx
server/sonar-web/src/main/js/app/components/nav/component/HeaderMeta.tsx
server/sonar-web/src/main/js/app/components/nav/component/__tests__/ComponentNavWarnings-test.tsx
server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/ComponentNavWarnings-test.tsx.snap
server/sonar-web/src/main/js/app/components/nav/component/__tests__/__snapshots__/HeaderMeta-test.tsx.snap
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index e7df51cae19756cc72a25a17a52396f8d7f919e1..4d60b9080ae2804b50db765dd590916e7ce96e76 100644 (file)
@@ -31,6 +31,7 @@ const AnalysisWarningsModal = lazyLoadComponent(
 
 interface Props {
   componentKey: string;
+  isBranch: boolean;
   onWarningDismiss: () => void;
   warnings: TaskWarning[];
 }
@@ -60,6 +61,9 @@ export default class ComponentNavWarnings extends React.PureComponent<Props, Sta
             defaultMessage={translate('component_navigation.last_analysis_had_warnings')}
             id="component_navigation.last_analysis_had_warnings"
             values={{
+              branchType: this.props.isBranch
+                ? translate('branches.branch')
+                : translate('branches.pr'),
               warnings: (
                 <a href="#" onClick={this.handleClick}>
                   <FormattedMessage
index 1729155f1a015b6f178ea5d359042e6ed6a7135a..3e78bec5863b64aedab89d9bcae172369b1c7640 100644 (file)
@@ -45,6 +45,7 @@ export function HeaderMeta(props: HeaderMetaProps) {
   const { branchLike, component, currentUser, warnings } = props;
 
   const isABranch = isBranch(branchLike);
+
   const currentPage = getCurrentPage(component, branchLike);
   const displayVersion = component.version !== undefined && isABranch;
 
@@ -54,6 +55,7 @@ export function HeaderMeta(props: HeaderMetaProps) {
         {warnings.length > 0 && (
           <span className="header-meta-warnings">
             <ComponentNavWarnings
+              isBranch={isABranch}
               componentKey={component.key}
               onWarningDismiss={props.onWarningDismiss}
               warnings={warnings}
index a1bfd0924ec385fdc6a968386d72db21916f3bc9..89333e8da4685ec5654a8f8f63c57d8c8766333d 100644 (file)
@@ -26,6 +26,7 @@ it('should render', () => {
   const wrapper = shallow(
     <ComponentNavWarnings
       componentKey="foo"
+      isBranch={true}
       onWarningDismiss={jest.fn()}
       warnings={[mockTaskWarning({ message: 'warning 1' })]}
     />
index f7893380d5b9d23792d2eb31c76f0cc49617fb33..4a4509f61f345c048732f5c2e7dbdbc4f3bc6920 100644 (file)
@@ -12,6 +12,7 @@ exports[`should render 1`] = `
       id="component_navigation.last_analysis_had_warnings"
       values={
         Object {
+          "branchType": "branches.branch",
           "warnings": <a
             href="#"
             onClick={[Function]}
index 110542461d9cb4af3cdab703e65215a3e4d4ccc3..8069b500e197dea5e6dc92a6839fe53f0712fa29 100644 (file)
@@ -10,6 +10,7 @@ exports[`should render correctly for a branch 1`] = `
     >
       <ComponentNavWarnings
         componentKey="my-project"
+        isBranch={true}
         onWarningDismiss={[MockFunction]}
         warnings={
           Array [
@@ -63,6 +64,7 @@ exports[`should render correctly for a main project branch 1`] = `
     >
       <ComponentNavWarnings
         componentKey="my-project"
+        isBranch={true}
         onWarningDismiss={[MockFunction]}
         warnings={
           Array [
@@ -116,6 +118,7 @@ exports[`should render correctly for a portfolio 1`] = `
     >
       <ComponentNavWarnings
         componentKey="foo"
+        isBranch={true}
         onWarningDismiss={[MockFunction]}
         warnings={
           Array [
@@ -156,6 +159,7 @@ exports[`should render correctly for a pull request 1`] = `
     >
       <ComponentNavWarnings
         componentKey="my-project"
+        isBranch={false}
         onWarningDismiss={[MockFunction]}
         warnings={
           Array [
index b6ce448d7b49d9eebf395d75da84b2a93979275c..e814d4e44a56e2dc7ae9c0cc826c854edf43217f 100644 (file)
@@ -2886,7 +2886,7 @@ component_navigation.status.in_progress.admin.help=A background task is in progr
 component_navigation.status.in_progress_X.admin.help=The {type} is in progress.
 component_navigation.status.last_blocked_due_to_bad_license_X=Last analysis blocked due to an invalid license, which has since been corrected. Please reanalyze this {0}.
 
-component_navigation.last_analysis_had_warnings=Last analysis had {warnings}
+component_navigation.last_analysis_had_warnings=Last analysis of this {branchType} had {warnings}
 component_navigation.x_warnings={warningsCount} {warningsCount, plural, one {warning} other {warnings}}
 
 component_navigation.pr_deco.error_detected_X=We've detected an issue with your configuration. Your SonarQube instance won't be able to perform any pull request decoration. {action}
@@ -3941,7 +3941,9 @@ onboarding.tutorial.with.azure_pipelines.BranchAnalysis.branch_protection.link=d
 # BRANCHES
 #
 #------------------------------------------------------------------------------
+branches.branch=Branch
 branches.main_branch=Main Branch
+branches.pr=PR
 branches.see_the_pr=See the PR
 
 #------------------------------------------------------------------------------