mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Fixes ADS Web bug around copying user codes and opening a browser tab when adding an Azure Account. (#17760)
* Fixes bug around copying user codes and opening a browser tab. * Code review changes * Additional review changes. * Unnecessary import removed
This commit is contained in:
@@ -21,7 +21,6 @@ import { localize } from 'vs/nls';
|
||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { values } from 'vs/base/common/collections';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { INotificationService, Severity, INotification } from 'vs/platform/notification/common/notification';
|
||||
import { Action } from 'vs/base/common/actions';
|
||||
@@ -362,9 +361,10 @@ export class AccountManagementService implements IAccountManagementService {
|
||||
/**
|
||||
* Copy the user code to the clipboard and open a browser to the verification URI
|
||||
*/
|
||||
public copyUserCodeAndOpenBrowser(userCode: string, uri: string): void {
|
||||
this._clipboardService.writeText(userCode).catch(err => onUnexpectedError(err));
|
||||
this._openerService.open(URI.parse(uri)).catch(err => onUnexpectedError(err));
|
||||
public async copyUserCodeAndOpenBrowser(userCode: string, uri: string): Promise<void> {
|
||||
await this._clipboardService.writeText(userCode);
|
||||
await this._openerService.open(URI.parse(uri));
|
||||
|
||||
}
|
||||
|
||||
private async _registerProvider(providerMetadata: azdata.AccountProviderMetadata, provider: azdata.AccountProvider): Promise<void> {
|
||||
|
||||
@@ -72,9 +72,9 @@ export class AutoOAuthDialogController {
|
||||
this._providerId = undefined;
|
||||
}
|
||||
|
||||
private handleOnAddAccount(): void {
|
||||
private async handleOnAddAccount(): Promise<void> {
|
||||
if (this._userCode && this._uri) {
|
||||
this._accountManagementService.copyUserCodeAndOpenBrowser(this._userCode, this._uri);
|
||||
return this._accountManagementService.copyUserCodeAndOpenBrowser(this._userCode, this._uri);
|
||||
} else {
|
||||
throw new Error('Missing user code and uri');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user