aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysesList.js11
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.js1
-rw-r--r--server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/ProjectActivityApp-test.js.snap7
3 files changed, 15 insertions, 4 deletions
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysesList.js b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysesList.js
index 9644ad770e1..a2aa8084c66 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysesList.js
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityAnalysesList.js
@@ -25,8 +25,8 @@ import { throttle } from 'lodash';
import ProjectActivityAnalysis from './ProjectActivityAnalysis';
import FormattedDate from '../../../components/ui/FormattedDate';
import { translate } from '../../../helpers/l10n';
-import { getAnalysesByVersionByDay } from '../utils';
-import type { Analysis } from '../types';
+import { activityQueryChanged, getAnalysesByVersionByDay } from '../utils';
+import type { Analysis, Query } from '../types';
type Props = {
addCustomEvent: (analysis: string, name: string, category?: string) => Promise<*>,
@@ -38,7 +38,8 @@ type Props = {
changeEvent: (event: string, name: string) => Promise<*>,
deleteAnalysis: (analysis: string) => Promise<*>,
deleteEvent: (analysis: string, event: string) => Promise<*>,
- loading: boolean
+ loading: boolean,
+ query: Query
};
export default class ProjectActivityAnalysesList extends React.PureComponent {
@@ -57,7 +58,9 @@ export default class ProjectActivityAnalysesList extends React.PureComponent {
componentDidUpdate(prevProps: Props) {
if (prevProps.analysis !== this.props.analyses && this.scrollContainer) {
- this.scrollContainer.scrollTop = 0;
+ if (activityQueryChanged(prevProps.query, this.props.query)) {
+ this.scrollContainer.scrollTop = 0;
+ }
for (let i = 1; i < this.badges.length; i++) {
this.badges[i].removeAttribute('originOffsetTop');
this.badges[i].classList.remove('sticky');
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.js b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.js
index 9b4f2a595dd..f7d094778eb 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.js
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/ProjectActivityApp.js
@@ -111,6 +111,7 @@ export default class ProjectActivityApp extends React.PureComponent {
deleteAnalysis={this.props.deleteAnalysis}
deleteEvent={this.props.deleteEvent}
loading={this.props.loading}
+ query={this.props.query}
/>
</div>
<div className="project-activity-layout-page-main">
diff --git a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/ProjectActivityApp-test.js.snap b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/ProjectActivityApp-test.js.snap
index 0f5a433fbfe..b97c9aa9054 100644
--- a/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/ProjectActivityApp-test.js.snap
+++ b/server/sonar-web/src/main/js/apps/projectActivity/components/__tests__/__snapshots__/ProjectActivityApp-test.js.snap
@@ -110,6 +110,13 @@ exports[`should render correctly 1`] = `
deleteAnalysis={[Function]}
deleteEvent={[Function]}
loading={false}
+ query={
+ Object {
+ "category": "",
+ "graph": "overview",
+ "project": "org.sonarsource.sonarqube:sonarqube",
+ }
+ }
/>
</div>
<div