@@ -4,7 +4,7 @@ import * as Rdom from 'react-dom';
44import { Flash , ThemeProvider } from '@primer/react' ;
55import { ToRemoteQueriesMessage } from '../../pure/interface-types' ;
66import { AnalysisSummary , RemoteQueryResult } from '../shared/remote-query-result' ;
7-
7+ import { MAX_RAW_RESULTS } from '../shared/result-limits' ;
88import { vscode } from '../../view/vscode-api' ;
99
1010import SectionTitle from './SectionTitle' ;
@@ -18,6 +18,7 @@ import DownloadSpinner from './DownloadSpinner';
1818import CollapsibleItem from './CollapsibleItem' ;
1919import { AlertIcon , CodeSquareIcon , FileCodeIcon , FileSymlinkFileIcon , RepoIcon , TerminalIcon } from '@primer/octicons-react' ;
2020import AnalysisAlertResult from './AnalysisAlertResult' ;
21+ import RawResultsTable from './RawResultsTable' ;
2122
2223const numOfReposInContractedMode = 10 ;
2324
@@ -72,8 +73,13 @@ const openQueryTextVirtualFile = (queryResult: RemoteQueryResult) => {
7273 } ) ;
7374} ;
7475
76+ const getAnalysisResultCount = ( analysisResults : AnalysisResults ) : number => {
77+ const rawResultCount = analysisResults . rawResults ?. resultSet . rows . length || 0 ;
78+ return analysisResults . interpretedResults . length + rawResultCount ;
79+ } ;
80+
7581const sumAnalysesResults = ( analysesResults : AnalysisResults [ ] ) =>
76- analysesResults . reduce ( ( acc , curr ) => acc + curr . interpretedResults . length , 0 ) ;
82+ analysesResults . reduce ( ( acc , curr ) => acc + getAnalysisResultCount ( curr ) , 0 ) ;
7783
7884const QueryInfo = ( queryResult : RemoteQueryResult ) => (
7985 < >
@@ -249,22 +255,41 @@ const AnalysesResultsTitle = ({ totalAnalysesResults, totalResults }: { totalAna
249255 return < SectionTitle > { totalAnalysesResults } /{ totalResults } results</ SectionTitle > ;
250256} ;
251257
252- const AnalysesResultsDescription = ( { totalAnalysesResults, totalResults } : { totalAnalysesResults : number , totalResults : number } ) => {
253- if ( totalAnalysesResults < totalResults ) {
254- return < >
255- < VerticalSpace size = { 1 } />
256- Some results haven't been downloaded automatically because of their size or because enough were downloaded already.
257- Download them manually from the list above if you want to see them here.
258- </ > ;
259- }
258+ const AnalysesResultsDescription = ( {
259+ queryResult,
260+ analysesResults,
261+ } : {
262+ queryResult : RemoteQueryResult
263+ analysesResults : AnalysisResults [ ] ,
264+ } ) => {
265+ const showDownloadsMessage = queryResult . analysisSummaries . some (
266+ s => ! analysesResults . some ( a => a . nwo === s . nwo && a . status === 'Completed' ) ) ;
267+ const downloadsMessage = < >
268+ < VerticalSpace size = { 1 } />
269+ Some results haven't been downloaded automatically because of their size or because enough were downloaded already.
270+ Download them manually from the list above if you want to see them here.
271+ </ > ;
272+
273+ const showMaxResultsMessage = analysesResults . some ( a => a . rawResults ?. capped ) ;
274+ const maxRawResultsMessage = < >
275+ < VerticalSpace size = { 1 } />
276+ Some repositories have more than { MAX_RAW_RESULTS } results. We will only show you up to { MAX_RAW_RESULTS }
277+ results for each repository.
278+ </ > ;
260279
261- return < > </ > ;
280+ return (
281+ < >
282+ { showDownloadsMessage && downloadsMessage }
283+ { showMaxResultsMessage && maxRawResultsMessage }
284+ </ >
285+ ) ;
262286} ;
263287
264288const RepoAnalysisResults = ( analysisResults : AnalysisResults ) => {
289+ const numOfResults = getAnalysisResultCount ( analysisResults ) ;
265290 const title = < >
266291 { analysisResults . nwo }
267- < Badge text = { analysisResults . interpretedResults . length . toString ( ) } />
292+ < Badge text = { numOfResults . toString ( ) } />
268293 </ > ;
269294
270295 return (
@@ -276,11 +301,24 @@ const RepoAnalysisResults = (analysisResults: AnalysisResults) => {
276301 < VerticalSpace size = { 2 } />
277302 </ li > ) }
278303 </ ul >
304+ { analysisResults . rawResults &&
305+ < RawResultsTable
306+ schema = { analysisResults . rawResults . schema }
307+ results = { analysisResults . rawResults . resultSet } />
308+ }
279309 </ CollapsibleItem >
280310 ) ;
281311} ;
282312
283- const AnalysesResults = ( { analysesResults, totalResults } : { analysesResults : AnalysisResults [ ] , totalResults : number } ) => {
313+ const AnalysesResults = ( {
314+ queryResult,
315+ analysesResults,
316+ totalResults
317+ } : {
318+ queryResult : RemoteQueryResult ,
319+ analysesResults : AnalysisResults [ ] ,
320+ totalResults : number
321+ } ) => {
284322 const totalAnalysesResults = sumAnalysesResults ( analysesResults ) ;
285323
286324 if ( totalResults === 0 ) {
@@ -294,10 +332,10 @@ const AnalysesResults = ({ analysesResults, totalResults }: { analysesResults: A
294332 totalAnalysesResults = { totalAnalysesResults }
295333 totalResults = { totalResults } />
296334 < AnalysesResultsDescription
297- totalAnalysesResults = { totalAnalysesResults }
298- totalResults = { totalResults } />
335+ queryResult = { queryResult }
336+ analysesResults = { analysesResults } />
299337 < ul className = "vscode-codeql__flat-list" >
300- { analysesResults . filter ( a => a . interpretedResults . length > 0 ) . map ( r =>
338+ { analysesResults . filter ( a => a . interpretedResults . length > 0 || a . rawResults ) . map ( r =>
301339 < li key = { r . nwo } className = "vscode-codeql__analyses-results-list-item" >
302340 < RepoAnalysisResults { ...r } />
303341 </ li > ) }
@@ -340,7 +378,11 @@ export function RemoteQueries(): JSX.Element {
340378 < QueryInfo { ...queryResult } />
341379 < Failures { ...queryResult } />
342380 < Summary queryResult = { queryResult } analysesResults = { analysesResults } />
343- { showAnalysesResults && < AnalysesResults analysesResults = { analysesResults } totalResults = { queryResult . totalResultCount } /> }
381+ { showAnalysesResults &&
382+ < AnalysesResults
383+ queryResult = { queryResult }
384+ analysesResults = { analysesResults }
385+ totalResults = { queryResult . totalResultCount } /> }
344386 </ ThemeProvider >
345387 </ div > ;
346388 } catch ( err ) {
0 commit comments