aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main
diff options
context:
space:
mode:
authorPhilippe Perrin <philippe.perrin@sonarsource.com>2021-06-24 14:44:44 +0200
committersonartech <sonartech@sonarsource.com>2021-06-24 20:03:29 +0000
commit59ef6879386752e50da4cafb5a927b217920ab74 (patch)
tree0a112c2e0747b05d4a3e8e5cb1b7d465835e0284 /server/sonar-web/src/main
parent8a421fd4d6958017c0cab63a644adf5474f715b7 (diff)
downloadsonarqube-59ef6879386752e50da4cafb5a927b217920ab74.tar.gz
sonarqube-59ef6879386752e50da4cafb5a927b217920ab74.zip
SONAR-14935 Display banner for project only
Diffstat (limited to 'server/sonar-web/src/main')
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/FirstAnalysisNextStepsNotif.tsx3
-rw-r--r--server/sonar-web/src/main/js/apps/overview/branches/__tests__/FirstAnalysisNextStepsNotif-test.tsx6
2 files changed, 8 insertions, 1 deletions
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'
);