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

</span> </span>
)} )}
{items} {items}
{component.visibility === 'private' && <PrivateBadge className="spacer-left" />}
{component.visibility === 'private' && (
<PrivateBadge className="spacer-left" qualifier={component.qualifier} />
)}
</h1> </h1>
); );
} }

+ 3
- 1
server/sonar-web/src/main/js/apps/projects/components/ProjectCardLeak.tsx View File

</h2> </h2>
{project.analysisDate && <ProjectCardQualityGate status={measures!['alert_status']} />} {project.analysisDate && <ProjectCardQualityGate status={measures!['alert_status']} />}
<div className="pull-right text-right"> <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" />} {hasTags && <TagsList tags={project.tags} customClass="spacer-left" />}
</div> </div>
{project.analysisDate && {project.analysisDate &&

+ 3
- 1
server/sonar-web/src/main/js/apps/projects/components/ProjectCardOverall.tsx View File

</h2> </h2>
{project.analysisDate && <ProjectCardQualityGate status={measures['alert_status']} />} {project.analysisDate && <ProjectCardQualityGate status={measures['alert_status']} />}
<div className="pull-right text-right"> <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" />} {hasTags && <TagsList tags={project.tags} customClass="spacer-left" />}
</div> </div>
{project.analysisDate && ( {project.analysisDate && (

+ 3
- 1
server/sonar-web/src/main/js/apps/projectsManagement/ProjectRow.tsx View File

</td> </td>


<td className="thin nowrap"> <td className="thin nowrap">
{project.visibility === Visibility.Private && <PrivateBadge />}
{project.visibility === Visibility.Private && (
<PrivateBadge qualifier={project.qualifier} />
)}
</td> </td>


<td className="nowrap"> <td className="nowrap">

+ 6
- 2
server/sonar-web/src/main/js/apps/projectsManagement/__tests__/__snapshots__/ProjectRow-test.tsx.snap View File

<td <td
className="thin nowrap" className="thin nowrap"
> >
<PrivateBadge />
<PrivateBadge
qualifier="TRK"
/>
</td> </td>
<td <td
className="nowrap" className="nowrap"
<td <td
className="thin nowrap" className="thin nowrap"
> >
<PrivateBadge />
<PrivateBadge
qualifier="TRK"
/>
</td> </td>
<td <td
className="nowrap" className="nowrap"

+ 5
- 2
server/sonar-web/src/main/js/components/common/PrivateBadge.tsx View File



interface Props { interface Props {
className?: string; className?: string;
qualifier: string;
tooltipPlacement?: string; tooltipPlacement?: string;
} }


export default function PrivateBadge({ className, tooltipPlacement = 'bottom' }: Props) {
export default function PrivateBadge({ className, qualifier, tooltipPlacement = 'bottom' }: Props) {
return ( return (
<Tooltip overlay={translate('visibility.private.description')} placement={tooltipPlacement}>
<Tooltip
overlay={translate('visibility.private.description', qualifier)}
placement={tooltipPlacement}>
<div className={classNames('outline-badge', className)}> <div className={classNames('outline-badge', className)}>
{translate('visibility.private')} {translate('visibility.private')}
</div> </div>

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

import PrivateBadge from '../PrivateBadge'; import PrivateBadge from '../PrivateBadge';


it('renders', () => { 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



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

+ 3
- 1
sonar-core/src/main/resources/org/sonar/l10n/core.properties View File

visibility.public.description=This project is public. Anyone can browse and see the source code. 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.public.description.short=Anyone can browse and see the source code.
visibility.private=Private 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. visibility.private.description.short=Only authorized users can browse and see the source code.





Loading…
Cancel
Save