Implement openQueryResults for variant analysis items (#1654)

This commit is contained in:
Shati Patel
2022-10-26 10:20:23 +01:00
committed by GitHub
parent 56af69e58d
commit 50ec71893c
2 changed files with 9 additions and 5 deletions

View File

@@ -910,8 +910,8 @@ export class QueryHistoryManager extends DisposableObject {
// show original query file on double click
await this.handleOpenQuery(finalSingleItem, [finalSingleItem]);
} else {
// show results on single click only if query is completed successfully.
if (finalSingleItem.status === QueryStatus.Completed) {
// show results on single click (if results view is available)
if (finalSingleItem.t === 'variant-analysis' || finalSingleItem.status === QueryStatus.Completed) {
await this.openQueryResults(finalSingleItem);
}
}
@@ -1439,9 +1439,10 @@ the file in the file explorer and dragging it into the workspace.`
private async openQueryResults(item: QueryHistoryInfo) {
if (item.t === 'local') {
await this.localQueriesResultsView.showResults(item as CompletedLocalQueryInfo, WebviewReveal.Forced, false);
}
else if (item.t === 'remote') {
} else if (item.t === 'remote') {
await this.remoteQueriesManager.openRemoteQueryResults(item.queryId);
} else if (item.t === 'variant-analysis') {
await this.variantAnalysisManager.showView(item.variantAnalysis.id);
}
}
}

View File

@@ -25,7 +25,7 @@ import { CodeQLCliServer } from '../cli';
import { getControllerRepo } from './run-remote-query';
import { processUpdatedVariantAnalysis } from './variant-analysis-processor';
import PQueue from 'p-queue';
import { createTimestampFile } from '../helpers';
import { createTimestampFile, showAndLogErrorMessage } from '../helpers';
import { QueryStatus } from '../query-status';
import * as fs from 'fs-extra';
@@ -73,6 +73,9 @@ export class VariantAnalysisManager extends DisposableObject implements VariantA
}
public async showView(variantAnalysisId: number): Promise<void> {
if (!this.variantAnalyses.get(variantAnalysisId)) {
void showAndLogErrorMessage(`No variant analysis found with id: ${variantAnalysisId}.`);
}
if (!this.views.has(variantAnalysisId)) {
// The view will register itself with the manager, so we don't need to do anything here.
this.push(new VariantAnalysisView(this.ctx, variantAnalysisId, this));