@@ -28,6 +28,7 @@ import {
2828 SortDirection ,
2929 RAW_RESULTS_PAGE_SIZE ,
3030 INTERPRETED_RESULTS_PAGE_SIZE ,
31+ ALERTS_TABLE_NAME ,
3132} from './interface-types' ;
3233import { Logger } from './logging' ;
3334import * as messages from './messages' ;
@@ -244,7 +245,12 @@ export class InterfaceManager extends DisposableObject {
244245 ) ;
245246 break ;
246247 case 'changePage' :
247- await this . showPageOfResults ( msg . selectedTable , msg . pageNumber ) ;
248+ if ( msg . selectedTable === ALERTS_TABLE_NAME ) {
249+ await this . showPageOfInterpretedResults ( msg . pageNumber ) ;
250+ }
251+ else {
252+ await this . showPageOfRawResults ( msg . selectedTable , msg . pageNumber ) ;
253+ }
248254 break ;
249255 default :
250256 assertNever ( msg ) ;
@@ -380,10 +386,30 @@ export class InterfaceManager extends DisposableObject {
380386 } ) ;
381387 }
382388
389+ /**
390+ * Show a page of interpreted results
391+ */
392+ public async showPageOfInterpretedResults (
393+ pageNumber : number
394+ ) : Promise < void > {
395+ if ( this . _interpretation === undefined ) {
396+ throw new Error ( `Trying to show interpreted results but interpretation was undefined` ) ;
397+ }
398+ if ( this . _interpretation . sarif . runs [ 0 ] . results === undefined ) {
399+ throw new Error ( `Trying to show interpreted results but results were undefined` ) ;
400+ }
401+ await this . postMessage ( {
402+ t : 'showInterpretedPage' ,
403+ interpretation : this . getPageOfInterpretedResults ( pageNumber ) ,
404+ pageNumber,
405+ totalPages : Math . ceil ( this . _interpretation . sarif . runs [ 0 ] . results . length / INTERPRETED_RESULTS_PAGE_SIZE ) ,
406+ } ) ;
407+ }
408+
383409 /**
384410 * Show a page of raw results from the chosen table.
385411 */
386- public async showPageOfResults (
412+ public async showPageOfRawResults (
387413 selectedTable : string ,
388414 pageNumber : number
389415 ) : Promise < void > {
0 commit comments