Browse Source

SONAR-9813 display "Private" badge tooltip based on qualifier

tags/6.6-RC1
Stas Vilchik 6 years ago
parent
commit
c47f23a368

+ 3
- 1
server/sonar-web/src/main/js/app/components/nav/component/ComponentNavBreadcrumbs.js View 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>
);
}

+ 3
- 1
server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeak.tsx View 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 &&

+ 3
- 1
server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverall.tsx View 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 && (

+ 3
- 1
server/sonar-web/src/main/js/apps/projectsManagement/ProjectRow.tsx View 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">

+ 6
- 2
server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/ProjectRow-test.tsx.snap View 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"

+ 5
- 2
server/sonar-web/src/main/js/components/common/PrivateBadge.tsx View 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>

+ 1
- 1
server/sonar-web/src/main/js/components/common/__tests__/PrivateBadge-test.tsx View 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();
});

+ 1
- 1
server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/PrivateBadge-test.tsx.snap View File

@@ -2,7 +2,7 @@

exports[`renders 1`] = `
<Tooltip
overlay="visibility.private.description"
overlay="visibility.private.description.TRK"
placement="bottom"
>
<div

+ 3
- 1
sonar-core/src/main/resources/org/sonar/l10n/core.properties View 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.



Loading…
Cancel
Save