aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-06-30 17:57:51 +0200
committerGrégoire Aubert <gregoire.aubert@sonarsource.com>2017-07-04 14:15:34 +0200
commit18fca4d04ae579382448dc3ff795a2d601cf3b21 (patch)
tree21d748d6c0ec600667b7a14b36d3091400f16f8d /server
parent2641578935496d001cb243a6e7f588622e5d1484 (diff)
downloadsonarqube-18fca4d04ae579382448dc3ff795a2d601cf3b21.tar.gz
sonarqube-18fca4d04ae579382448dc3ff795a2d601cf3b21.zip
SONAR-8550 Don't scroll top when doing an action on an event
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