Add query text to variant analysis submission
This will add a new query text field to the variant analysis submission, which will also propagate to the variant analysis itself. This will allow us to show the query text on the variant analysis page.
This commit is contained in:
@@ -251,6 +251,8 @@ export async function runRemoteQuery(
|
||||
throw new UserCancellationException(`Found unsupported language: ${language}`);
|
||||
}
|
||||
|
||||
const queryText = await fs.readFile(queryFile, 'utf8');
|
||||
|
||||
const variantAnalysisSubmission: VariantAnalysisSubmission = {
|
||||
startTime: queryStartTime,
|
||||
actionRepoRef: actionBranch,
|
||||
@@ -260,6 +262,7 @@ export async function runRemoteQuery(
|
||||
filePath: queryFile,
|
||||
pack: base64Pack,
|
||||
language: variantAnalysisLanguage,
|
||||
queryText,
|
||||
},
|
||||
databases: {
|
||||
repositories: repoSelection.repositories,
|
||||
|
||||
@@ -7,7 +7,8 @@ export interface VariantAnalysis {
|
||||
query: {
|
||||
name: string,
|
||||
filePath: string,
|
||||
language: VariantAnalysisQueryLanguage
|
||||
language: VariantAnalysisQueryLanguage,
|
||||
queryText: string,
|
||||
},
|
||||
databases: {
|
||||
repositories?: string[],
|
||||
@@ -113,6 +114,7 @@ export interface VariantAnalysisSubmission {
|
||||
name: string,
|
||||
filePath: string,
|
||||
language: VariantAnalysisQueryLanguage,
|
||||
queryText: string,
|
||||
|
||||
// Base64 encoded query pack.
|
||||
pack: string,
|
||||
|
||||
@@ -183,6 +183,7 @@ export class VariantAnalysisManager extends DisposableObject implements VariantA
|
||||
name: `Variant analysis ${variantAnalysisId}`,
|
||||
filePath: `variant_analysis_${variantAnalysisId}.ql`,
|
||||
language: variantAnalysisResponse.query_language as VariantAnalysisQueryLanguage,
|
||||
queryText: '',
|
||||
},
|
||||
databases: {}
|
||||
}, variantAnalysisResponse);
|
||||
|
||||
@@ -27,7 +27,8 @@ export function processVariantAnalysis(
|
||||
query: {
|
||||
name: submission.query.name,
|
||||
filePath: submission.query.filePath,
|
||||
language: submission.query.language
|
||||
language: submission.query.language,
|
||||
queryText: submission.query.queryText,
|
||||
},
|
||||
databases: submission.databases,
|
||||
}, response);
|
||||
@@ -51,11 +52,7 @@ export function processUpdatedVariantAnalysis(
|
||||
const variantAnalysis: VariantAnalysis = {
|
||||
id: response.id,
|
||||
controllerRepoId: response.controller_repo.id,
|
||||
query: {
|
||||
name: previousVariantAnalysis.query.name,
|
||||
filePath: previousVariantAnalysis.query.filePath,
|
||||
language: previousVariantAnalysis.query.language
|
||||
},
|
||||
query: previousVariantAnalysis.query,
|
||||
databases: previousVariantAnalysis.databases,
|
||||
status: processApiStatus(response.status),
|
||||
actionsWorkflowRunId: response.actions_workflow_run_id,
|
||||
|
||||
@@ -17,6 +17,7 @@ describe(VariantAnalysisAnalyzedRepos.name, () => {
|
||||
name: 'Example query',
|
||||
filePath: 'example.ql',
|
||||
language: VariantAnalysisQueryLanguage.Javascript,
|
||||
queryText: 'import javascript\nselect 1',
|
||||
},
|
||||
databases: {},
|
||||
status: VariantAnalysisStatus.InProgress,
|
||||
|
||||
@@ -16,6 +16,7 @@ describe(VariantAnalysisOutcomePanels.name, () => {
|
||||
name: 'Example query',
|
||||
filePath: 'example.ql',
|
||||
language: VariantAnalysisQueryLanguage.Javascript,
|
||||
queryText: 'import javascript\nselect 1',
|
||||
},
|
||||
databases: {},
|
||||
status: VariantAnalysisStatus.InProgress,
|
||||
|
||||
@@ -31,6 +31,7 @@ describe('Variant Analysis processor', function() {
|
||||
'filePath': 'query-file-path',
|
||||
'language': VariantAnalysisQueryLanguage.Javascript,
|
||||
'name': 'query-name',
|
||||
'queryText': mockSubmission.query.queryText,
|
||||
},
|
||||
'databases': {
|
||||
'repositories': ['1', '2', '3'],
|
||||
|
||||
@@ -10,6 +10,7 @@ export function createMockSubmission(): VariantAnalysisSubmission {
|
||||
name: 'query-name',
|
||||
filePath: 'query-file-path',
|
||||
language: VariantAnalysisQueryLanguage.Javascript,
|
||||
queryText: 'query-text',
|
||||
pack: 'base64-encoded-string',
|
||||
},
|
||||
databases: {
|
||||
|
||||
@@ -20,7 +20,8 @@ export function createMockVariantAnalysis(
|
||||
query: {
|
||||
name: 'a-query-name',
|
||||
filePath: 'a-query-file-path',
|
||||
language: VariantAnalysisQueryLanguage.Javascript
|
||||
language: VariantAnalysisQueryLanguage.Javascript,
|
||||
queryText: 'a-query-text',
|
||||
},
|
||||
databases: {
|
||||
repositories: ['1', '2', '3'],
|
||||
|
||||
Reference in New Issue
Block a user