@@ -173,7 +173,11 @@ import { Pane, Splitpanes } from "splitpanes";
173173import { mapGetters } from " vuex" ;
174174
175175import { ccService , handleThriftError } from " @cc-api" ;
176- import { Checker , Order , SortMode , SortType } from " @cc/report-server-types" ;
176+ import {
177+ Checker ,
178+ MAX_QUERY_SIZE ,
179+ Order , SortMode , SortType
180+ } from " @cc/report-server-types" ;
177181
178182import { FillHeight } from " @/directives" ;
179183import { BugPathLengthColorMixin , DetectionStatusMixin } from " @/mixins" ;
@@ -313,7 +317,8 @@ export default {
313317 initalized: false ,
314318 checkerDocDialog: false ,
315319 selectedChecker: null ,
316- expanded: []
320+ expanded: [],
321+ allGroupedReports: []
317322 };
318323 },
319324
@@ -383,6 +388,10 @@ export default {
383388 " chronological_order" : report .annotations [" chronological_order" ]
384389 };
385390 });
391+ },
392+
393+ isUniqueByFileLine () {
394+ return this .reportFilter ._uniqueMode === " fileline" ;
386395 }
387396 },
388397
@@ -491,11 +500,14 @@ export default {
491500
492501 refresh () {
493502 this .expanded = [];
503+ this .allGroupedReports = [];
494504
495- ccService .getClient ().getRunResultCount (this .runIds ,
496- this .reportFilter , this .cmpData , handleThriftError (res => {
497- this .totalItems = res .toNumber ();
498- }));
505+ if (! this .isUniqueByFileLine ) {
506+ ccService .getClient ().getRunResultCount (this .runIds ,
507+ this .reportFilter , this .cmpData , handleThriftError (res => {
508+ this .totalItems = res .toNumber ();
509+ }));
510+ }
499511
500512 if (this .pagination .page !== 1 && this .initalized ) {
501513 this .pagination .page = 1 ;
@@ -507,26 +519,69 @@ export default {
507519 fetchReports () {
508520 this .loading = true ;
509521
510- const limit = this .pagination .itemsPerPage ;
511- const offset = limit * (this .pagination .page - 1 );
512522 const sortType = this .getSortMode ();
513523 const getDetails = false ;
514524
515- ccService .getClient ().getRunResults (this .runIds , limit, offset, sortType,
516- this .reportFilter , this .cmpData , getDetails,
517- handleThriftError (reports => {
518- this .reports = reports;
525+ if (this .isUniqueByFileLine ) {
526+ if (this .allGroupedReports .length === 0 ) {
527+ ccService .getClient ().getRunResults (
528+ this .runIds , MAX_QUERY_SIZE , 0 , sortType,
529+ this .reportFilter , this .cmpData , getDetails,
530+ handleThriftError (reports => {
531+ const grouped = {};
532+ reports .forEach (report => {
533+ const key = report .checkedFile + " :" +
534+ (report .line ? report .line .toNumber () : 0 );
535+ if (! grouped[key]) {
536+ grouped[key] = { ... report, sameReports: [report] };
537+ } else {
538+ grouped[key].sameReports .push (report);
539+ }
540+ });
541+ this .allGroupedReports = Object .values (grouped);
542+ this .totalItems = this .allGroupedReports .length ;
543+
544+ this .allGroupedReports .forEach (group => {
545+ this .$set (this .sameReports , group .bugHash ,
546+ [... new Set (group .sameReports .map (
547+ r => r .reviewData .status ))]);
548+ });
549+
550+ this ._applyFileLinePage ();
551+ this .loading = false ;
552+ this .initalized = true ;
553+ }));
554+ } else {
555+ this ._applyFileLinePage ();
519556 this .loading = false ;
520- this .initalized = true ;
521-
522- reports .forEach (report => {
523- ccService .getSameReports (report .bugHash ).then (sameReports => {
524- this .$set (
525- this .sameReports , report .bugHash ,
526- [ ... new Set (sameReports .map (r => r .reviewData .status )) ]);
557+ }
558+ } else {
559+ const limit = this .pagination .itemsPerPage ;
560+ const offset = limit * (this .pagination .page - 1 );
561+
562+ ccService .getClient ().getRunResults (
563+ this .runIds , limit, offset, sortType,
564+ this .reportFilter , this .cmpData , getDetails,
565+ handleThriftError (reports => {
566+ this .reports = reports;
567+ reports .forEach (report => {
568+ ccService .getSameReports (report .bugHash ).then (sameReports => {
569+ this .$set (
570+ this .sameReports , report .bugHash ,
571+ [ ... new Set (sameReports .map (
572+ r => r .reviewData .status )) ]);
573+ });
527574 });
528- });
529- }));
575+ this .loading = false ;
576+ this .initalized = true ;
577+ }));
578+ }
579+ },
580+
581+ _applyFileLinePage () {
582+ const limit = this .pagination .itemsPerPage ;
583+ const offset = limit * (this .pagination .page - 1 );
584+ this .reports = this .allGroupedReports .slice (offset, offset + limit);
530585 }
531586 }
532587};
0 commit comments