aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/issues
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2017-04-27 11:15:35 +0200
committerStas Vilchik <vilchiks@gmail.com>2017-04-27 11:44:56 +0200
commit796f2eba3d1646fd7643b78077c7f0210ea9039a (patch)
tree9656d53a0a5e13ea99f3d4b24bb3aef3918dc35a /server/sonar-web/src/main/js/apps/issues
parentfd3934ccca6b674b44d51b34d3c2488f920fd8eb (diff)
downloadsonarqube-796f2eba3d1646fd7643b78077c7f0210ea9039a.tar.gz
sonarqube-796f2eba3d1646fd7643b78077c7f0210ea9039a.zip
do not load all issues for a file
Diffstat (limited to 'server/sonar-web/src/main/js/apps/issues')
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/App.js22
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/IssuesSourceViewer.js2
2 files changed, 19 insertions, 5 deletions
diff --git a/server/sonar-web/src/main/js/apps/issues/components/App.js b/server/sonar-web/src/main/js/apps/issues/components/App.js
index a6745fa2add..8d71be0d1ff 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/App.js
+++ b/server/sonar-web/src/main/js/apps/issues/components/App.js
@@ -426,18 +426,32 @@ export default class App extends React.PureComponent {
});
};
- fetchIssuesForComponent = (): Promise<Array<Issue>> => {
+ fetchIssuesForComponent = (
+ component: string,
+ from: number,
+ to: number
+ ): Promise<Array<Issue>> => {
const { issues, openIssue, paging } = this.state;
+ /* eslint-disable no-console */
+ console.log(`loadin issues from line ${from} to line ${to}`);
+
if (!openIssue || !paging) {
return Promise.reject();
}
const isSameComponent = (issue: Issue): boolean => issue.component === openIssue.component;
- const done = (issues: Array<Issue>, paging: Paging): boolean =>
- paging.total <= paging.pageIndex * paging.pageSize ||
- issues[issues.length - 1].component !== openIssue.component;
+ const done = (issues: Array<Issue>, paging: Paging): boolean => {
+ if (paging.total <= paging.pageIndex * paging.pageSize) {
+ return true;
+ }
+ const lastIssue = issues[issues.length - 1];
+ if (lastIssue.component !== openIssue.component) {
+ return true;
+ }
+ return lastIssue.line != null && lastIssue.line > to;
+ };
if (done(issues, paging)) {
return Promise.resolve(issues.filter(isSameComponent));
diff --git a/server/sonar-web/src/main/js/apps/issues/components/IssuesSourceViewer.js b/server/sonar-web/src/main/js/apps/issues/components/IssuesSourceViewer.js
index 947be331377..062d8530e6d 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/IssuesSourceViewer.js
+++ b/server/sonar-web/src/main/js/apps/issues/components/IssuesSourceViewer.js
@@ -24,7 +24,7 @@ import { scrollToElement } from '../../../helpers/scrolling';
import type { Issue } from '../../../components/issue/types';
type Props = {|
- loadIssues: () => Promise<*>,
+ loadIssues: (string, number, number) => Promise<*>,
onIssueChange: Issue => void,
onIssueSelect: string => void,
onLocationSelect: number => void,