aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2017-09-14 18:23:29 +0200
committerTeryk Bellahsene <teryk@users.noreply.github.com>2017-09-20 09:15:23 +0200
commitc47f23a368580c818c3a7a7db425078f4eb3554c (patch)
tree2a37421ac774faf4961e99cd5580e512d9bb4a86 /server/sonar-web/src
parent54e8cef057f9a8e4a04034c9680578e0373e1e8d (diff)
downloadsonarqube-c47f23a368580c818c3a7a7db425078f4eb3554c.tar.gz
sonarqube-c47f23a368580c818c3a7a7db425078f4eb3554c.zip
SONAR-9813 display "Private" badge tooltip based on qualifier
Diffstat (limited to 'server/sonar-web/src')
-rw-r--r--server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBreadcrumbs.js4
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeak.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverall.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/ProjectRow.tsx4
-rw-r--r--server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/ProjectRow-test.tsx.snap8
-rw-r--r--server/sonar-web/src/main/js/components/common/PrivateBadge.tsx7
-rw-r--r--server/sonar-web/src/main/js/components/common/__tests__/PrivateBadge-test.tsx2
-rw-r--r--server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/PrivateBadge-test.tsx.snap2
8 files changed, 25 insertions, 10 deletions
diff --git a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBreadcrumbs.js b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBreadcrumbs.js
index 27637b0f3ed..8bbd0a0c5ce 100644
--- a/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBreadcrumbs.js
+++ b/server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBreadcrumbs.js
@@ -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>
);
}
diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeak.tsx b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeak.tsx
index 89e6dd61c78..1505bef784b 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeak.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeak.tsx
@@ -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 &&
diff --git a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverall.tsx b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverall.tsx
index 135f71c3e35..80ce9ceadb0 100644
--- a/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverall.tsx
+++ b/server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverall.tsx
@@ -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 && (
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRow.tsx b/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRow.tsx
index c87abea71e4..ce7df2a1c43 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRow.tsx
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/ProjectRow.tsx
@@ -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">
diff --git a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/ProjectRow-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/ProjectRow-test.tsx.snap
index d0e3ac5b4f8..87d61db023e 100644
--- a/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/ProjectRow-test.tsx.snap
+++ b/server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/ProjectRow-test.tsx.snap
@@ -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"
diff --git a/server/sonar-web/src/main/js/components/common/PrivateBadge.tsx b/server/sonar-web/src/main/js/components/common/PrivateBadge.tsx
index d360d2105c6..076692ca514 100644
--- a/server/sonar-web/src/main/js/components/common/PrivateBadge.tsx
+++ b/server/sonar-web/src/main/js/components/common/PrivateBadge.tsx
@@ -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>
diff --git a/server/sonar-web/src/main/js/components/common/__tests__/PrivateBadge-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/PrivateBadge-test.tsx
index 02bdfcab213..93c199d8e25 100644
--- a/server/sonar-web/src/main/js/components/common/__tests__/PrivateBadge-test.tsx
+++ b/server/sonar-web/src/main/js/components/common/__tests__/PrivateBadge-test.tsx
@@ -22,5 +22,5 @@ import { shallow } from 'enzyme';
import PrivateBadge from '../PrivateBadge';
it('renders', () => {
- expect(shallow(<PrivateBadge />)).toMatchSnapshot();
+ expect(shallow(<PrivateBadge qualifier="TRK" />)).toMatchSnapshot();
});
diff --git a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/PrivateBadge-test.tsx.snap b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/PrivateBadge-test.tsx.snap
index d8f24f25b26..2ec0bd7a891 100644
--- a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/PrivateBadge-test.tsx.snap
+++ b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/PrivateBadge-test.tsx.snap
@@ -2,7 +2,7 @@
exports[`renders 1`] = `
<Tooltip
- overlay="visibility.private.description"
+ overlay="visibility.private.description.TRK"
placement="bottom"
>
<div