From: Philippe Perrin Date: Thu, 24 Jun 2021 12:44:44 +0000 (+0200) Subject: SONAR-14935 Display banner for project only X-Git-Tag: 9.0.0.45539~50 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=59ef6879386752e50da4cafb5a927b217920ab74;p=sonarqube.git SONAR-14935 Display banner for project only --- diff --git a/server/sonar-web/src/main/js/apps/overview/branches/FirstAnalysisNextStepsNotif.tsx b/server/sonar-web/src/main/js/apps/overview/branches/FirstAnalysisNextStepsNotif.tsx index c345eba2247..2db27f088b2 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/FirstAnalysisNextStepsNotif.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/FirstAnalysisNextStepsNotif.tsx @@ -25,6 +25,7 @@ import { withCurrentUser } from '../../../components/hoc/withCurrentUser'; import DismissableAlert from '../../../components/ui/DismissableAlert'; import { isLoggedIn } from '../../../helpers/users'; import { ProjectAlmBindingResponse } from '../../../types/alm-settings'; +import { ComponentQualifier } from '../../../types/component'; import { PULL_REQUEST_DECORATION_BINDING_CATEGORY } from '../../settings/components/AdditionalCategoryKeys'; export interface FirstAnalysisNextStepsNotifProps { @@ -44,7 +45,7 @@ export function FirstAnalysisNextStepsNotif(props: FirstAnalysisNextStepsNotifPr projectBinding } = props; - if (!isLoggedIn(currentUser)) { + if (!isLoggedIn(currentUser) || component.qualifier !== ComponentQualifier.Project) { return null; } diff --git a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/FirstAnalysisNextStepsNotif-test.tsx b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/FirstAnalysisNextStepsNotif-test.tsx index 21494366a55..b7a1c2a1cb1 100644 --- a/server/sonar-web/src/main/js/apps/overview/branches/__tests__/FirstAnalysisNextStepsNotif-test.tsx +++ b/server/sonar-web/src/main/js/apps/overview/branches/__tests__/FirstAnalysisNextStepsNotif-test.tsx @@ -22,6 +22,7 @@ import { shallow } from 'enzyme'; import * as React from 'react'; import { mockProjectAlmBindingResponse } from '../../../../helpers/mocks/alm-settings'; import { mockComponent, mockCurrentUser, mockLoggedInUser } from '../../../../helpers/testMocks'; +import { ComponentQualifier } from '../../../../types/component'; import { FirstAnalysisNextStepsNotif, FirstAnalysisNextStepsNotifProps @@ -29,6 +30,11 @@ import { it('should render correctly', () => { expect(shallowRender({ currentUser: mockCurrentUser() }).type()).toBeNull(); + expect( + shallowRender({ + component: mockComponent({ qualifier: ComponentQualifier.Application }) + }).type() + ).toBeNull(); expect(shallowRender({ detectedCIOnLastAnalysis: false })).toMatchSnapshot( 'show prompt to configure CI' );