aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/issues
diff options
context:
space:
mode:
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,