Get database sha from result index

This commit is contained in:
shati-patel
2022-03-14 14:41:03 +00:00
committed by Shati Patel
parent bcf79354ee
commit 9d99fc521e
7 changed files with 12 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ import { RemoteQueryFailureIndexItem, RemoteQueryResultIndex, RemoteQuerySuccess
interface ApiSuccessIndexItem {
nwo: string;
id: string;
sha?: string;
results_count: number;
bqrs_file_size: number;
sarif_file_size?: number;
@@ -51,6 +52,7 @@ export async function getRemoteQueryIndex(
id: item.id.toString(),
artifactId: artifactId,
nwo: item.nwo,
sha: item.sha,
resultCount: item.results_count,
bqrsFileSize: item.bqrs_file_size,
sarifFileSize: item.sarif_file_size

View File

@@ -319,6 +319,7 @@ export class RemoteQueriesInterfaceManager {
return sortedAnalysisSummaries.map((analysisResult) => ({
nwo: analysisResult.nwo,
databaseSha: analysisResult.databaseSha,
resultCount: analysisResult.resultCount,
downloadLink: analysisResult.downloadLink,
fileSize: this.formatFileSize(analysisResult.fileSizeInBytes)

View File

@@ -181,6 +181,7 @@ export class RemoteQueriesManager extends DisposableObject {
.slice(0, autoDownloadMaxCount)
.map(a => ({
nwo: a.nwo,
databaseSha: a.databaseSha,
resultCount: a.resultCount,
downloadLink: a.downloadLink,
fileSize: String(a.fileSizeInBytes)
@@ -196,6 +197,7 @@ export class RemoteQueriesManager extends DisposableObject {
const analysisSummaries = resultIndex.successes.map(item => ({
nwo: item.nwo,
databaseSha: item.sha || 'HEAD',
resultCount: item.resultCount,
fileSizeInBytes: item.sarifFileSize ? item.sarifFileSize : item.bqrsFileSize,
downloadLink: {

View File

@@ -8,6 +8,7 @@ export interface RemoteQuerySuccessIndexItem {
id: string;
artifactId: number;
nwo: string;
sha?: string;
resultCount: number;
bqrsFileSize: number;
sarifFileSize?: number;

View File

@@ -10,6 +10,7 @@ export interface RemoteQueryResult {
export interface AnalysisSummary {
nwo: string,
databaseSha: string,
resultCount: number,
downloadLink: DownloadLink,
fileSizeInBytes: number

View File

@@ -43,6 +43,7 @@ export const sampleRemoteQueryResult: RemoteQueryResult = {
analysisSummaries: [
{
nwo: 'big-corp/repo1',
databaseSha: '1234567890',
resultCount: 85,
fileSizeInBytes: 14123,
downloadLink: {
@@ -54,6 +55,7 @@ export const sampleRemoteQueryResult: RemoteQueryResult = {
},
{
nwo: 'big-corp/repo2',
databaseSha: '1234567890',
resultCount: 20,
fileSizeInBytes: 8698,
downloadLink: {
@@ -65,6 +67,7 @@ export const sampleRemoteQueryResult: RemoteQueryResult = {
},
{
nwo: 'big-corp/repo3',
databaseSha: '1234567890',
resultCount: 8,
fileSizeInBytes: 4123,
downloadLink: {
@@ -76,6 +79,7 @@ export const sampleRemoteQueryResult: RemoteQueryResult = {
},
{
nwo: 'big-corp/repo4',
databaseSha: '1234567890',
resultCount: 3,
fileSizeInBytes: 3313,
downloadLink: {

View File

@@ -19,6 +19,7 @@ export interface RemoteQueryResult {
export interface AnalysisSummary {
nwo: string,
databaseSha: string,
resultCount: number,
downloadLink: DownloadLink,
fileSize: string,