Show dialog with "Are you sure?" for in-progress queries
When you attempt to delete a query that's still in progress from your query history, you get a prompt asking if you're sure. If you pick "Yes", the item is removed and you see a toast notification with a link towards the GitHub Action.
This commit is contained in:
@@ -23,6 +23,7 @@ import {
|
|||||||
showAndLogInformationMessage,
|
showAndLogInformationMessage,
|
||||||
showAndLogWarningMessage,
|
showAndLogWarningMessage,
|
||||||
showBinaryChoiceDialog,
|
showBinaryChoiceDialog,
|
||||||
|
showInformationMessageWithAction,
|
||||||
} from "./helpers";
|
} from "./helpers";
|
||||||
import { extLogger } from "./common";
|
import { extLogger } from "./common";
|
||||||
import { URLSearchParams } from "url";
|
import { URLSearchParams } from "url";
|
||||||
@@ -946,12 +947,20 @@ export class QueryHistoryManager extends DisposableObject {
|
|||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
// We can remove a Variant Analysis locally, but not remotely.
|
// We can remove a Variant Analysis locally, but not remotely.
|
||||||
// The user must cancel the query on GitHub Actions explicitly.
|
// The user must cancel the query on GitHub Actions explicitly.
|
||||||
|
if (item.status === QueryStatus.InProgress) {
|
||||||
|
const response = await showBinaryChoiceDialog(
|
||||||
|
`You are about to delete this query: ${this.labelProvider.getLabel(
|
||||||
|
item,
|
||||||
|
)}. Are you sure?`,
|
||||||
|
);
|
||||||
|
if (!response) return;
|
||||||
|
}
|
||||||
|
|
||||||
this.treeDataProvider.remove(item);
|
this.treeDataProvider.remove(item);
|
||||||
void extLogger.log(`Deleted ${this.labelProvider.getLabel(item)}.`);
|
void extLogger.log(`Deleted ${this.labelProvider.getLabel(item)}.`);
|
||||||
|
|
||||||
if (item.status === QueryStatus.InProgress) {
|
if (item.status === QueryStatus.InProgress) {
|
||||||
void extLogger.log(
|
await this.showToastWithWorkflowRunLink(item);
|
||||||
"The variant analysis is still running on GitHub Actions. To cancel there, you must go to the workflow run in your browser.",
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.variantAnalysisManager.removeVariantAnalysis(
|
await this.variantAnalysisManager.removeVariantAnalysis(
|
||||||
@@ -959,6 +968,24 @@ export class QueryHistoryManager extends DisposableObject {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async showToastWithWorkflowRunLink(
|
||||||
|
item: VariantAnalysisHistoryItem,
|
||||||
|
): Promise<void> {
|
||||||
|
void extLogger.log(
|
||||||
|
"The variant analysis is still running on GitHub Actions. To cancel there, you must go to the workflow run in your browser.",
|
||||||
|
);
|
||||||
|
|
||||||
|
const workflowRunUrl = getActionsWorkflowRunUrl(item);
|
||||||
|
const message = `Remote query has been removed from history. However, the variant analysis is still running on GitHub Actions. To cancel it, you must go to the [workflow run](${workflowRunUrl}) in your browser.`;
|
||||||
|
|
||||||
|
void showInformationMessageWithAction(message, "Go to workflow run").then(
|
||||||
|
async (shouldOpenWorkflowRun) => {
|
||||||
|
if (!shouldOpenWorkflowRun) return;
|
||||||
|
await env.openExternal(Uri.parse(workflowRunUrl));
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
async handleSortByName() {
|
async handleSortByName() {
|
||||||
if (this.treeDataProvider.sortOrder === SortOrder.NameAsc) {
|
if (this.treeDataProvider.sortOrder === SortOrder.NameAsc) {
|
||||||
this.treeDataProvider.sortOrder = SortOrder.NameDesc;
|
this.treeDataProvider.sortOrder = SortOrder.NameDesc;
|
||||||
|
|||||||
Reference in New Issue
Block a user