]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-20010 - Project List improvements
authorKevin Silva <kevin.silva@sonarsource.com>
Mon, 24 Jul 2023 15:16:55 +0000 (17:16 +0200)
committersonartech <sonartech@sonarsource.com>
Tue, 25 Jul 2023 20:03:08 +0000 (20:03 +0000)
server/sonar-web/src/main/js/apps/projectInformation/__tests__/ProjectInformationApp-it.tsx
server/sonar-web/src/main/js/apps/projectInformation/about/AboutProject.tsx
server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx
server/sonar-web/src/main/js/components/common/PrivacyBadgeContainer.tsx
server/sonar-web/src/main/js/components/common/__tests__/PrivacyBadgeContainer-test.tsx
server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/PrivacyBadgeContainer-test.tsx.snap
server/sonar-web/src/main/js/components/controls/Tooltip.css

index ab0076ae2756c281bfadc1fe3d012587f61016cf..1041565c05b66e6827146d1fe4fc7e2291816a48 100644 (file)
@@ -134,7 +134,7 @@ it('should hide some fields for application', async () => {
   });
   expect(await ui.applicationPageTitle.find()).toBeInTheDocument();
   expect(screen.getByText('application.info.empty_description')).toBeInTheDocument();
-  expect(screen.queryByText(/visibility/)).not.toBeInTheDocument();
+  expect(screen.getByText('visibility.public')).toBeInTheDocument();
   expect(ui.tags.get()).toHaveTextContent('no_tags');
 });
 
@@ -146,7 +146,7 @@ it('should not show field that is not configured', async () => {
   expect(await ui.projectPageTitle.find()).toBeInTheDocument();
   expect(ui.qualityGateList.query()).not.toBeInTheDocument();
   expect(ui.qualityProfilesList.query()).not.toBeInTheDocument();
-  expect(screen.queryByText(/visibility/)).not.toBeInTheDocument();
+  expect(screen.getByText('visibility.public')).toBeInTheDocument();
   expect(ui.tags.get()).toHaveTextContent('no_tags');
   expect(screen.getByText('project.info.empty_description')).toBeInTheDocument();
 });
@@ -160,7 +160,7 @@ it('should hide visibility if public', async () => {
   expect(await ui.projectPageTitle.find()).toBeInTheDocument();
   expect(ui.qualityGateList.query()).not.toBeInTheDocument();
   expect(ui.qualityProfilesList.query()).not.toBeInTheDocument();
-  expect(screen.queryByText(/visibility/)).not.toBeInTheDocument();
+  expect(screen.getByText('visibility.public')).toBeInTheDocument();
   expect(ui.tags.get()).toHaveTextContent('no_tags');
   expect(screen.getByText('project.info.empty_description')).toBeInTheDocument();
 });
index c148d4414753ccbc52656c87efc644cd73859d31..168c2dc593fa20c1bc1c252efff48f27397ecba5 100644 (file)
@@ -78,11 +78,12 @@ export default function AboutProject(props: AboutProjectProps) {
         <MetaKey componentKey={component.key} qualifier={component.qualifier} />
       </ProjectInformationSection>
 
-      {component.visibility === Visibility.Private && (
-        <ProjectInformationSection>
-          <MetaVisibility qualifier={component.qualifier} visibility={component.visibility} />
-        </ProjectInformationSection>
-      )}
+      <ProjectInformationSection>
+        <MetaVisibility
+          qualifier={component.qualifier}
+          visibility={component.visibility ?? Visibility.Public}
+        />
+      </ProjectInformationSection>
 
       <ProjectInformationSection>
         <MetaDescription description={component.description} isApp={isApp} />
index c3e7ac009fb41256fbc3fe36080562b011d70958..2b5118b3576a0449e5380ee2de24a04e6c198ba8 100644 (file)
@@ -43,7 +43,7 @@ import Measure from '../../../../components/measure/Measure';
 import { translate, translateWithParameters } from '../../../../helpers/l10n';
 import { formatMeasure } from '../../../../helpers/measures';
 import { getProjectUrl } from '../../../../helpers/urls';
-import { ComponentQualifier, Visibility } from '../../../../types/component';
+import { ComponentQualifier } from '../../../../types/component';
 import { MetricKey, MetricType } from '../../../../types/metrics';
 import { Status } from '../../../../types/types';
 import { CurrentUser, isLoggedIn } from '../../../../types/users';
@@ -81,13 +81,12 @@ function renderFirstLine(
             />
           )}
 
