Merge pull request #2192 from github/robertbrignull/export_selected_results_command
Move codeQL.exportSelectedVariantAnalysisResults to query history manager
This commit is contained in:
Коммит
2334e4e7b2
|
@ -76,6 +76,9 @@ export type QueryHistoryCommands = {
|
|||
"codeQLQueryHistory.itemClicked": SelectionCommandFunction<QueryHistoryInfo>;
|
||||
"codeQLQueryHistory.openOnGithub": SelectionCommandFunction<QueryHistoryInfo>;
|
||||
"codeQLQueryHistory.copyRepoList": SelectionCommandFunction<QueryHistoryInfo>;
|
||||
|
||||
// Commands in the command palette
|
||||
"codeQL.exportSelectedVariantAnalysisResults": () => Promise<void>;
|
||||
};
|
||||
|
||||
// Commands used for the local databases panel
|
||||
|
|
|
@ -101,7 +101,6 @@ import {
|
|||
handleInstallPackDependencies,
|
||||
} from "./packaging";
|
||||
import { HistoryItemLabelProvider } from "./query-history/history-item-label-provider";
|
||||
import { exportSelectedVariantAnalysisResults } from "./variant-analysis/export-results";
|
||||
import { EvalLogViewer } from "./eval-log-viewer";
|
||||
import { SummaryLanguageSupport } from "./log-insights/summary-language-support";
|
||||
import { JoinOrderScannerProvider } from "./log-insights/join-order";
|
||||
|
@ -892,12 +891,6 @@ async function activateWithInstalledDistribution(
|
|||
),
|
||||
);
|
||||
|
||||
ctx.subscriptions.push(
|
||||
commandRunner("codeQL.exportSelectedVariantAnalysisResults", async () => {
|
||||
await exportSelectedVariantAnalysisResults(variantAnalysisManager, qhm);
|
||||
}),
|
||||
);
|
||||
|
||||
ctx.subscriptions.push(
|
||||
commandRunner(
|
||||
"codeQL.loadVariantAnalysisRepoResults",
|
||||
|
|
|
@ -271,6 +271,9 @@ export class QueryHistoryManager extends DisposableObject {
|
|||
"codeQLQueryHistory.itemClicked": this.handleItemClicked.bind(this),
|
||||
"codeQLQueryHistory.openOnGithub": this.handleOpenOnGithub.bind(this),
|
||||
"codeQLQueryHistory.copyRepoList": this.handleCopyRepoList.bind(this),
|
||||
|
||||
"codeQL.exportSelectedVariantAnalysisResults":
|
||||
this.exportSelectedVariantAnalysisResults.bind(this),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -1127,6 +1130,22 @@ export class QueryHistoryManager extends DisposableObject {
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Exports the results of the currently-selected variant analysis.
|
||||
*/
|
||||
async exportSelectedVariantAnalysisResults(): Promise<void> {
|
||||
const queryHistoryItem = this.getCurrentQueryHistoryItem();
|
||||
if (!queryHistoryItem || queryHistoryItem.t !== "variant-analysis") {
|
||||
throw new Error(
|
||||
"No variant analysis results currently open. To open results, click an item in the query history view.",
|
||||
);
|
||||
}
|
||||
|
||||
await this.variantAnalysisManager.exportResults(
|
||||
queryHistoryItem.variantAnalysis.id,
|
||||
);
|
||||
}
|
||||
|
||||
addQuery(item: QueryHistoryInfo) {
|
||||
this.treeDataProvider.pushQuery(item);
|
||||
this.updateTreeViewSelectionIfVisible();
|
||||
|
|
|
@ -16,7 +16,6 @@ import {
|
|||
} from "../commandRunner";
|
||||
import { showInformationMessageWithAction } from "../helpers";
|
||||
import { extLogger } from "../common";
|
||||
import { QueryHistoryManager } from "../query-history/query-history-manager";
|
||||
import { createGist } from "./gh-api/gh-api-client";
|
||||
import {
|
||||
generateVariantAnalysisMarkdown,
|
||||
|
@ -37,25 +36,6 @@ import {
|
|||
} from "../pure/variant-analysis-filter-sort";
|
||||
import { Credentials } from "../common/authentication";
|
||||
|
||||
/**
|
||||
* Exports the results of the currently-selected variant analysis.
|
||||
*/
|
||||
export async function exportSelectedVariantAnalysisResults(
|
||||
variantAnalysisManager: VariantAnalysisManager,
|
||||
queryHistoryManager: QueryHistoryManager,
|
||||
): Promise<void> {
|
||||
const queryHistoryItem = queryHistoryManager.getCurrentQueryHistoryItem();
|
||||
if (!queryHistoryItem || queryHistoryItem.t !== "variant-analysis") {
|
||||
throw new Error(
|
||||
"No variant analysis results currently open. To open results, click an item in the query history view.",
|
||||
);
|
||||
}
|
||||
|
||||
await variantAnalysisManager.exportResults(
|
||||
queryHistoryItem.variantAnalysis.id,
|
||||
);
|
||||
}
|
||||
|
||||
const MAX_VARIANT_ANALYSIS_EXPORT_PROGRESS_STEPS = 2;
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче