mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -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:
@@ -35,7 +35,7 @@ export interface IAccountManagementService {
|
|||||||
beginAutoOAuthDeviceCode(providerId: string, title: string, message: string, userCode: string, uri: string): Promise<void>;
|
beginAutoOAuthDeviceCode(providerId: string, title: string, message: string, userCode: string, uri: string): Promise<void>;
|
||||||
endAutoOAuthDeviceCode(): void;
|
endAutoOAuthDeviceCode(): void;
|
||||||
cancelAutoOAuthDeviceCode(providerId: string): void;
|
cancelAutoOAuthDeviceCode(providerId: string): void;
|
||||||
copyUserCodeAndOpenBrowser(userCode: string, uri: string): void;
|
copyUserCodeAndOpenBrowser(userCode: string, uri: string): Promise<void>;
|
||||||
|
|
||||||
// SERVICE MANAGEMENT METHODS /////////////////////////////////////////
|
// SERVICE MANAGEMENT METHODS /////////////////////////////////////////
|
||||||
registerProvider(providerMetadata: azdata.AccountProviderMetadata, provider: azdata.AccountProvider): void;
|
registerProvider(providerMetadata: azdata.AccountProviderMetadata, provider: azdata.AccountProvider): void;
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ export class TestAccountManagementService implements IAccountManagementService {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
copyUserCodeAndOpenBrowser(userCode: string, uri: string): void {
|
async copyUserCodeAndOpenBrowser(userCode: string, uri: string): Promise<void> {
|
||||||
return undefined;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
getAccountProviderMetadata(): Promise<azdata.AccountProviderMetadata[]> {
|
getAccountProviderMetadata(): Promise<azdata.AccountProviderMetadata[]> {
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ import { localize } from 'vs/nls';
|
|||||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||||
import { URI } from 'vs/base/common/uri';
|
import { URI } from 'vs/base/common/uri';
|
||||||
import { values } from 'vs/base/common/collections';
|
import { values } from 'vs/base/common/collections';
|
||||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
|
||||||
import { ILogService } from 'vs/platform/log/common/log';
|
import { ILogService } from 'vs/platform/log/common/log';
|
||||||
import { INotificationService, Severity, INotification } from 'vs/platform/notification/common/notification';
|
import { INotificationService, Severity, INotification } from 'vs/platform/notification/common/notification';
|
||||||
import { Action } from 'vs/base/common/actions';
|
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
|
* Copy the user code to the clipboard and open a browser to the verification URI
|
||||||
*/
|
*/
|
||||||
public copyUserCodeAndOpenBrowser(userCode: string, uri: string): void {
|
public async copyUserCodeAndOpenBrowser(userCode: string, uri: string): Promise<void> {
|
||||||
this._clipboardService.writeText(userCode).catch(err => onUnexpectedError(err));
|
await this._clipboardService.writeText(userCode);
|
||||||
this._openerService.open(URI.parse(uri)).catch(err => onUnexpectedError(err));
|
await this._openerService.open(URI.parse(uri));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _registerProvider(providerMetadata: azdata.AccountProviderMetadata, provider: azdata.AccountProvider): Promise<void> {
|
private async _registerProvider(providerMetadata: azdata.AccountProviderMetadata, provider: azdata.AccountProvider): Promise<void> {
|
||||||
|
|||||||
@@ -72,9 +72,9 @@ export class AutoOAuthDialogController {
|
|||||||
this._providerId = undefined;
|
this._providerId = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleOnAddAccount(): void {
|
private async handleOnAddAccount(): Promise<void> {
|
||||||
if (this._userCode && this._uri) {
|
if (this._userCode && this._uri) {
|
||||||
this._accountManagementService.copyUserCodeAndOpenBrowser(this._userCode, this._uri);
|
return this._accountManagementService.copyUserCodeAndOpenBrowser(this._userCode, this._uri);
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Missing user code and uri');
|
throw new Error('Missing user code and uri');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user