From 6d373c90f7737e245a3f3aca1d509da91b1f3429 Mon Sep 17 00:00:00 2001 From: Kevin Silva Date: Mon, 24 Jul 2023 17:16:55 +0200 Subject: [PATCH] SONAR-20010 - Project List improvements --- .../__tests__/ProjectInformationApp-it.tsx | 6 ++--- .../projectInformation/about/AboutProject.tsx | 11 ++++---- .../components/project-card/ProjectCard.tsx | 27 ++++++++----------- .../common/PrivacyBadgeContainer.tsx | 4 --- .../__tests__/PrivacyBadgeContainer-test.tsx | 2 +- .../PrivacyBadgeContainer-test.tsx.snap | 14 ++++++++-- .../main/js/components/controls/Tooltip.css | 1 - 7 files changed, 33 insertions(+), 32 deletions(-) diff --git a/server/sonar-web/src/main/js/apps/projectInformation/__tests__/ProjectInformationApp-it.tsx b/server/sonar-web/src/main/js/apps/projectInformation/__tests__/ProjectInformationApp-it.tsx index ab0076ae275..1041565c05b 100644 --- a/server/sonar-web/src/main/js/apps/projectInformation/__tests__/ProjectInformationApp-it.tsx +++ b/server/sonar-web/src/main/js/apps/projectInformation/__tests__/ProjectInformationApp-it.tsx @@ -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(); }); diff --git a/server/sonar-web/src/main/js/apps/projectInformation/about/AboutProject.tsx b/server/sonar-web/src/main/js/apps/projectInformation/about/AboutProject.tsx index c148d441475..168c2dc593f 100644 --- a/server/sonar-web/src/main/js/apps/projectInformation/about/AboutProject.tsx +++ b/server/sonar-web/src/main/js/apps/projectInformation/about/AboutProject.tsx @@ -78,11 +78,12 @@ export default function AboutProject(props: AboutProjectProps) { - {component.visibility === Visibility.Private && ( - - - - )} + + + diff --git a/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx b/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx index c3e7ac009fb..2b5118b3576 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx +++ b/server/sonar-web/src/main/js/apps/projects/components/project-card/ProjectCard.tsx @@ -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( /> )} -

+

{name} -

+ {qualifier === ComponentQualifier.Application && ( {translate('qualifier.APP')} @@ -101,20 +100,16 @@ function renderFirstLine( } > - {translate('qualifier.APP')} + {translate('qualifier.APP')} )} - {visibility === Visibility.Private && ( - - - - {translate('visibility', visibility)} - - - - )} + + + {translate('visibility', visibility)} + + {analysisDate && ( @@ -156,7 +151,7 @@ function renderFirstLine( value={measures.new_lines} /> - {translate('metric.new_lines.name')} + {translate('metric.new_lines.name')} ) @@ -171,7 +166,7 @@ function renderFirstLine( value={measures.ncloc} /> - {translate('metric.ncloc.name')} + {translate('metric.ncloc.name')} diff --git a/server/sonar-web/src/main/js/components/common/PrivacyBadgeContainer.tsx b/server/sonar-web/src/main/js/components/common/PrivacyBadgeContainer.tsx index 86a203671ae..36e4b07b1cb 100644 --- a/server/sonar-web/src/main/js/components/common/PrivacyBadgeContainer.tsx +++ b/server/sonar-web/src/main/js/components/common/PrivacyBadgeContainer.tsx @@ -34,10 +34,6 @@ export default function PrivacyBadgeContainer({ qualifier, visibility, }: PrivacyBadgeContainerProps) { - if (visibility !== Visibility.Private) { - return null; - } - return (
{translate('visibility', visibility)}
diff --git a/server/sonar-web/src/main/js/components/common/__tests__/PrivacyBadgeContainer-test.tsx b/server/sonar-web/src/main/js/components/common/__tests__/PrivacyBadgeContainer-test.tsx index 12e905a51ab..58579fadd0d 100644 --- a/server/sonar-web/src/main/js/components/common/__tests__/PrivacyBadgeContainer-test.tsx +++ b/server/sonar-web/src/main/js/components/common/__tests__/PrivacyBadgeContainer-test.tsx @@ -26,7 +26,7 @@ it('renders', () => { expect(getWrapper()).toMatchSnapshot(); }); -it('do not render', () => { +it('should render public', () => { expect(getWrapper({ visibility: Visibility.Public })).toMatchSnapshot(); }); diff --git a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/PrivacyBadgeContainer-test.tsx.snap b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/PrivacyBadgeContainer-test.tsx.snap index 45a670ff6a1..4bbe4a4a09a 100644 --- a/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/PrivacyBadgeContainer-test.tsx.snap +++ b/server/sonar-web/src/main/js/components/common/__tests__/__snapshots__/PrivacyBadgeContainer-test.tsx.snap @@ -1,7 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`do not render 1`] = `""`; - exports[`renders 1`] = ` `; + +exports[`should render public 1`] = ` + +
+ visibility.public +
+
+`; diff --git a/server/sonar-web/src/main/js/components/controls/Tooltip.css b/server/sonar-web/src/main/js/components/controls/Tooltip.css index e532c2a48e5..e37dfdd89a1 100644 --- a/server/sonar-web/src/main/js/components/controls/Tooltip.css +++ b/server/sonar-web/src/main/js/components/controls/Tooltip.css @@ -59,7 +59,6 @@ padding: 12px 17px; color: #eff2f9; background-color: #2a2f40; - letter-spacing: 0.04em; } .tooltip-inner .alert { -- 2.39.5