From: Jeremy Davis Date: Thu, 13 Jun 2019 13:44:58 +0000 (+0200) Subject: SONAR-12195 Activity page: Filter security_review_rating to appear only for portfolio X-Git-Tag: 7.8~8 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9c8d2d7b1f6a4d94626fde76edfeaaa231724af2;p=sonarqube.git SONAR-12195 Activity page: Filter security_review_rating to appear only for portfolio --- diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppContainer.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppContainer.tsx index fcffaf0c373..78e118c7950 100644 --- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppContainer.tsx +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAppContainer.tsx @@ -236,6 +236,12 @@ export default class ProjectActivityAppContainer extends React.PureComponent metric.key !== 'security_review_rating'); + } + firstLoadData(query: Query, component: T.Component) { const graphMetrics = getHistoryMetrics(query.graph, query.customMetrics); const topLevelComponent = this.getTopLevelComponent(component); @@ -244,15 +250,15 @@ export default class ProjectActivityAppContainer extends React.PureComponent { + ([{ analyses, paging }, metrics, measuresHistory]) => { if (this.mounted) { this.setState({ - analyses: response[0].analyses, + analyses, graphLoading: false, initialized: true, - measuresHistory: response[2], - metrics: response[1], - paging: response[0].paging + measuresHistory, + metrics: this.filterMetrics(component, metrics), + paging }); this.fetchAllActivities(topLevelComponent); diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityAppContainer-test.tsx b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityAppContainer-test.tsx new file mode 100644 index 00000000000..7309e391713 --- /dev/null +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/ProjectActivityAppContainer-test.tsx @@ -0,0 +1,38 @@ +/* + * SonarQube + * Copyright (C) 2009-2019 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +import * as React from 'react'; +import { shallow } from 'enzyme'; +import ProjectActivityAppContainer from '../ProjectActivityAppContainer'; +import { mockComponent, mockLocation, mockRouter } from '../../../../helpers/testMocks'; + +it('should render correctly', () => { + expect(shallowRender()).toMatchSnapshot(); +}); + +function shallowRender(props: Partial = {}) { + return shallow( + + ); +} diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/ProjectActivityAppContainer-test.tsx.snap b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/ProjectActivityAppContainer-test.tsx.snap new file mode 100644 index 00000000000..59c46d170ac --- /dev/null +++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/ProjectActivityAppContainer-test.tsx.snap @@ -0,0 +1,74 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should render correctly 1`] = ` + +`;