From 37d4fb8d98541e30e867eb05e15a7d6fd214c1f7 Mon Sep 17 00:00:00 2001 From: Revanshu Paliwal Date: Tue, 28 Mar 2023 16:25:57 +0200 Subject: [PATCH] SONAR-18776 Branch selector scroll fix and resolving code smells --- .../app/components/nav/component/__tests__/Header-test.tsx | 7 ++++--- .../components/nav/component/branch-like/MenuItemList.tsx | 2 +- .../nav/component/branch-like/QualityGateStatus.tsx | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Header-test.tsx b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Header-test.tsx index 5add2af3e0e..04286b17cd1 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Header-test.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/__tests__/Header-test.tsx @@ -29,6 +29,7 @@ import { mockComponent } from '../../../../../helpers/mocks/component'; import { mockCurrentUser, mockLoggedInUser } from '../../../../../helpers/testMocks'; import { renderApp } from '../../../../../helpers/testReactTestingUtils'; import { AlmKeys } from '../../../../../types/alm-settings'; +import { ComponentQualifier } from '../../../../../types/component'; import { Feature } from '../../../../../types/features'; import { BranchStatusContext } from '../../../branch-status/BranchStatusContext'; import { Header, HeaderProps } from '../Header'; @@ -74,7 +75,7 @@ it('should show manage branch and pull request button for admin', async () => { currentUser: mockLoggedInUser(), component: mockComponent({ configuration: { showSettings: true }, - breadcrumbs: [{ name: 'project', key: 'project', qualifier: 'TRK' }], + breadcrumbs: [{ name: 'project', key: 'project', qualifier: ComponentQualifier.Project }], }), }); await user.click(screen.getByRole('button', { name: 'branch-1 overview.quality_gate_x.OK' })); @@ -131,7 +132,7 @@ it('should show the correct help tooltip for applications', () => { currentUser: mockLoggedInUser(), component: mockComponent({ configuration: { showSettings: true }, - breadcrumbs: [{ name: 'project', key: 'project', qualifier: 'APP' }], + breadcrumbs: [{ name: 'project', key: 'project', qualifier: ComponentQualifier.Application }], qualifier: 'APP', }), branchLikes: [mockMainBranch()], @@ -182,7 +183,7 @@ function renderHeader(props?: Partial, featureList = [Feature.Branc
+
    {!hasResults && (
    {translate('no_results')} diff --git a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/QualityGateStatus.tsx b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/QualityGateStatus.tsx index 66daeb57842..492299f49c0 100644 --- a/server/sonar-web/src/main/js/app/components/nav/component/branch-like/QualityGateStatus.tsx +++ b/server/sonar-web/src/main/js/app/components/nav/component/branch-like/QualityGateStatus.tsx @@ -24,6 +24,7 @@ import { getBranchStatusByBranchLike } from '../../../../../helpers/branch-like' import { translateWithParameters } from '../../../../../helpers/l10n'; import { formatMeasure } from '../../../../../helpers/measures'; import { BranchLike } from '../../../../../types/branch-like'; +import { MetricType } from '../../../../../types/metrics'; import { Component } from '../../../../../types/types'; import { BranchStatusContext } from '../../../branch-status/BranchStatusContext'; @@ -52,7 +53,7 @@ export default function QualityGateStatus({ return null; } const { status } = branchStatus; - const formatted = formatMeasure(status, 'LEVEL'); + const formatted = formatMeasure(status, MetricType.Level); const ariaLabel = translateWithParameters('overview.quality_gate_x', formatted); return (
    -- 2.39.5