Move all progress reporting into extension packs file
This commit is contained in:
@@ -9,7 +9,7 @@ import { join } from "path";
|
|||||||
import { App } from "../common/app";
|
import { App } from "../common/app";
|
||||||
import { showAndLogErrorMessage } from "../helpers";
|
import { showAndLogErrorMessage } from "../helpers";
|
||||||
import { withProgress } from "../progress";
|
import { withProgress } from "../progress";
|
||||||
import { pickExtensionPack, pickModelFile } from "./extension-packs";
|
import { pickExtensionPackModelFile } from "./extension-packs";
|
||||||
|
|
||||||
export class DataExtensionsEditorModule {
|
export class DataExtensionsEditorModule {
|
||||||
private readonly queryStorageDir: string;
|
private readonly queryStorageDir: string;
|
||||||
@@ -67,19 +67,10 @@ export class DataExtensionsEditorModule {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const extensionPackPath = await pickExtensionPack(
|
const modelFile = await pickExtensionPackModelFile(
|
||||||
this.cliServer,
|
this.cliServer,
|
||||||
progress,
|
progress,
|
||||||
);
|
);
|
||||||
if (!extensionPackPath) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const modelFile = await pickModelFile(
|
|
||||||
this.cliServer,
|
|
||||||
progress,
|
|
||||||
extensionPackPath,
|
|
||||||
);
|
|
||||||
if (!modelFile) {
|
if (!modelFile) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,14 +4,33 @@ import { CodeQLCliServer } from "../cli";
|
|||||||
import { getOnDiskWorkspaceFolders, showAndLogErrorMessage } from "../helpers";
|
import { getOnDiskWorkspaceFolders, showAndLogErrorMessage } from "../helpers";
|
||||||
import { ProgressCallback } from "../progress";
|
import { ProgressCallback } from "../progress";
|
||||||
|
|
||||||
export async function pickExtensionPack(
|
const maxStep = 3;
|
||||||
|
|
||||||
|
export async function pickExtensionPackModelFile(
|
||||||
|
cliServer: CodeQLCliServer,
|
||||||
|
progress: ProgressCallback,
|
||||||
|
): Promise<string | undefined> {
|
||||||
|
const extensionPackPath = await pickExtensionPack(cliServer, progress);
|
||||||
|
if (!extensionPackPath) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const modelFile = await pickModelFile(cliServer, progress, extensionPackPath);
|
||||||
|
if (!modelFile) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
return modelFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function pickExtensionPack(
|
||||||
cliServer: CodeQLCliServer,
|
cliServer: CodeQLCliServer,
|
||||||
progress: ProgressCallback,
|
progress: ProgressCallback,
|
||||||
): Promise<string | undefined> {
|
): Promise<string | undefined> {
|
||||||
progress({
|
progress({
|
||||||
message: "Resolving extension packs...",
|
message: "Resolving extension packs...",
|
||||||
step: 1,
|
step: 1,
|
||||||
maxStep: 3,
|
maxStep,
|
||||||
});
|
});
|
||||||
|
|
||||||
// Get all existing extension packs in the workspace
|
// Get all existing extension packs in the workspace
|
||||||
@@ -25,7 +44,7 @@ export async function pickExtensionPack(
|
|||||||
progress({
|
progress({
|
||||||
message: "Choosing extension pack...",
|
message: "Choosing extension pack...",
|
||||||
step: 2,
|
step: 2,
|
||||||
maxStep: 3,
|
maxStep,
|
||||||
});
|
});
|
||||||
|
|
||||||
const extensionPackOption = await window.showQuickPick(options, {
|
const extensionPackOption = await window.showQuickPick(options, {
|
||||||
@@ -53,7 +72,7 @@ export async function pickExtensionPack(
|
|||||||
return extensionPackPaths[0];
|
return extensionPackPaths[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function pickModelFile(
|
async function pickModelFile(
|
||||||
cliServer: CodeQLCliServer,
|
cliServer: CodeQLCliServer,
|
||||||
progress: ProgressCallback,
|
progress: ProgressCallback,
|
||||||
extensionPackPath: string,
|
extensionPackPath: string,
|
||||||
@@ -84,7 +103,7 @@ export async function pickModelFile(
|
|||||||
progress({
|
progress({
|
||||||
message: "Choosing model file...",
|
message: "Choosing model file...",
|
||||||
step: 3,
|
step: 3,
|
||||||
maxStep: 3,
|
maxStep,
|
||||||
});
|
});
|
||||||
|
|
||||||
const fileOption = await window.showQuickPick(fileOptions, {
|
const fileOption = await window.showQuickPick(fileOptions, {
|
||||||
|
|||||||
Reference in New Issue
Block a user