]> source.dussan.org Git - sonarqube.git/commitdiff
Fix SONAR-10585
authorPascal Mugnier <pascal.mugnier@sonarsource.com>
Tue, 1 May 2018 10:12:57 +0000 (12:12 +0200)
committerSonarTech <sonartech@sonarsource.com>
Thu, 3 May 2018 18:20:49 +0000 (20:20 +0200)
server/sonar-web/src/main/js/apps/issues/components/ComponentBreadcrumbs.tsx
server/sonar-web/src/main/js/apps/issues/components/ListItem.tsx
server/sonar-web/src/main/js/apps/issues/components/__tests__/__snapshots__/ComponentBreadcrumbs-test.tsx.snap

index b5f7a6fe21ac0231774df82d1eafa954a9606a29..3e3adfad26d9783cac78ed28c4a085d999e0212f 100644 (file)
@@ -40,6 +40,7 @@ interface Props {
     | 'subProject'
     | 'subProjectName'
   >;
+  link?: boolean;
   organization: { key: string } | undefined;
   selectedFlowIndex?: number;
   selectedLocationIndex?: number;
@@ -48,6 +49,7 @@ interface Props {
 export default function ComponentBreadcrumbs({
   branchLike,
   component,
+  link = true,
   issue,
   organization,
   selectedFlowIndex,
@@ -65,14 +67,22 @@ export default function ComponentBreadcrumbs({
   return (
     <div className="component-name text-ellipsis">
       {displayOrganization && (
-        <Organization linkClassName="link-no-underline" organizationKey={issue.organization} />
+        <Organization
+          link={link}
+          linkClassName="link-no-underline"
+          organizationKey={issue.organization}
+        />
       )}
 
       {displayProject && (
         <span title={issue.projectName}>
-          <Link className="link-no-underline" to={getBranchLikeUrl(issue.project, branchLike)}>
-            {limitComponentName(issue.projectName)}
-          </Link>
+          {link ? (
+            <Link className="link-no-underline" to={getBranchLikeUrl(issue.project, branchLike)}>
+              {limitComponentName(issue.projectName)}
+            </Link>
+          ) : (
+            limitComponentName(issue.projectName)
+          )}
           <span className="slash-separator" />
         </span>
       )}
@@ -81,16 +91,28 @@ export default function ComponentBreadcrumbs({
         issue.subProject !== undefined &&
         issue.subProjectName !== undefined && (
           <span title={issue.subProjectName}>
-            <Link className="link-no-underline" to={getBranchLikeUrl(issue.subProject, branchLike)}>
-              {limitComponentName(issue.subProjectName)}
-            </Link>
+            {link ? (
+              <Link
+                className="link-no-underline"
+                to={getBranchLikeUrl(issue.subProject, branchLike)}>
+                {limitComponentName(issue.subProjectName)}
+              </Link>
+            ) : (
+              limitComponentName(issue.subProjectName)
+            )}
             <span className="slash-separator" />
           </span>
         )}
 
-      <Link className="link-no-underline" to={getCodeUrl(issue.project, branchLike, componentKey)}>
-        <span title={componentName}>{collapsePath(componentName || '')}</span>
-      </Link>
+      {link ? (
+        <Link
+          className="link-no-underline"
+          to={getCodeUrl(issue.project, branchLike, componentKey)}>
+          <span title={componentName}>{collapsePath(componentName || '')}</span>
+        </Link>
+      ) : (
+        collapsePath(componentName || '')
+      )}
     </div>
   );
 }
index 9913dca0600ea477ab5e345b9f196f01c8d3d3bd..40e7657663d2b9fc206ab1cbc0ecdda66bfb4fec 100644 (file)
@@ -109,6 +109,7 @@ export default class ListItem extends React.PureComponent<Props, State> {
               branchLike={branchLike}
               component={component}
               issue={this.props.issue}
+              link={false}
               organization={this.props.organization}
             />
           </div>
index ac510c728244ad4048203d73d82deae03a5f759e..522da78f5a8d6b802111fd09de65bd6fef2a4ffd 100644 (file)
@@ -5,6 +5,7 @@ exports[`renders 1`] = `
   className="component-name text-ellipsis"
 >
   <Connect(Organization)
+    link={true}
     linkClassName="link-no-underline"
     organizationKey="org"
   />
@@ -58,6 +59,7 @@ exports[`renders with branch 1`] = `
   className="component-name text-ellipsis"
 >
   <Connect(Organization)
+    link={true}
     linkClassName="link-no-underline"
     organizationKey="org"
   />
@@ -138,6 +140,7 @@ exports[`renders with sub-project 1`] = `
   className="component-name text-ellipsis"
 >
   <Connect(Organization)
+    link={true}
     linkClassName="link-no-underline"
     organizationKey="org"
   />