]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-9813 display "Private" badge tooltip based on qualifier
authorStas Vilchik <stas.vilchik@sonarsource.com>
Thu, 14 Sep 2017 16:23:29 +0000 (18:23 +0200)
committerTeryk Bellahsene <teryk@users.noreply.github.com>
Wed, 20 Sep 2017 07:15:23 +0000 (09:15 +0200)
server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBreadcrumbs.js
server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeak.tsx
server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverall.tsx
server/sonar-web/src/main/js/apps/projectsManagement/ProjectRow.tsx
server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/ProjectRow-test.tsx.snap
server/sonar-web/src/main/js/components/common/PrivateBadge.tsx
server/sonar-web/src/main/js/components/common/__tests__/PrivateBadge-test.tsx
server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/PrivateBadge-test.tsx.snap
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index 27637b0f3ed22f69fb11064b3332e414e1a637bd..8bbd0a0c5cec38199e759bbdaf9a61df259f64cb 100644 (file)
@@ -93,7 +93,9 @@ class ComponentNavBreadcrumbs extends React.PureComponent {
           </span>
         )}
         {items}
-        {component.visibility === 'private' && <PrivateBadge className="spacer-left" />}
+        {component.visibility === 'private' && (
+          <PrivateBadge className="spacer-left" qualifier={component.qualifier} />
+        )}
       </h1>
     );
   }
index 89e6dd61c7892b8d7d0a48271c708997bec5d82f..1505bef784b4a6e9b589139fdac8caaa2f15349c 100644 (file)
@@ -57,7 +57,9 @@ export default function ProjectCardLeak({ organization, project }: Props) {
         </h2>
         {project.analysisDate && <ProjectCardQualityGate status={measures!['alert_status']} />}
         <div className="pull-right text-right">
-          {isPrivate && <PrivateBadge className="spacer-left" tooltipPlacement="left" />}
+          {isPrivate && (
+            <PrivateBadge className="spacer-left" qualifier="TRK" tooltipPlacement="left" />
+          )}
           {hasTags && <TagsList tags={project.tags} customClass="spacer-left" />}
         </div>
         {project.analysisDate &&
index 135f71c3e35b63a138030f64d612d12a7d4ef59a..80ce9ceadb042d8823952295cb16bc2f940b0f29 100644 (file)
@@ -56,7 +56,9 @@ export default function ProjectCardOverall({ organization, project }: Props) {
         </h2>
         {project.analysisDate && <ProjectCardQualityGate status={measures['alert_status']} />}
         <div className="pull-right text-right">
-          {isPrivate && <PrivateBadge className="spacer-left" tooltipPlacement="left" />}
+          {isPrivate && (
+            <PrivateBadge className="spacer-left" qualifier="TRK" tooltipPlacement="left" />
+          )}
           {hasTags && <TagsList tags={project.tags} customClass="spacer-left" />}
         </div>
         {project.analysisDate && (
index c87abea71e49e16dcf31da03b950432536cc7cbf..ce7df2a1c43a029f438ec69c5b8da5c9fdb2ccd4 100644 (file)
@@ -64,7 +64,9 @@ export default class ProjectRow extends React.PureComponent<Props> {
         </td>
 
         <td className="thin nowrap">
-          {project.visibility === Visibility.Private && <PrivateBadge />}
+          {project.visibility === Visibility.Private && (
+            <PrivateBadge qualifier={project.qualifier} />
+          )}
         </td>
 
         <td className="nowrap">
index d0e3ac5b4f86529a9827eb9cb1aa70814130c35d..87d61db023e53234d6f4ccbd4417bdedb9561af0 100644 (file)
@@ -39,7 +39,9 @@ exports[`renders 1`] = `
   <td
     className="thin nowrap"
   >
-    <PrivateBadge />
+    <PrivateBadge
+      qualifier="TRK"
+    />
   </td>
   <td
     className="nowrap"
@@ -148,7 +150,9 @@ exports[`renders 2`] = `
   <td
     className="thin nowrap"
   >
-    <PrivateBadge />
+    <PrivateBadge
+      qualifier="TRK"
+    />
   </td>
   <td
     className="nowrap"
index d360d2105c68e4aea458e9a7cdca568f1b3ea146..076692ca51473f89e937cb97b3d841d8d1e5d97c 100644 (file)
@@ -24,12 +24,15 @@ import { translate } from '../../helpers/l10n';
 
 interface Props {
   className?: string;
+  qualifier: string;
   tooltipPlacement?: string;
 }
 
-export default function PrivateBadge({ className, tooltipPlacement = 'bottom' }: Props) {
+export default function PrivateBadge({ className, qualifier, tooltipPlacement = 'bottom' }: Props) {
   return (
-    <Tooltip overlay={translate('visibility.private.description')} placement={tooltipPlacement}>
+    <Tooltip
+      overlay={translate('visibility.private.description', qualifier)}
+      placement={tooltipPlacement}>
       <div className={classNames('outline-badge', className)}>
         {translate('visibility.private')}
       </div>
index 02bdfcab213af3101234c62b4ce9e23048d245ad..93c199d8e25fe62582173180da5182a584ff398c 100644 (file)
@@ -22,5 +22,5 @@ import { shallow } from 'enzyme';
 import PrivateBadge from '../PrivateBadge';
 
 it('renders', () => {
-  expect(shallow(<PrivateBadge />)).toMatchSnapshot();
+  expect(shallow(<PrivateBadge qualifier="TRK" />)).toMatchSnapshot();
 });
index d8f24f25b2651d6c3314483671b8dfba38ad8340..2ec0bd7a8918d5aa80314c45366f7392b093632f 100644 (file)
@@ -2,7 +2,7 @@
 
 exports[`renders 1`] = `
 <Tooltip
-  overlay="visibility.private.description"
+  overlay="visibility.private.description.TRK"
   placement="bottom"
 >
   <div
index a18d9b76a2dfeed096025aeae8adad8cdb1c0b67..4248cbb0235b2b8518afeea9f1c6b81157c799d5 100644 (file)
@@ -526,7 +526,9 @@ visibility.public=Public
 visibility.public.description=This project is public. Anyone can browse and see the source code.
 visibility.public.description.short=Anyone can browse and see the source code.
 visibility.private=Private
-visibility.private.description=This project is private. Only authorized users can browse and see the source code.
+visibility.private.description.TRK=This project is private. Only authorized users can browse and see the source code.
+visibility.private.description.VW=This portfolio is private. Only authorized users can browse it.
+visibility.private.description.APP=This application is private. Only authorized users can browse it.
 visibility.private.description.short=Only authorized users can browse and see the source code.