-          <h3 className="it__project-card-name" title={name}>
+          <h1 className="it__project-card-name" title={name}>
             <StandoutLink to={getProjectUrl(key)}>{name}</StandoutLink>
-          </h3>
+          </h1>
 
           {qualifier === ComponentQualifier.Application && (
             <Tooltip
-              placement="top"
               overlay={
                 <span>
                   {translate('qualifier.APP')}
@@ -101,20 +100,16 @@ function renderFirstLine(
               }
             >
               <span>
-                <Badge className="sw-ml-2 sw-font-sans">{translate('qualifier.APP')}</Badge>
+                <Badge className="sw-ml-2">{translate('qualifier.APP')}</Badge>
               </span>
             </Tooltip>
           )}
 
-          {visibility === Visibility.Private && (
-            <Tooltip overlay={translate('visibility', visibility, 'description', qualifier)}>
-              <span>
-                <Badge className="sw-ml-2 sw-font-sans">
-                  {translate('visibility', visibility)}
-                </Badge>
-              </span>
-            </Tooltip>
-          )}
+          <Tooltip overlay={translate('visibility', visibility, 'description', qualifier)}>
+            <span>
+              <Badge className="sw-ml-2">{translate('visibility', visibility)}</Badge>
+            </span>
+          </Tooltip>
         </div>
         {analysisDate && (
           <Tooltip overlay={qualityGateLabel}>
@@ -156,7 +151,7 @@ function renderFirstLine(
                       value={measures.new_lines}
                     />
                   </span>
-                  <span>{translate('metric.new_lines.name')}</span>
+                  <span className="sw-body-sm">{translate('metric.new_lines.name')}</span>
                 </div>
               </>
             )
@@ -171,7 +166,7 @@ function renderFirstLine(
                       value={measures.ncloc}
                     />
                   </span>
-                  <span>{translate('metric.ncloc.name')}</span>
+                  <span className="sw-body-sm">{translate('metric.ncloc.name')}</span>
                 </div>
                 <SeparatorCircleIcon className="sw-mx-1" />
                 <span className="sw-body-sm" data-key={MetricKey.ncloc_language_distribution}>
index 86a203671aed7823ae3a710ba3823a7672091aef..36e4b07b1cb94c3d286502f4d08f6b73477c1142 100644 (file)
@@ -34,10 +34,6 @@ export default function PrivacyBadgeContainer({
   qualifier,
   visibility,
 }: PrivacyBadgeContainerProps) {
-  if (visibility !== Visibility.Private) {
-    return null;
-  }
-
   return (
     <Tooltip overlay={translate('visibility', visibility, 'description', qualifier)}>
       <div className={classNames('badge', className)}>{translate('visibility', visibility)}</div>
index 12e905a51abddc7d5ca17bb6c99e137488fac7c3..58579fadd0d7d65426d83c75b9ecb606d57324c7 100644 (file)
@@ -26,7 +26,7 @@ it('renders', () => {
   expect(getWrapper()).toMatchSnapshot();
 });
 
-it('do not render', () => {
+it('should render public', () => {
   expect(getWrapper({ visibility: Visibility.Public })).toMatchSnapshot();
 });
 
index 45a670ff6a1cf8a27f94a986a10430fca270292c..4bbe4a4a09a4d5abc8c6f2e2c4c232443a35f87a 100644 (file)
@@ -1,7 +1,5 @@
 // Jest Snapshot v1, https://goo.gl/fbAQLP
 
-exports[`do not render 1`] = `""`;
-
 exports[`renders 1`] = `
 <Tooltip
   overlay="visibility.private.description.TRK"
@@ -13,3 +11,15 @@ exports[`renders 1`] = `
   </div>
 </Tooltip>
 `;
+
+exports[`should render public 1`] = `
+<Tooltip
+  overlay="visibility.public.description.TRK"
+>
+  <div
+    className="badge"
+  >
+    visibility.public
+  </div>
+</Tooltip>
+`;
index e532c2a48e50fc073909e359c81ef970f976d894..e37dfdd89a134f63d062ec055bba97f8549731ac 100644 (file)
@@ -59,7 +59,6 @@
   padding: 12px 17px;
   color: #eff2f9;
   background-color: #2a2f40;
-  letter-spacing: 0.04em;
 }
 
 .tooltip-inner .alert {