Move progress notification to cover entire saveModeledMethods message handler
This commit is contained in:
@@ -27,7 +27,10 @@ import { promptImportGithubDatabase } from "../databases/database-fetcher";
|
||||
import { App } from "../common/app";
|
||||
import { showResolvableLocation } from "../databases/local-databases/locations";
|
||||
import { redactableError } from "../common/errors";
|
||||
import { runExternalApiQueries } from "./external-api-usage-queries";
|
||||
import {
|
||||
externalApiQueriesProgressMaxStep,
|
||||
runExternalApiQueries,
|
||||
} from "./external-api-usage-queries";
|
||||
import { Method, Usage } from "./method";
|
||||
import { ModeledMethod } from "./modeled-method";
|
||||
import { ExtensionPack } from "./shared/extension-pack";
|
||||
@@ -205,6 +208,13 @@ export class ModelEditorView extends AbstractWebview<
|
||||
|
||||
break;
|
||||
case "saveModeledMethods":
|
||||
await withProgress(
|
||||
async (progress) => {
|
||||
progress({
|
||||
step: 1,
|
||||
maxStep: 500 + externalApiQueriesProgressMaxStep,
|
||||
message: "Writing model files",
|
||||
});
|
||||
await saveModeledMethods(
|
||||
this.extensionPack,
|
||||
this.databaseItem.name,
|
||||
@@ -215,12 +225,22 @@ export class ModelEditorView extends AbstractWebview<
|
||||
this.cliServer,
|
||||
this.app.logger,
|
||||
);
|
||||
|
||||
await Promise.all([
|
||||
this.setViewState(),
|
||||
withProgress((progress) => this.loadExternalApiUsages(progress), {
|
||||
cancellable: false,
|
||||
this.loadExternalApiUsages((update) =>
|
||||
progress({
|
||||
step: update.step + 500,
|
||||
maxStep: 500 + externalApiQueriesProgressMaxStep,
|
||||
message: `Reloading models: ${update.message}`,
|
||||
}),
|
||||
),
|
||||
]);
|
||||
},
|
||||
{
|
||||
cancellable: false,
|
||||
},
|
||||
);
|
||||
void telemetryListener?.sendUIInteraction(
|
||||
"model-editor-save-modeled-methods",
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user