mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
Fix datavirtualization wizard opening to wrong database (#22232)
* Fix datavirtualization wizard opening to wrong database * vBump
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
"name": "datavirtualization",
|
"name": "datavirtualization",
|
||||||
"displayName": "%title.datavirtualization%",
|
"displayName": "%title.datavirtualization%",
|
||||||
"description": "%config.extensionDescription%",
|
"description": "%config.extensionDescription%",
|
||||||
"version": "1.13.1",
|
"version": "1.13.2",
|
||||||
"publisher": "Microsoft",
|
"publisher": "Microsoft",
|
||||||
"icon": "resources/extension.png",
|
"icon": "resources/extension.png",
|
||||||
"aiKey": "29a207bb14f84905966a8f22524cb730-25407f35-11b6-4d4e-8114-ab9e843cb52f-7380",
|
"aiKey": "29a207bb14f84905966a8f22524cb730-25407f35-11b6-4d4e-8114-ab9e843cb52f-7380",
|
||||||
|
|||||||
@@ -6,11 +6,9 @@
|
|||||||
import * as vscode from 'vscode';
|
import * as vscode from 'vscode';
|
||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import * as nls from 'vscode-nls';
|
import * as nls from 'vscode-nls';
|
||||||
const localize = nls.loadMessageBundle();
|
|
||||||
|
|
||||||
import { ApiWrapper } from './apiWrapper';
|
import { ApiWrapper } from './apiWrapper';
|
||||||
import { TreeNode } from './treeNodes';
|
import { TreeNode } from './treeNodes';
|
||||||
import { QuestionTypes, IPrompter, IQuestion } from './prompts/question';
|
|
||||||
import * as utils from './utils';
|
import * as utils from './utils';
|
||||||
import * as constants from './constants';
|
import * as constants from './constants';
|
||||||
import { AppContext } from './appContext';
|
import { AppContext } from './appContext';
|
||||||
@@ -121,55 +119,3 @@ export abstract class Command extends vscode.Disposable {
|
|||||||
return [{ command: command, type: 'unknown', editor: editor }, args];
|
return [{ command: command, type: 'unknown', editor: editor }, args];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export abstract class ProgressCommand extends Command {
|
|
||||||
static progressId = 0;
|
|
||||||
constructor(private command: string, protected prompter: IPrompter, appContext: AppContext) {
|
|
||||||
super(command, appContext);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected async executeWithProgress(
|
|
||||||
execution: (cancelToken: vscode.CancellationTokenSource) => Promise<void>,
|
|
||||||
label: string,
|
|
||||||
isCancelable: boolean = false,
|
|
||||||
onCanceled?: () => void
|
|
||||||
): Promise<void> {
|
|
||||||
let disposables: vscode.Disposable[] = [];
|
|
||||||
const tokenSource = new vscode.CancellationTokenSource();
|
|
||||||
const statusBarItem = this.apiWrapper.createStatusBarItem(vscode.StatusBarAlignment.Left);
|
|
||||||
disposables.push(vscode.Disposable.from(statusBarItem));
|
|
||||||
statusBarItem.text = localize('progress', '$(sync~spin) {0}...', label);
|
|
||||||
if (isCancelable) {
|
|
||||||
const cancelCommandId = `cancelProgress${ProgressCommand.progressId++}`;
|
|
||||||
disposables.push(this.apiWrapper.registerCommand(cancelCommandId, async () => {
|
|
||||||
if (await this.confirmCancel()) {
|
|
||||||
tokenSource.cancel();
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
statusBarItem.tooltip = localize('cancelTooltip', 'Cancel');
|
|
||||||
statusBarItem.command = cancelCommandId;
|
|
||||||
}
|
|
||||||
statusBarItem.show();
|
|
||||||
|
|
||||||
try {
|
|
||||||
await execution(tokenSource);
|
|
||||||
} catch (error) {
|
|
||||||
if (isCancelable && onCanceled && tokenSource.token.isCancellationRequested) {
|
|
||||||
// The error can be assumed to be due to cancelation occurring. Do the callback
|
|
||||||
onCanceled();
|
|
||||||
} else {
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
disposables.forEach(d => d.dispose());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async confirmCancel(): Promise<boolean> {
|
|
||||||
return await this.prompter.promptSingle<boolean>(<IQuestion>{
|
|
||||||
type: QuestionTypes.confirm,
|
|
||||||
message: localize('cancel', 'Cancel operation?'),
|
|
||||||
default: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -98,5 +98,6 @@ export class OpenMssqlHdfsTableFromFileWizardCommand extends Command {
|
|||||||
function convertIConnectionProfile(profile: azdata.IConnectionProfile): azdata.connection.ConnectionProfile {
|
function convertIConnectionProfile(profile: azdata.IConnectionProfile): azdata.connection.ConnectionProfile {
|
||||||
const connection = azdata.connection.ConnectionProfile.createFrom(profile.options);
|
const connection = azdata.connection.ConnectionProfile.createFrom(profile.options);
|
||||||
connection.providerId = profile.providerName;
|
connection.providerId = profile.providerName;
|
||||||
|
connection.databaseName = profile.databaseName;
|
||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user