mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Add more to strict nulls (#11871)
* add more to strict nulls * maintain error handling properly * fix lint
This commit is contained in:
@@ -16,7 +16,7 @@ export default class AccountStore implements IAccountStore {
|
|||||||
public static MEMENTO_KEY: string = 'Microsoft.SqlTools.Accounts';
|
public static MEMENTO_KEY: string = 'Microsoft.SqlTools.Accounts';
|
||||||
|
|
||||||
// MEMBER VARIABLES ////////////////////////////////////////////////////
|
// MEMBER VARIABLES ////////////////////////////////////////////////////
|
||||||
private _activeOperation?: Thenable<any>;
|
private _activeOperation?: Promise<any>;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private _memento: { [key: string]: any },
|
private _memento: { [key: string]: any },
|
||||||
@@ -24,7 +24,7 @@ export default class AccountStore implements IAccountStore {
|
|||||||
) { }
|
) { }
|
||||||
|
|
||||||
// PUBLIC METHODS //////////////////////////////////////////////////////
|
// PUBLIC METHODS //////////////////////////////////////////////////////
|
||||||
public addOrUpdate(newAccount: azdata.Account): Thenable<AccountAdditionResult> {
|
public addOrUpdate(newAccount: azdata.Account): Promise<AccountAdditionResult> {
|
||||||
return this.doOperation(() => {
|
return this.doOperation(() => {
|
||||||
return this.readFromMemento()
|
return this.readFromMemento()
|
||||||
.then(accounts => {
|
.then(accounts => {
|
||||||
@@ -35,18 +35,18 @@ export default class AccountStore implements IAccountStore {
|
|||||||
: this.updateAccountList(accounts, newAccount.key, matchAccount => AccountStore.mergeAccounts(newAccount, matchAccount));
|
: this.updateAccountList(accounts, newAccount.key, matchAccount => AccountStore.mergeAccounts(newAccount, matchAccount));
|
||||||
})
|
})
|
||||||
.then(result => this.writeToMemento(result.updatedAccounts).then(() => result))
|
.then(result => this.writeToMemento(result.updatedAccounts).then(() => result))
|
||||||
.then(result => <AccountAdditionResult>result);
|
.then(result => ({ accountAdded: result.accountAdded, accountModified: result.accountModified, changedAccount: result.changedAccount! }));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public getAccountsByProvider(providerId: string): Thenable<azdata.Account[]> {
|
public getAccountsByProvider(providerId: string): Promise<azdata.Account[]> {
|
||||||
return this.doOperation(() => {
|
return this.doOperation(() => {
|
||||||
return this.readFromMemento()
|
return this.readFromMemento()
|
||||||
.then(accounts => accounts.filter(account => account.key.providerId === providerId));
|
.then(accounts => accounts.filter(account => account.key.providerId === providerId));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public getAllAccounts(): Thenable<azdata.Account[]> {
|
public getAllAccounts(): Promise<azdata.Account[]> {
|
||||||
return this.doOperation(() => {
|
return this.doOperation(() => {
|
||||||
return this.cleanupDeprecatedAccounts().then(() => {
|
return this.cleanupDeprecatedAccounts().then(() => {
|
||||||
return this.readFromMemento();
|
return this.readFromMemento();
|
||||||
@@ -54,7 +54,7 @@ export default class AccountStore implements IAccountStore {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public cleanupDeprecatedAccounts(): Thenable<void> {
|
public cleanupDeprecatedAccounts(): Promise<void> {
|
||||||
return this.readFromMemento()
|
return this.readFromMemento()
|
||||||
.then(accounts => {
|
.then(accounts => {
|
||||||
// No need to waste cycles
|
// No need to waste cycles
|
||||||
@@ -80,7 +80,7 @@ export default class AccountStore implements IAccountStore {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public remove(key: azdata.AccountKey): Thenable<boolean> {
|
public remove(key: azdata.AccountKey): Promise<boolean> {
|
||||||
return this.doOperation(() => {
|
return this.doOperation(() => {
|
||||||
return this.readFromMemento()
|
return this.readFromMemento()
|
||||||
.then(accounts => this.removeFromAccountList(accounts, key))
|
.then(accounts => this.removeFromAccountList(accounts, key))
|
||||||
@@ -89,7 +89,7 @@ export default class AccountStore implements IAccountStore {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public update(key: azdata.AccountKey, updateOperation: (account: azdata.Account) => void): Thenable<boolean> {
|
public update(key: azdata.AccountKey, updateOperation: (account: azdata.Account) => void): Promise<boolean> {
|
||||||
return this.doOperation(() => {
|
return this.doOperation(() => {
|
||||||
return this.readFromMemento()
|
return this.readFromMemento()
|
||||||
.then(accounts => this.updateAccountList(accounts, key, updateOperation))
|
.then(accounts => this.updateAccountList(accounts, key, updateOperation))
|
||||||
@@ -115,7 +115,7 @@ export default class AccountStore implements IAccountStore {
|
|||||||
target.isStale = source.isStale;
|
target.isStale = source.isStale;
|
||||||
}
|
}
|
||||||
|
|
||||||
private doOperation<T>(op: () => Thenable<T>) {
|
private doOperation<T>(op: () => Promise<T>) {
|
||||||
// Initialize the active operation to an empty promise if necessary
|
// Initialize the active operation to an empty promise if necessary
|
||||||
let activeOperation = this._activeOperation || Promise.resolve<any>(null);
|
let activeOperation = this._activeOperation || Promise.resolve<any>(null);
|
||||||
|
|
||||||
@@ -201,7 +201,7 @@ export default class AccountStore implements IAccountStore {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MEMENTO IO METHODS //////////////////////////////////////////////////
|
// MEMENTO IO METHODS //////////////////////////////////////////////////
|
||||||
private readFromMemento(): Thenable<azdata.Account[]> {
|
private readFromMemento(): Promise<azdata.Account[]> {
|
||||||
// Initialize the account list if it isn't already
|
// Initialize the account list if it isn't already
|
||||||
let accounts = this._memento[AccountStore.MEMENTO_KEY];
|
let accounts = this._memento[AccountStore.MEMENTO_KEY];
|
||||||
if (!accounts) {
|
if (!accounts) {
|
||||||
@@ -214,14 +214,17 @@ export default class AccountStore implements IAccountStore {
|
|||||||
return Promise.resolve(accounts);
|
return Promise.resolve(accounts);
|
||||||
}
|
}
|
||||||
|
|
||||||
private writeToMemento(accounts: azdata.Account[]): Thenable<void> {
|
private writeToMemento(accounts: azdata.Account[]): Promise<void> {
|
||||||
// Store a shallow copy of the account list to disconnect the memento list from the active list
|
// Store a shallow copy of the account list to disconnect the memento list from the active list
|
||||||
this._memento[AccountStore.MEMENTO_KEY] = deepClone(accounts);
|
this._memento[AccountStore.MEMENTO_KEY] = deepClone(accounts);
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AccountListOperationResult extends AccountAdditionResult {
|
interface AccountListOperationResult {
|
||||||
accountRemoved: boolean;
|
accountRemoved: boolean;
|
||||||
updatedAccounts: azdata.Account[];
|
updatedAccounts: azdata.Account[];
|
||||||
|
changedAccount: azdata.Account | undefined;
|
||||||
|
accountAdded: boolean;
|
||||||
|
accountModified: boolean;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,27 +41,24 @@ export class AccountViewModel {
|
|||||||
* and fires an event after each provider/accounts has been loaded.
|
* and fires an event after each provider/accounts has been loaded.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public initialize(): Thenable<AccountProviderAddedEventParams[]> {
|
public initialize(): Promise<AccountProviderAddedEventParams[]> {
|
||||||
// Load a baseline of the account provider metadata and accounts
|
// Load a baseline of the account provider metadata and accounts
|
||||||
// 1) Get all the providers from the account management service
|
// 1) Get all the providers from the account management service
|
||||||
// 2) For each provider, get the accounts
|
// 2) For each provider, get the accounts
|
||||||
// 3) Build parameters to add a provider and return it
|
// 3) Build parameters to add a provider and return it
|
||||||
return this._accountManagementService.getAccountProviderMetadata()
|
return this._accountManagementService.getAccountProviderMetadata()
|
||||||
.then(
|
.then(providers => {
|
||||||
(providers: azdata.AccountProviderMetadata[]) => {
|
const promises = providers.map(provider => {
|
||||||
const promises = providers.map(provider => {
|
return this._accountManagementService.getAccountsForProvider(provider.id)
|
||||||
return this._accountManagementService.getAccountsForProvider(provider.id)
|
.then(accounts => <AccountProviderAddedEventParams>{
|
||||||
.then(
|
addedProvider: provider,
|
||||||
accounts => <AccountProviderAddedEventParams>{
|
initialAccounts: accounts
|
||||||
addedProvider: provider,
|
}, () => undefined);
|
||||||
initialAccounts: accounts
|
|
||||||
},
|
|
||||||
() => { /* Swallow failures at getting accounts, we'll just hide that provider */ });
|
|
||||||
});
|
|
||||||
return Promise.all(promises).then(accounts => coalesce(accounts));
|
|
||||||
}, () => {
|
|
||||||
/* Swallow failures and just pretend we don't have any providers */
|
|
||||||
return [];
|
|
||||||
});
|
});
|
||||||
|
return Promise.all(promises).then(accounts => coalesce(accounts));
|
||||||
|
}, () => {
|
||||||
|
/* Swallow failures and just pretend we don't have any providers */
|
||||||
|
return [];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export interface AccountAdditionResult {
|
|||||||
/**
|
/**
|
||||||
* The account that was added/updated (with any updates applied)
|
* The account that was added/updated (with any updates applied)
|
||||||
*/
|
*/
|
||||||
changedAccount: azdata.Account | undefined;
|
changedAccount: azdata.Account;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -16,23 +16,23 @@ export interface IAccountManagementService {
|
|||||||
_serviceBrand: undefined;
|
_serviceBrand: undefined;
|
||||||
|
|
||||||
// ACCOUNT MANAGEMENT METHODS //////////////////////////////////////////
|
// ACCOUNT MANAGEMENT METHODS //////////////////////////////////////////
|
||||||
accountUpdated(account: azdata.Account): Thenable<void>;
|
accountUpdated(account: azdata.Account): Promise<void>;
|
||||||
addAccount(providerId: string): Thenable<void>;
|
addAccount(providerId: string): Promise<void>;
|
||||||
getAccountProviderMetadata(): Thenable<azdata.AccountProviderMetadata[]>;
|
getAccountProviderMetadata(): Promise<azdata.AccountProviderMetadata[]>;
|
||||||
getAccountsForProvider(providerId: string): Thenable<azdata.Account[]>;
|
getAccountsForProvider(providerId: string): Promise<azdata.Account[]>;
|
||||||
getAccounts(): Thenable<azdata.Account[]>;
|
getAccounts(): Promise<azdata.Account[]>;
|
||||||
/**
|
/**
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
getSecurityToken(account: azdata.Account, resource: azdata.AzureResource): Thenable<{ [key: string]: { token: string } }>;
|
getSecurityToken(account: azdata.Account, resource: azdata.AzureResource): Promise<{ [key: string]: { token: string } } | undefined>;
|
||||||
getAccountSecurityToken(account: azdata.Account, tenant: string, resource: azdata.AzureResource): Thenable<{ token: string }>;
|
getAccountSecurityToken(account: azdata.Account, tenant: string, resource: azdata.AzureResource): Promise<{ token: string } | undefined>;
|
||||||
removeAccount(accountKey: azdata.AccountKey): Thenable<boolean>;
|
removeAccount(accountKey: azdata.AccountKey): Promise<boolean>;
|
||||||
removeAccounts(): Thenable<boolean>;
|
removeAccounts(): Promise<boolean>;
|
||||||
refreshAccount(account: azdata.Account): Thenable<azdata.Account>;
|
refreshAccount(account: azdata.Account): Promise<azdata.Account>;
|
||||||
|
|
||||||
// UI METHODS //////////////////////////////////////////////////////////
|
// UI METHODS //////////////////////////////////////////////////////////
|
||||||
openAccountListDialog(): Thenable<void>;
|
openAccountListDialog(): Promise<void>;
|
||||||
beginAutoOAuthDeviceCode(providerId: string, title: string, message: string, userCode: string, uri: string): Thenable<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): void;
|
||||||
@@ -61,20 +61,20 @@ export interface IAccountStore {
|
|||||||
* @param account Account to add/update
|
* @param account Account to add/update
|
||||||
* @return Results of the add/update operation
|
* @return Results of the add/update operation
|
||||||
*/
|
*/
|
||||||
addOrUpdate(account: azdata.Account): Thenable<AccountAdditionResult>;
|
addOrUpdate(account: azdata.Account): Promise<AccountAdditionResult>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves all accounts, filtered by provider ID
|
* Retrieves all accounts, filtered by provider ID
|
||||||
* @param providerId ID of the provider to filter by
|
* @param providerId ID of the provider to filter by
|
||||||
* @return Promise to return all accounts that belong to the provided provider
|
* @return Promise to return all accounts that belong to the provided provider
|
||||||
*/
|
*/
|
||||||
getAccountsByProvider(providerId: string): Thenable<azdata.Account[]>;
|
getAccountsByProvider(providerId: string): Promise<azdata.Account[]>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves all accounts in the store. Returns empty array if store is not initialized
|
* Retrieves all accounts in the store. Returns empty array if store is not initialized
|
||||||
* @return Promise to return all accounts
|
* @return Promise to return all accounts
|
||||||
*/
|
*/
|
||||||
getAllAccounts(): Thenable<azdata.Account[]>;
|
getAllAccounts(): Promise<azdata.Account[]>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes an account.
|
* Removes an account.
|
||||||
@@ -83,7 +83,7 @@ export interface IAccountStore {
|
|||||||
* @param key - The key of an account.
|
* @param key - The key of an account.
|
||||||
* @returns True if the account was removed, false if the account doesn't exist
|
* @returns True if the account was removed, false if the account doesn't exist
|
||||||
*/
|
*/
|
||||||
remove(key: azdata.AccountKey): Thenable<boolean>;
|
remove(key: azdata.AccountKey): Promise<boolean>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the custom properties stored with an account.
|
* Updates the custom properties stored with an account.
|
||||||
@@ -93,5 +93,5 @@ export interface IAccountStore {
|
|||||||
* @param updateOperation - Operation to perform on the matching account
|
* @param updateOperation - Operation to perform on the matching account
|
||||||
* @returns True if the account was modified, false if the account doesn't exist
|
* @returns True if the account was modified, false if the account doesn't exist
|
||||||
*/
|
*/
|
||||||
update(key: azdata.AccountKey, updateOperation: (account: azdata.Account) => void): Thenable<boolean>;
|
update(key: azdata.AccountKey, updateOperation: (account: azdata.Account) => void): Promise<boolean>;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,15 +15,15 @@ export class TestAccountManagementService implements IAccountManagementService {
|
|||||||
public get removeAccountProviderEvent(): Event<azdata.AccountProviderMetadata> { return Event.None; }
|
public get removeAccountProviderEvent(): Event<azdata.AccountProviderMetadata> { return Event.None; }
|
||||||
public get updateAccountListEvent(): Event<UpdateAccountListEventParams> { return Event.None; }
|
public get updateAccountListEvent(): Event<UpdateAccountListEventParams> { return Event.None; }
|
||||||
|
|
||||||
accountUpdated(account: azdata.Account): Thenable<void> {
|
accountUpdated(account: azdata.Account): Promise<void> {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
addAccount(providerId: string): Thenable<void> {
|
addAccount(providerId: string): Promise<void> {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
beginAutoOAuthDeviceCode(title: string, message: string, userCode: string, uri: string): Thenable<void> {
|
beginAutoOAuthDeviceCode(title: string, message: string, userCode: string, uri: string): Promise<void> {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,35 +39,35 @@ export class TestAccountManagementService implements IAccountManagementService {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
getAccountProviderMetadata(): Thenable<azdata.AccountProviderMetadata[]> {
|
getAccountProviderMetadata(): Promise<azdata.AccountProviderMetadata[]> {
|
||||||
return Promise.resolve([]);
|
return Promise.resolve([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
getAccounts(): Thenable<azdata.Account[]> {
|
getAccounts(): Promise<azdata.Account[]> {
|
||||||
return Promise.resolve([]);
|
return Promise.resolve([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
getAccountsForProvider(providerId: string): Thenable<azdata.Account[]> {
|
getAccountsForProvider(providerId: string): Promise<azdata.Account[]> {
|
||||||
return Promise.resolve([]);
|
return Promise.resolve([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
getSecurityToken(account: azdata.Account, resource: azdata.AzureResource): Thenable<{}> {
|
getSecurityToken(account: azdata.Account, resource: azdata.AzureResource): Promise<{}> {
|
||||||
return Promise.resolve([]);
|
return Promise.resolve([]);
|
||||||
}
|
}
|
||||||
|
|
||||||
getAccountSecurityToken(account: azdata.Account, tenant: string, resource: azdata.AzureResource): Thenable<{ token: string }> {
|
getAccountSecurityToken(account: azdata.Account, tenant: string, resource: azdata.AzureResource): Promise<{ token: string }> {
|
||||||
return Promise.resolve(undefined!);
|
return Promise.resolve(undefined!);
|
||||||
}
|
}
|
||||||
|
|
||||||
removeAccount(accountKey: azdata.AccountKey): Thenable<boolean> {
|
removeAccount(accountKey: azdata.AccountKey): Promise<boolean> {
|
||||||
throw new Error('Method not implemented');
|
throw new Error('Method not implemented');
|
||||||
}
|
}
|
||||||
|
|
||||||
removeAccounts(): Thenable<boolean> {
|
removeAccounts(): Promise<boolean> {
|
||||||
throw new Error('Method not implemented');
|
throw new Error('Method not implemented');
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshAccount(account: azdata.Account): Thenable<azdata.Account> {
|
refreshAccount(account: azdata.Account): Promise<azdata.Account> {
|
||||||
throw new Error('Method not implemented');
|
throw new Error('Method not implemented');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,44 +83,44 @@ const tabbableElementsQuerySelector = 'a[href], area[href], input:not([disabled]
|
|||||||
|
|
||||||
export abstract class Modal extends Disposable implements IThemable {
|
export abstract class Modal extends Disposable implements IThemable {
|
||||||
protected _useDefaultMessageBoxLocation: boolean = true;
|
protected _useDefaultMessageBoxLocation: boolean = true;
|
||||||
protected _messageElement: HTMLElement;
|
protected _messageElement?: HTMLElement;
|
||||||
protected _modalOptions: IModalOptions;
|
protected _modalOptions: IModalOptions;
|
||||||
protected readonly disposableStore = this._register(new DisposableStore());
|
protected readonly disposableStore = this._register(new DisposableStore());
|
||||||
private _detailsButtonContainer: HTMLElement;
|
private _detailsButtonContainer?: HTMLElement;
|
||||||
private _messageIcon: HTMLElement;
|
private _messageIcon?: HTMLElement;
|
||||||
private _messageSeverity: HTMLElement;
|
private _messageSeverity?: HTMLElement;
|
||||||
private _messageSummary: HTMLElement;
|
private _messageSummary?: HTMLElement;
|
||||||
private _messageBody: HTMLElement;
|
private _messageBody?: HTMLElement;
|
||||||
private _messageDetail: HTMLElement;
|
private _messageDetail?: HTMLElement;
|
||||||
private _toggleMessageDetailButton: Button;
|
private _toggleMessageDetailButton?: Button;
|
||||||
private _copyMessageButton: Button;
|
private _copyMessageButton?: Button;
|
||||||
private _closeMessageButton: Button;
|
private _closeMessageButton?: Button;
|
||||||
private _messageSummaryText: string;
|
private _messageSummaryText?: string;
|
||||||
private _messageDetailText: string;
|
private _messageDetailText?: string;
|
||||||
|
|
||||||
private _spinnerElement: HTMLElement;
|
private _spinnerElement?: HTMLElement;
|
||||||
private _firstTabbableElement: HTMLElement; // The first element in the dialog the user could tab to
|
private _firstTabbableElement?: HTMLElement; // The first element in the dialog the user could tab to
|
||||||
private _lastTabbableElement: HTMLElement; // The last element in the dialog the user could tab to
|
private _lastTabbableElement?: HTMLElement; // The last element in the dialog the user could tab to
|
||||||
private _focusedElementBeforeOpen: HTMLElement;
|
private _focusedElementBeforeOpen?: HTMLElement;
|
||||||
|
|
||||||
private _dialogForeground?: Color;
|
private _dialogForeground?: Color;
|
||||||
private _dialogBorder?: Color;
|
private _dialogBorder?: Color;
|
||||||
private _dialogHeaderAndFooterBackground?: Color;
|
private _dialogHeaderAndFooterBackground?: Color;
|
||||||
private _dialogBodyBackground?: Color;
|
private _dialogBodyBackground?: Color;
|
||||||
|
|
||||||
private _modalDialog: HTMLElement;
|
private _modalDialog?: HTMLElement;
|
||||||
private _modalContent: HTMLElement;
|
private _modalContent?: HTMLElement;
|
||||||
private _modalHeaderSection: HTMLElement;
|
private _modalHeaderSection?: HTMLElement;
|
||||||
private _modalBodySection: HTMLElement;
|
private _modalBodySection?: HTMLElement;
|
||||||
private _modalFooterSection: HTMLElement;
|
private _modalFooterSection?: HTMLElement;
|
||||||
private _closeButtonInHeader: HTMLElement;
|
private _closeButtonInHeader?: HTMLElement;
|
||||||
private _bodyContainer: HTMLElement;
|
private _bodyContainer?: HTMLElement;
|
||||||
private _modalTitle: HTMLElement;
|
private _modalTitle?: HTMLElement;
|
||||||
private _modalTitleIcon: HTMLElement;
|
private _modalTitleIcon?: HTMLElement;
|
||||||
private _leftFooter: HTMLElement;
|
private _leftFooter?: HTMLElement;
|
||||||
private _rightFooter: HTMLElement;
|
private _rightFooter?: HTMLElement;
|
||||||
private _footerButtons: Button[];
|
private _footerButtons: Button[] = [];
|
||||||
private _backButton: Button;
|
private _backButton?: Button;
|
||||||
|
|
||||||
private _modalShowingContext: IContextKey<Array<string>>;
|
private _modalShowingContext: IContextKey<Array<string>>;
|
||||||
private readonly _staticKey: string;
|
private readonly _staticKey: string;
|
||||||
@@ -128,7 +128,7 @@ export abstract class Modal extends Disposable implements IThemable {
|
|||||||
/**
|
/**
|
||||||
* Get the back button, only available after render and if the hasBackButton option is true
|
* Get the back button, only available after render and if the hasBackButton option is true
|
||||||
*/
|
*/
|
||||||
protected get backButton(): Button {
|
protected get backButton(): Button | undefined {
|
||||||
return this._backButton;
|
return this._backButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@ export abstract class Modal extends Disposable implements IThemable {
|
|||||||
* (hyoshi - 10/2/2017 tracked by https://github.com/Microsoft/carbon/issues/1836)
|
* (hyoshi - 10/2/2017 tracked by https://github.com/Microsoft/carbon/issues/1836)
|
||||||
*/
|
*/
|
||||||
public setWide(isWide: boolean): void {
|
public setWide(isWide: boolean): void {
|
||||||
DOM.toggleClass(this._bodyContainer, 'wide', isWide);
|
DOM.toggleClass(this._bodyContainer!, 'wide', isWide);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -165,7 +165,6 @@ export abstract class Modal extends Disposable implements IThemable {
|
|||||||
mixin(this._modalOptions, defaultOptions, false);
|
mixin(this._modalOptions, defaultOptions, false);
|
||||||
this._staticKey = generateUuid();
|
this._staticKey = generateUuid();
|
||||||
this._modalShowingContext = MODAL_SHOWING_CONTEXT.bindTo(_contextKeyService);
|
this._modalShowingContext = MODAL_SHOWING_CONTEXT.bindTo(_contextKeyService);
|
||||||
this._footerButtons = [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -248,7 +247,7 @@ export abstract class Modal extends Disposable implements IThemable {
|
|||||||
this._modalFooterSection = DOM.append(this._modalContent, DOM.$('.modal-footer'));
|
this._modalFooterSection = DOM.append(this._modalContent, DOM.$('.modal-footer'));
|
||||||
if (this._modalOptions.hasSpinner) {
|
if (this._modalOptions.hasSpinner) {
|
||||||
this._spinnerElement = DOM.append(this._modalFooterSection, DOM.$('.codicon.in-progress'));
|
this._spinnerElement = DOM.append(this._modalFooterSection, DOM.$('.codicon.in-progress'));
|
||||||
this._spinnerElement.setAttribute('title', this._modalOptions.spinnerTitle);
|
this._spinnerElement.setAttribute('title', this._modalOptions.spinnerTitle ?? '');
|
||||||
DOM.hide(this._spinnerElement);
|
DOM.hide(this._spinnerElement);
|
||||||
}
|
}
|
||||||
this._leftFooter = DOM.append(this._modalFooterSection, DOM.$('.left-footer'));
|
this._leftFooter = DOM.append(this._modalFooterSection, DOM.$('.left-footer'));
|
||||||
@@ -294,42 +293,42 @@ export abstract class Modal extends Disposable implements IThemable {
|
|||||||
|
|
||||||
private getTextForClipboard(): string {
|
private getTextForClipboard(): string {
|
||||||
const eol = this.textResourcePropertiesService.getEOL(URI.from({ scheme: Schemas.untitled }));
|
const eol = this.textResourcePropertiesService.getEOL(URI.from({ scheme: Schemas.untitled }));
|
||||||
return this._messageDetailText === '' ? this._messageSummaryText : `${this._messageSummaryText}${eol}========================${eol}${this._messageDetailText}`;
|
return this._messageDetailText === '' ? this._messageSummaryText! : `${this._messageSummaryText}${eol}========================${eol}${this._messageDetailText}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateExpandMessageState() {
|
private updateExpandMessageState() {
|
||||||
this._messageSummary.style.cursor = this.shouldShowExpandMessageButton ? 'pointer' : 'default';
|
this._messageSummary!.style.cursor = this.shouldShowExpandMessageButton ? 'pointer' : 'default';
|
||||||
DOM.removeClass(this._messageSummary, MESSAGE_EXPANDED_MODE_CLASS);
|
DOM.removeClass(this._messageSummary!, MESSAGE_EXPANDED_MODE_CLASS);
|
||||||
if (this.shouldShowExpandMessageButton) {
|
if (this.shouldShowExpandMessageButton) {
|
||||||
DOM.append(this._detailsButtonContainer, this._toggleMessageDetailButton.element);
|
DOM.append(this._detailsButtonContainer!, this._toggleMessageDetailButton!.element);
|
||||||
} else {
|
} else {
|
||||||
DOM.removeNode(this._toggleMessageDetailButton.element);
|
DOM.removeNode(this._toggleMessageDetailButton!.element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private toggleMessageDetail() {
|
private toggleMessageDetail() {
|
||||||
const isExpanded = DOM.hasClass(this._messageSummary, MESSAGE_EXPANDED_MODE_CLASS);
|
const isExpanded = DOM.hasClass(this._messageSummary!, MESSAGE_EXPANDED_MODE_CLASS);
|
||||||
DOM.toggleClass(this._messageSummary, MESSAGE_EXPANDED_MODE_CLASS, !isExpanded);
|
DOM.toggleClass(this._messageSummary!, MESSAGE_EXPANDED_MODE_CLASS, !isExpanded);
|
||||||
this._toggleMessageDetailButton.label = isExpanded ? SHOW_DETAILS_TEXT : localize('hideMessageDetails', "Hide Details");
|
this._toggleMessageDetailButton!.label = isExpanded ? SHOW_DETAILS_TEXT : localize('hideMessageDetails', "Hide Details");
|
||||||
|
|
||||||
if (this._messageDetailText) {
|
if (this._messageDetailText) {
|
||||||
if (isExpanded) {
|
if (isExpanded) {
|
||||||
DOM.removeNode(this._messageDetail);
|
DOM.removeNode(this._messageDetail!);
|
||||||
} else {
|
} else {
|
||||||
DOM.append(this._messageBody, this._messageDetail);
|
DOM.append(this._messageBody!, this._messageDetail!);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private get shouldShowExpandMessageButton(): boolean {
|
private get shouldShowExpandMessageButton(): boolean {
|
||||||
return this._messageDetailText !== '' || this._messageSummary.scrollWidth > this._messageSummary.offsetWidth;
|
return this._messageDetailText !== '' || this._messageSummary!.scrollWidth > this._messageSummary!.offsetWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Figures out the first and last elements which the user can tab to in the dialog
|
* Figures out the first and last elements which the user can tab to in the dialog
|
||||||
*/
|
*/
|
||||||
public setFirstLastTabbableElement() {
|
public setFirstLastTabbableElement() {
|
||||||
const tabbableElements = this._bodyContainer.querySelectorAll(tabbableElementsQuerySelector);
|
const tabbableElements = this._bodyContainer!.querySelectorAll(tabbableElementsQuerySelector);
|
||||||
if (tabbableElements && tabbableElements.length > 0) {
|
if (tabbableElements && tabbableElements.length > 0) {
|
||||||
this._firstTabbableElement = <HTMLElement>tabbableElements[0];
|
this._firstTabbableElement = <HTMLElement>tabbableElements[0];
|
||||||
this._lastTabbableElement = <HTMLElement>tabbableElements[tabbableElements.length - 1];
|
this._lastTabbableElement = <HTMLElement>tabbableElements[tabbableElements.length - 1];
|
||||||
@@ -344,7 +343,7 @@ export abstract class Modal extends Disposable implements IThemable {
|
|||||||
// This ensures that we are setting the focus on a useful element in the form when possible.
|
// This ensures that we are setting the focus on a useful element in the form when possible.
|
||||||
const focusableElements = this._modalBodySection ?
|
const focusableElements = this._modalBodySection ?
|
||||||
this._modalBodySection.querySelectorAll(tabbableElementsQuerySelector) :
|
this._modalBodySection.querySelectorAll(tabbableElementsQuerySelector) :
|
||||||
this._bodyContainer.querySelectorAll(tabbableElementsQuerySelector);
|
this._bodyContainer!.querySelectorAll(tabbableElementsQuerySelector);
|
||||||
|
|
||||||
if (focusableElements && focusableElements.length > 0) {
|
if (focusableElements && focusableElements.length > 0) {
|
||||||
(<HTMLElement>focusableElements[0]).focus();
|
(<HTMLElement>focusableElements[0]).focus();
|
||||||
@@ -357,7 +356,7 @@ export abstract class Modal extends Disposable implements IThemable {
|
|||||||
protected show() {
|
protected show() {
|
||||||
this._focusedElementBeforeOpen = <HTMLElement>document.activeElement;
|
this._focusedElementBeforeOpen = <HTMLElement>document.activeElement;
|
||||||
this._modalShowingContext.get()!.push(this._staticKey);
|
this._modalShowingContext.get()!.push(this._staticKey);
|
||||||
DOM.append(this.layoutService.container, this._bodyContainer);
|
DOM.append(this.layoutService.container, this._bodyContainer!);
|
||||||
this.setInitialFocusedElement();
|
this.setInitialFocusedElement();
|
||||||
|
|
||||||
this.disposableStore.add(DOM.addDisposableListener(document, DOM.EventType.KEY_DOWN, (e: KeyboardEvent) => {
|
this.disposableStore.add(DOM.addDisposableListener(document, DOM.EventType.KEY_DOWN, (e: KeyboardEvent) => {
|
||||||
@@ -376,10 +375,10 @@ export abstract class Modal extends Disposable implements IThemable {
|
|||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
this.disposableStore.add(DOM.addDisposableListener(window, DOM.EventType.RESIZE, (e: Event) => {
|
this.disposableStore.add(DOM.addDisposableListener(window, DOM.EventType.RESIZE, (e: Event) => {
|
||||||
this.layout(DOM.getTotalHeight(this._modalBodySection));
|
this.layout(DOM.getTotalHeight(this._modalBodySection!));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this.layout(DOM.getTotalHeight(this._modalBodySection));
|
this.layout(DOM.getTotalHeight(this._modalBodySection!));
|
||||||
this._telemetryService.createActionEvent(TelemetryKeys.TelemetryView.Shell, TelemetryKeys.ModalDialogOpened)
|
this._telemetryService.createActionEvent(TelemetryKeys.TelemetryView.Shell, TelemetryKeys.ModalDialogOpened)
|
||||||
.withAdditionalProperties({ name: this._name })
|
.withAdditionalProperties({ name: this._name })
|
||||||
.send();
|
.send();
|
||||||
@@ -395,7 +394,7 @@ export abstract class Modal extends Disposable implements IThemable {
|
|||||||
*/
|
*/
|
||||||
protected hide() {
|
protected hide() {
|
||||||
this._modalShowingContext.get()!.pop();
|
this._modalShowingContext.get()!.pop();
|
||||||
this._bodyContainer.remove();
|
this._bodyContainer!.remove();
|
||||||
this.disposableStore.clear();
|
this.disposableStore.clear();
|
||||||
this._telemetryService.createActionEvent(TelemetryKeys.TelemetryView.Shell, TelemetryKeys.ModalDialogClosed)
|
this._telemetryService.createActionEvent(TelemetryKeys.TelemetryView.Shell, TelemetryKeys.ModalDialogClosed)
|
||||||
.withAdditionalProperties({ name: this._name })
|
.withAdditionalProperties({ name: this._name })
|
||||||
@@ -420,9 +419,9 @@ export abstract class Modal extends Disposable implements IThemable {
|
|||||||
button.label = label;
|
button.label = label;
|
||||||
button.onDidClick(() => onSelect()); // @todo this should be registered to dispose but that brakes some dialogs
|
button.onDidClick(() => onSelect()); // @todo this should be registered to dispose but that brakes some dialogs
|
||||||
if (orientation === 'left') {
|
if (orientation === 'left') {
|
||||||
DOM.append(this._leftFooter, footerButton);
|
DOM.append(this._leftFooter!, footerButton);
|
||||||
} else {
|
} else {
|
||||||
DOM.append(this._rightFooter, footerButton);
|
DOM.append(this._rightFooter!, footerButton);
|
||||||
}
|
}
|
||||||
this._footerButtons.push(button);
|
this._footerButtons.push(button);
|
||||||
return button;
|
return button;
|
||||||
@@ -433,7 +432,7 @@ export abstract class Modal extends Disposable implements IThemable {
|
|||||||
* @param label Label to show on the button
|
* @param label Label to show on the button
|
||||||
* @param onSelect The callback to call when the button is selected
|
* @param onSelect The callback to call when the button is selected
|
||||||
*/
|
*/
|
||||||
protected findFooterButton(label: string): Button {
|
protected findFooterButton(label: string): Button | undefined {
|
||||||
return find(this._footerButtons, e => {
|
return find(this._footerButtons, e => {
|
||||||
try {
|
try {
|
||||||
return e && e.element.innerText === label;
|
return e && e.element.innerText === label;
|
||||||
@@ -482,17 +481,17 @@ export abstract class Modal extends Disposable implements IThemable {
|
|||||||
severityText = WARNING_ALT_TEXT;
|
severityText = WARNING_ALT_TEXT;
|
||||||
}
|
}
|
||||||
levelClasses.forEach(level => {
|
levelClasses.forEach(level => {
|
||||||
DOM.toggleClass(this._messageIcon, level, selectedLevel === level);
|
DOM.toggleClass(this._messageIcon!, level, selectedLevel === level);
|
||||||
DOM.toggleClass(this._messageElement, level, selectedLevel === level);
|
DOM.toggleClass(this._messageElement!, level, selectedLevel === level);
|
||||||
});
|
});
|
||||||
|
|
||||||
this._messageIcon.title = severityText;
|
this._messageIcon!.title = severityText;
|
||||||
this._messageSeverity.innerText = severityText;
|
this._messageSeverity!.innerText = severityText;
|
||||||
this._messageSummary.innerText = message!;
|
this._messageSummary!.innerText = message!;
|
||||||
this._messageSummary.title = message!;
|
this._messageSummary!.title = message!;
|
||||||
this._messageDetail.innerText = description;
|
this._messageDetail!.innerText = description;
|
||||||
}
|
}
|
||||||
DOM.removeNode(this._messageDetail);
|
DOM.removeNode(this._messageDetail!);
|
||||||
this.messagesElementVisible = !!this._messageSummaryText;
|
this.messagesElementVisible = !!this._messageSummaryText;
|
||||||
this.updateExpandMessageState();
|
this.updateExpandMessageState();
|
||||||
}
|
}
|
||||||
@@ -501,12 +500,12 @@ export abstract class Modal extends Disposable implements IThemable {
|
|||||||
protected set messagesElementVisible(visible: boolean) {
|
protected set messagesElementVisible(visible: boolean) {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
if (this._useDefaultMessageBoxLocation) {
|
if (this._useDefaultMessageBoxLocation) {
|
||||||
DOM.prepend(this._modalContent, (this._messageElement));
|
DOM.prepend(this._modalContent!, this._messageElement!);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DOM.removeNode(this._messageElement);
|
DOM.removeNode(this._messageElement!);
|
||||||
// Set the focus to first focus element if the focus is not within the dialog
|
// Set the focus to first focus element if the focus is not within the dialog
|
||||||
if (!DOM.isAncestor(document.activeElement, this._bodyContainer)) {
|
if (!DOM.isAncestor(document.activeElement, this._bodyContainer!)) {
|
||||||
this.setInitialFocusedElement();
|
this.setInitialFocusedElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -518,12 +517,12 @@ export abstract class Modal extends Disposable implements IThemable {
|
|||||||
public set spinner(show: boolean) {
|
public set spinner(show: boolean) {
|
||||||
if (this._modalOptions.hasSpinner) {
|
if (this._modalOptions.hasSpinner) {
|
||||||
if (show) {
|
if (show) {
|
||||||
DOM.show(this._spinnerElement);
|
DOM.show(this._spinnerElement!);
|
||||||
if (this._modalOptions.spinnerTitle) {
|
if (this._modalOptions.spinnerTitle) {
|
||||||
alert(this._modalOptions.spinnerTitle);
|
alert(this._modalOptions.spinnerTitle);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
DOM.hide(this._spinnerElement);
|
DOM.hide(this._spinnerElement!);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -573,34 +572,34 @@ export abstract class Modal extends Disposable implements IThemable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private applyStyles(): void {
|
private applyStyles(): void {
|
||||||
const foreground = this._dialogForeground ? this._dialogForeground.toString() : null;
|
const foreground = this._dialogForeground ? this._dialogForeground.toString() : '';
|
||||||
const border = this._dialogBorder ? this._dialogBorder.toString() : null;
|
const border = this._dialogBorder ? this._dialogBorder.toString() : '';
|
||||||
const headerAndFooterBackground = this._dialogHeaderAndFooterBackground ? this._dialogHeaderAndFooterBackground.toString() : null;
|
const headerAndFooterBackground = this._dialogHeaderAndFooterBackground ? this._dialogHeaderAndFooterBackground.toString() : '';
|
||||||
const bodyBackground = this._dialogBodyBackground ? this._dialogBodyBackground.toString() : null;
|
const bodyBackground = this._dialogBodyBackground ? this._dialogBodyBackground.toString() : '';
|
||||||
const footerBorderTopWidth = border ? '1px' : null;
|
const footerBorderTopWidth = border ? '1px' : '';
|
||||||
const footerBorderTopStyle = border ? 'solid' : null;
|
const footerBorderTopStyle = border ? 'solid' : '';
|
||||||
|
|
||||||
if (this._closeButtonInHeader) {
|
if (this._closeButtonInHeader) {
|
||||||
this._closeButtonInHeader.style.color = foreground;
|
this._closeButtonInHeader.style.color = foreground;
|
||||||
}
|
}
|
||||||
if (this._modalDialog) {
|
if (this._modalDialog) {
|
||||||
this._modalDialog.style.color = foreground;
|
this._modalDialog.style.color = foreground;
|
||||||
this._modalDialog.style.borderWidth = border ? '1px' : null;
|
this._modalDialog.style.borderWidth = border ? '1px' : '';
|
||||||
this._modalDialog.style.borderStyle = border ? 'solid' : null;
|
this._modalDialog.style.borderStyle = border ? 'solid' : '';
|
||||||
this._modalDialog.style.borderColor = border;
|
this._modalDialog.style.borderColor = border;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._modalHeaderSection) {
|
if (this._modalHeaderSection) {
|
||||||
this._modalHeaderSection.style.backgroundColor = headerAndFooterBackground;
|
this._modalHeaderSection.style.backgroundColor = headerAndFooterBackground;
|
||||||
this._modalHeaderSection.style.borderBottomWidth = border ? '1px' : null;
|
this._modalHeaderSection.style.borderBottomWidth = border ? '1px' : '';
|
||||||
this._modalHeaderSection.style.borderBottomStyle = border ? 'solid' : null;
|
this._modalHeaderSection.style.borderBottomStyle = border ? 'solid' : '';
|
||||||
this._modalHeaderSection.style.borderBottomColor = border;
|
this._modalHeaderSection.style.borderBottomColor = border;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this._messageElement) {
|
if (this._messageElement) {
|
||||||
this._messageElement.style.backgroundColor = headerAndFooterBackground;
|
this._messageElement.style.backgroundColor = headerAndFooterBackground;
|
||||||
this._messageElement.style.borderBottomWidth = border ? '1px' : null;
|
this._messageElement.style.borderBottomWidth = border ? '1px' : '';
|
||||||
this._messageElement.style.borderBottomStyle = border ? 'solid' : null;
|
this._messageElement.style.borderBottomStyle = border ? 'solid' : '';
|
||||||
this._messageElement.style.borderBottomColor = border;
|
this._messageElement.style.borderBottomColor = border;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -60,9 +60,9 @@ export const ACCOUNT_VIEW_CONTAINER = Registry.as<IViewContainersRegistry>(ViewC
|
|||||||
}, ViewContainerLocation.Dialog);
|
}, ViewContainerLocation.Dialog);
|
||||||
|
|
||||||
class AccountPanel extends ViewPane {
|
class AccountPanel extends ViewPane {
|
||||||
public index: number;
|
public index?: number;
|
||||||
private accountList: List<azdata.Account>;
|
private accountList?: List<azdata.Account>;
|
||||||
private tenantList: List<Tenant>;
|
private tenantList?: List<Tenant>;
|
||||||
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@@ -93,24 +93,24 @@ class AccountPanel extends ViewPane {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public get length(): number {
|
public get length(): number {
|
||||||
return this.accountList.length;
|
return this.accountList!.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public focus() {
|
public focus() {
|
||||||
this.accountList.domFocus();
|
this.accountList!.domFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateAccounts(accounts: azdata.Account[]) {
|
public updateAccounts(accounts: azdata.Account[]) {
|
||||||
this.accountList.splice(0, this.accountList.length, accounts);
|
this.accountList!.splice(0, this.accountList!.length, accounts);
|
||||||
}
|
}
|
||||||
|
|
||||||
public setSelection(indexes: number[]) {
|
public setSelection(indexes: number[]) {
|
||||||
this.accountList.setSelection(indexes);
|
this.accountList!.setSelection(indexes);
|
||||||
this.updateTenants(this.accountList.getSelection[0]);
|
this.updateTenants(this.accountList!.getSelectedElements()[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateTenants(account: azdata.Account) {
|
private updateTenants(account: azdata.Account) {
|
||||||
this.tenantList.splice(0, this.tenantList.length, account?.properties?.tenants ?? []);
|
this.tenantList!.splice(0, this.tenantList!.length, account.properties?.tenants ?? []);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getActions(): IAction[] {
|
public getActions(): IAction[] {
|
||||||
@@ -134,12 +134,12 @@ export class AccountDialog extends Modal {
|
|||||||
// MEMBER VARIABLES ////////////////////////////////////////////////////
|
// MEMBER VARIABLES ////////////////////////////////////////////////////
|
||||||
private _providerViewsMap = new Map<string, IProviderViewUiComponent>();
|
private _providerViewsMap = new Map<string, IProviderViewUiComponent>();
|
||||||
|
|
||||||
private _closeButton: Button;
|
private _closeButton?: Button;
|
||||||
private _addAccountButton: Button;
|
private _addAccountButton?: Button;
|
||||||
private _splitView: SplitView;
|
private _splitView?: SplitView;
|
||||||
private _container: HTMLElement;
|
private _container?: HTMLElement;
|
||||||
private _splitViewContainer: HTMLElement;
|
private _splitViewContainer?: HTMLElement;
|
||||||
private _noaccountViewContainer: HTMLElement;
|
private _noaccountViewContainer?: HTMLElement;
|
||||||
|
|
||||||
// EVENTING ////////////////////////////////////////////////////////////
|
// EVENTING ////////////////////////////////////////////////////////////
|
||||||
private _onAddAccountErrorEmitter: Emitter<string>;
|
private _onAddAccountErrorEmitter: Emitter<string>;
|
||||||
@@ -199,8 +199,8 @@ export class AccountDialog extends Modal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MODAL OVERRIDE METHODS //////////////////////////////////////////////
|
// MODAL OVERRIDE METHODS //////////////////////////////////////////////
|
||||||
protected layout(height?: number): void {
|
protected layout(_height?: number): void {
|
||||||
this._splitView.layout(DOM.getContentHeight(this._container));
|
this._splitView!.layout(DOM.getContentHeight(this._container!));
|
||||||
}
|
}
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
@@ -230,7 +230,7 @@ export class AccountDialog extends Modal {
|
|||||||
this._register(this._addAccountButton.onDidClick(async () => {
|
this._register(this._addAccountButton.onDidClick(async () => {
|
||||||
const vals = Iterable.consume(this._providerViewsMap.values())[0];
|
const vals = Iterable.consume(this._providerViewsMap.values())[0];
|
||||||
|
|
||||||
let pickedValue: string;
|
let pickedValue: string | undefined;
|
||||||
if (vals.length === 0) {
|
if (vals.length === 0) {
|
||||||
this._notificationService.error(localize('accountDialog.noCloudsRegistered', "You have no clouds enabled. Go to Settings -> Search Azure Account Configuration -> Enable at least one cloud"));
|
this._notificationService.error(localize('accountDialog.noCloudsRegistered', "You have no clouds enabled. Go to Settings -> Search Azure Account Configuration -> Enable at least one cloud"));
|
||||||
return;
|
return;
|
||||||
@@ -262,8 +262,8 @@ export class AccountDialog extends Modal {
|
|||||||
|
|
||||||
private registerListeners(): void {
|
private registerListeners(): void {
|
||||||
// Theme styler
|
// Theme styler
|
||||||
this._register(attachButtonStyler(this._closeButton, this._themeService));
|
this._register(attachButtonStyler(this._closeButton!, this._themeService));
|
||||||
this._register(attachButtonStyler(this._addAccountButton, this._themeService));
|
this._register(attachButtonStyler(this._addAccountButton!, this._themeService));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Overwrite escape key behavior */
|
/* Overwrite escape key behavior */
|
||||||
@@ -292,14 +292,14 @@ export class AccountDialog extends Modal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private showNoAccountContainer() {
|
private showNoAccountContainer() {
|
||||||
this._splitViewContainer.hidden = true;
|
this._splitViewContainer!.hidden = true;
|
||||||
this._noaccountViewContainer.hidden = false;
|
this._noaccountViewContainer!.hidden = false;
|
||||||
this._addAccountButton.focus();
|
this._addAccountButton!.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
private showSplitView() {
|
private showSplitView() {
|
||||||
this._splitViewContainer.hidden = false;
|
this._splitViewContainer!.hidden = false;
|
||||||
this._noaccountViewContainer.hidden = true;
|
this._noaccountViewContainer!.hidden = true;
|
||||||
if (Iterable.consume(this._providerViewsMap.values()).length > 0) {
|
if (Iterable.consume(this._providerViewsMap.values()).length > 0) {
|
||||||
const firstView = this._providerViewsMap.values().next().value;
|
const firstView = this._providerViewsMap.values().next().value;
|
||||||
if (firstView instanceof AccountPanel) {
|
if (firstView instanceof AccountPanel) {
|
||||||
@@ -373,19 +373,19 @@ export class AccountDialog extends Modal {
|
|||||||
|
|
||||||
attachPanelStyler(providerView, this._themeService);
|
attachPanelStyler(providerView, this._themeService);
|
||||||
|
|
||||||
const insertIndex = this._splitView.length;
|
const insertIndex = this._splitView!.length;
|
||||||
providerView.render();
|
providerView.render();
|
||||||
|
|
||||||
// Append the list view to the split view
|
// Append the list view to the split view
|
||||||
this._splitView.addView(providerView, Sizing.Distribute, insertIndex);
|
this._splitView!.addView(providerView, Sizing.Distribute, insertIndex);
|
||||||
providerView.index = insertIndex;
|
providerView.index = insertIndex;
|
||||||
|
|
||||||
this._splitView.layout(DOM.getContentHeight(this._container));
|
this._splitView!.layout(DOM.getContentHeight(this._container!));
|
||||||
|
|
||||||
// Set the initial items of the list
|
// Set the initial items of the list
|
||||||
providerView.updateAccounts(newProvider.initialAccounts);
|
providerView.updateAccounts(newProvider.initialAccounts);
|
||||||
|
|
||||||
if (newProvider.initialAccounts.length > 0 && this._splitViewContainer.hidden) {
|
if (newProvider.initialAccounts.length > 0 && this._splitViewContainer!.hidden) {
|
||||||
this.showSplitView();
|
this.showSplitView();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,8 +403,8 @@ export class AccountDialog extends Modal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Remove the list view from the split view
|
// Remove the list view from the split view
|
||||||
this._splitView.removeView(providerView.view.index);
|
this._splitView!.removeView(providerView.view.index!);
|
||||||
this._splitView.layout(DOM.getContentHeight(this._container));
|
this._splitView!.layout(DOM.getContentHeight(this._container!));
|
||||||
|
|
||||||
// Remove the list view from our internal map
|
// Remove the list view from our internal map
|
||||||
this._providerViewsMap.delete(removedProvider.id);
|
this._providerViewsMap.delete(removedProvider.id);
|
||||||
@@ -418,11 +418,11 @@ export class AccountDialog extends Modal {
|
|||||||
}
|
}
|
||||||
providerMapping.view.updateAccounts(args.accountList);
|
providerMapping.view.updateAccounts(args.accountList);
|
||||||
|
|
||||||
if (args.accountList.length > 0 && this._splitViewContainer.hidden) {
|
if (args.accountList.length > 0 && this._splitViewContainer!.hidden) {
|
||||||
this.showSplitView();
|
this.showSplitView();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.isEmptyLinkedAccount() && this._noaccountViewContainer.hidden) {
|
if (this.isEmptyLinkedAccount() && this._noaccountViewContainer!.hidden) {
|
||||||
this.showNoAccountContainer();
|
this.showNoAccountContainer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ export class AccountDialogController {
|
|||||||
// MEMBER VARIABLES ////////////////////////////////////////////////////
|
// MEMBER VARIABLES ////////////////////////////////////////////////////
|
||||||
private _addAccountErrorTitle = localize('accountDialog.addAccountErrorTitle', "Error adding account");
|
private _addAccountErrorTitle = localize('accountDialog.addAccountErrorTitle', "Error adding account");
|
||||||
|
|
||||||
private _accountDialog: AccountDialog;
|
private _accountDialog?: AccountDialog;
|
||||||
public get accountDialog(): AccountDialog { return this._accountDialog; }
|
public get accountDialog(): AccountDialog | undefined { return this._accountDialog; }
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ export class AccountManagementService implements IAccountManagementService {
|
|||||||
public _providers: { [id: string]: AccountProviderWithMetadata } = {};
|
public _providers: { [id: string]: AccountProviderWithMetadata } = {};
|
||||||
public _serviceBrand: undefined;
|
public _serviceBrand: undefined;
|
||||||
private _accountStore: AccountStore;
|
private _accountStore: AccountStore;
|
||||||
private _accountDialogController: AccountDialogController;
|
private _accountDialogController?: AccountDialogController;
|
||||||
private _autoOAuthDialogController: AutoOAuthDialogController;
|
private _autoOAuthDialogController?: AutoOAuthDialogController;
|
||||||
private _mementoContext: Memento;
|
private _mementoContext?: Memento;
|
||||||
|
|
||||||
// EVENT EMITTERS //////////////////////////////////////////////////////
|
// EVENT EMITTERS //////////////////////////////////////////////////////
|
||||||
private _addAccountProviderEmitter: Emitter<AccountProviderAddedEventParams>;
|
private _addAccountProviderEmitter: Emitter<AccountProviderAddedEventParams>;
|
||||||
@@ -57,7 +57,7 @@ export class AccountManagementService implements IAccountManagementService {
|
|||||||
@IClipboardService private _clipboardService: IClipboardService,
|
@IClipboardService private _clipboardService: IClipboardService,
|
||||||
@IOpenerService private _openerService: IOpenerService,
|
@IOpenerService private _openerService: IOpenerService,
|
||||||
@ILogService private readonly _logService: ILogService,
|
@ILogService private readonly _logService: ILogService,
|
||||||
@INotificationService private readonly _notificationService,
|
@INotificationService private readonly _notificationService: INotificationService
|
||||||
) {
|
) {
|
||||||
// Create the account store
|
// Create the account store
|
||||||
if (!this._mementoObj) {
|
if (!this._mementoObj) {
|
||||||
@@ -88,7 +88,7 @@ export class AccountManagementService implements IAccountManagementService {
|
|||||||
* account's properties have been updated (usually when the account goes stale).
|
* account's properties have been updated (usually when the account goes stale).
|
||||||
* @param updatedAccount Account with the updated properties
|
* @param updatedAccount Account with the updated properties
|
||||||
*/
|
*/
|
||||||
public accountUpdated(updatedAccount: azdata.Account): Thenable<void> {
|
public accountUpdated(updatedAccount: azdata.Account): Promise<void> {
|
||||||
let self = this;
|
let self = this;
|
||||||
|
|
||||||
// 1) Update the account in the store
|
// 1) Update the account in the store
|
||||||
@@ -119,7 +119,7 @@ export class AccountManagementService implements IAccountManagementService {
|
|||||||
* @param providerId ID of the provider to ask to prompt for an account
|
* @param providerId ID of the provider to ask to prompt for an account
|
||||||
* @return Promise to return an account
|
* @return Promise to return an account
|
||||||
*/
|
*/
|
||||||
public addAccount(providerId: string): Thenable<void> {
|
public addAccount(providerId: string): Promise<void> {
|
||||||
const closeAction: Action = new Action('closeAddingAccount', localize('accountManagementService.close', "Close"), undefined, true);
|
const closeAction: Action = new Action('closeAddingAccount', localize('accountManagementService.close', "Close"), undefined, true);
|
||||||
|
|
||||||
const loginNotification: INotification = {
|
const loginNotification: INotification = {
|
||||||
@@ -166,7 +166,7 @@ export class AccountManagementService implements IAccountManagementService {
|
|||||||
* @param account account to refresh
|
* @param account account to refresh
|
||||||
* @return Promise to return an account
|
* @return Promise to return an account
|
||||||
*/
|
*/
|
||||||
public refreshAccount(account: azdata.Account): Thenable<azdata.Account> {
|
public refreshAccount(account: azdata.Account): Promise<azdata.Account> {
|
||||||
let self = this;
|
let self = this;
|
||||||
|
|
||||||
return this.doWithProvider(account.key.providerId, async (provider) => {
|
return this.doWithProvider(account.key.providerId, async (provider) => {
|
||||||
@@ -181,20 +181,20 @@ export class AccountManagementService implements IAccountManagementService {
|
|||||||
let result = await self._accountStore.addOrUpdate(account);
|
let result = await self._accountStore.addOrUpdate(account);
|
||||||
if (result.accountAdded) {
|
if (result.accountAdded) {
|
||||||
// Add the account to the list
|
// Add the account to the list
|
||||||
provider.accounts.push(result.changedAccount);
|
provider.accounts.push(result.changedAccount!);
|
||||||
}
|
}
|
||||||
if (result.accountModified) {
|
if (result.accountModified) {
|
||||||
// Find the updated account and splice the updated on in
|
// Find the updated account and splice the updated on in
|
||||||
let indexToRemove: number = firstIndex(provider.accounts, account => {
|
let indexToRemove: number = firstIndex(provider.accounts, account => {
|
||||||
return account.key.accountId === result.changedAccount.key.accountId;
|
return account.key.accountId === result.changedAccount!.key.accountId;
|
||||||
});
|
});
|
||||||
if (indexToRemove >= 0) {
|
if (indexToRemove >= 0) {
|
||||||
provider.accounts.splice(indexToRemove, 1, result.changedAccount);
|
provider.accounts.splice(indexToRemove, 1, result.changedAccount!);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.fireAccountListUpdate(provider, result.accountAdded);
|
self.fireAccountListUpdate(provider, result.accountAdded);
|
||||||
return result.changedAccount;
|
return result.changedAccount!;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,7 +202,7 @@ export class AccountManagementService implements IAccountManagementService {
|
|||||||
* Retrieves metadata of all providers that have been registered
|
* Retrieves metadata of all providers that have been registered
|
||||||
* @returns Registered account providers
|
* @returns Registered account providers
|
||||||
*/
|
*/
|
||||||
public getAccountProviderMetadata(): Thenable<azdata.AccountProviderMetadata[]> {
|
public getAccountProviderMetadata(): Promise<azdata.AccountProviderMetadata[]> {
|
||||||
return Promise.resolve(values(this._providers).map(provider => provider.metadata));
|
return Promise.resolve(values(this._providers).map(provider => provider.metadata));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ export class AccountManagementService implements IAccountManagementService {
|
|||||||
* @param providerId ID of the provider the returned accounts belong to
|
* @param providerId ID of the provider the returned accounts belong to
|
||||||
* @returns Promise to return a list of accounts
|
* @returns Promise to return a list of accounts
|
||||||
*/
|
*/
|
||||||
public getAccountsForProvider(providerId: string): Thenable<azdata.Account[]> {
|
public getAccountsForProvider(providerId: string): Promise<azdata.Account[]> {
|
||||||
let self = this;
|
let self = this;
|
||||||
|
|
||||||
// 1) Get the accounts from the store
|
// 1) Get the accounts from the store
|
||||||
@@ -228,7 +228,7 @@ export class AccountManagementService implements IAccountManagementService {
|
|||||||
/**
|
/**
|
||||||
* Retrieves all the accounts registered with ADS.
|
* Retrieves all the accounts registered with ADS.
|
||||||
*/
|
*/
|
||||||
public getAccounts(): Thenable<azdata.Account[]> {
|
public getAccounts(): Promise<azdata.Account[]> {
|
||||||
return this._accountStore.getAllAccounts();
|
return this._accountStore.getAllAccounts();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -238,9 +238,9 @@ export class AccountManagementService implements IAccountManagementService {
|
|||||||
* @param resource The resource to get the security token for
|
* @param resource The resource to get the security token for
|
||||||
* @return Promise to return the security token
|
* @return Promise to return the security token
|
||||||
*/
|
*/
|
||||||
public getSecurityToken(account: azdata.Account, resource: azdata.AzureResource): Thenable<{}> {
|
public getSecurityToken(account: azdata.Account, resource: azdata.AzureResource): Promise<{} | undefined> {
|
||||||
return this.doWithProvider(account.key.providerId, provider => {
|
return this.doWithProvider(account.key.providerId, provider => {
|
||||||
return provider.provider.getSecurityToken(account, resource);
|
return Promise.resolve(provider.provider.getSecurityToken(account, resource));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,9 +251,9 @@ export class AccountManagementService implements IAccountManagementService {
|
|||||||
* @param resource The resource to get the security token for
|
* @param resource The resource to get the security token for
|
||||||
* @return Promise to return the security token
|
* @return Promise to return the security token
|
||||||
*/
|
*/
|
||||||
public getAccountSecurityToken(account: azdata.Account, tenant: string, resource: azdata.AzureResource): Thenable<{ token: string }> {
|
public getAccountSecurityToken(account: azdata.Account, tenant: string, resource: azdata.AzureResource): Promise<{ token: string } | undefined> {
|
||||||
return this.doWithProvider(account.key.providerId, provider => {
|
return this.doWithProvider(account.key.providerId, provider => {
|
||||||
return provider.provider.getAccountSecurityToken(account, tenant, resource);
|
return Promise.resolve(provider.provider.getAccountSecurityToken(account, tenant, resource));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,7 +263,7 @@ export class AccountManagementService implements IAccountManagementService {
|
|||||||
* @returns Promise with result of account removal, true if account was
|
* @returns Promise with result of account removal, true if account was
|
||||||
* removed, false otherwise.
|
* removed, false otherwise.
|
||||||
*/
|
*/
|
||||||
public removeAccount(accountKey: azdata.AccountKey): Thenable<boolean> {
|
public removeAccount(accountKey: azdata.AccountKey): Promise<boolean> {
|
||||||
|
|
||||||
// Step 1) Remove the account
|
// Step 1) Remove the account
|
||||||
// Step 2) Clear the sensitive data from the provider (regardless of whether the account was removed)
|
// Step 2) Clear the sensitive data from the provider (regardless of whether the account was removed)
|
||||||
@@ -316,7 +316,7 @@ export class AccountManagementService implements IAccountManagementService {
|
|||||||
* Opens the account list dialog
|
* Opens the account list dialog
|
||||||
* @return Promise that finishes when the account list dialog closes
|
* @return Promise that finishes when the account list dialog closes
|
||||||
*/
|
*/
|
||||||
public openAccountListDialog(): Thenable<void> {
|
public openAccountListDialog(): Promise<void> {
|
||||||
let self = this;
|
let self = this;
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
@@ -326,7 +326,7 @@ export class AccountManagementService implements IAccountManagementService {
|
|||||||
self._accountDialogController = self._instantiationService.createInstance(AccountDialogController);
|
self._accountDialogController = self._instantiationService.createInstance(AccountDialogController);
|
||||||
}
|
}
|
||||||
self._accountDialogController.openAccountDialog();
|
self._accountDialogController.openAccountDialog();
|
||||||
self._accountDialogController.accountDialog.onCloseEvent(resolve);
|
self._accountDialogController.accountDialog!.onCloseEvent(resolve);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
reject(e);
|
reject(e);
|
||||||
}
|
}
|
||||||
@@ -337,7 +337,7 @@ export class AccountManagementService implements IAccountManagementService {
|
|||||||
* Begin auto OAuth device code open add account dialog
|
* Begin auto OAuth device code open add account dialog
|
||||||
* @return Promise that finishes when the account list dialog opens
|
* @return Promise that finishes when the account list dialog opens
|
||||||
*/
|
*/
|
||||||
public beginAutoOAuthDeviceCode(providerId: string, title: string, message: string, userCode: string, uri: string): Thenable<void> {
|
public beginAutoOAuthDeviceCode(providerId: string, title: string, message: string, userCode: string, uri: string): Promise<void> {
|
||||||
let self = this;
|
let self = this;
|
||||||
|
|
||||||
return this.doWithProvider(providerId, provider => {
|
return this.doWithProvider(providerId, provider => {
|
||||||
@@ -356,9 +356,9 @@ export class AccountManagementService implements IAccountManagementService {
|
|||||||
* Called from the UI when a user cancels the auto OAuth dialog
|
* Called from the UI when a user cancels the auto OAuth dialog
|
||||||
*/
|
*/
|
||||||
public cancelAutoOAuthDeviceCode(providerId: string): void {
|
public cancelAutoOAuthDeviceCode(providerId: string): void {
|
||||||
this.doWithProvider(providerId, provider => provider.provider.autoOAuthCancelled())
|
void this.doWithProvider(providerId, provider => Promise.resolve(provider.provider.autoOAuthCancelled()))
|
||||||
.then( // Swallow errors
|
.then( // Swallow errors
|
||||||
null,
|
undefined,
|
||||||
err => { this._logService.warn(`Error when cancelling auto OAuth: ${err}`); }
|
err => { this._logService.warn(`Error when cancelling auto OAuth: ${err}`); }
|
||||||
)
|
)
|
||||||
.then(() => this.autoOAuthDialogController.closeAutoOAuthDialog());
|
.then(() => this.autoOAuthDialogController.closeAutoOAuthDialog());
|
||||||
@@ -408,7 +408,7 @@ export class AccountManagementService implements IAccountManagementService {
|
|||||||
* @param providerMetadata Metadata of the provider that is being registered
|
* @param providerMetadata Metadata of the provider that is being registered
|
||||||
* @param provider References to the methods of the provider
|
* @param provider References to the methods of the provider
|
||||||
*/
|
*/
|
||||||
public registerProvider(providerMetadata: azdata.AccountProviderMetadata, provider: azdata.AccountProvider): Thenable<void> {
|
public registerProvider(providerMetadata: azdata.AccountProviderMetadata, provider: azdata.AccountProvider): Promise<void> {
|
||||||
return this._registerProvider(providerMetadata, provider);
|
return this._registerProvider(providerMetadata, provider);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -432,7 +432,7 @@ export class AccountManagementService implements IAccountManagementService {
|
|||||||
// TODO: Support for orphaned accounts (accounts with no provider)
|
// TODO: Support for orphaned accounts (accounts with no provider)
|
||||||
|
|
||||||
// PRIVATE HELPERS /////////////////////////////////////////////////////
|
// PRIVATE HELPERS /////////////////////////////////////////////////////
|
||||||
private doWithProvider<T>(providerId: string, op: (provider: AccountProviderWithMetadata) => Thenable<T>): Thenable<T> {
|
private doWithProvider<T>(providerId: string, op: (provider: AccountProviderWithMetadata) => Promise<T>): Promise<T> {
|
||||||
let provider = this._providers[providerId];
|
let provider = this._providers[providerId];
|
||||||
if (!provider) {
|
if (!provider) {
|
||||||
// If the provider doesn't already exist wait until it gets registered
|
// If the provider doesn't already exist wait until it gets registered
|
||||||
|
|||||||
@@ -30,18 +30,18 @@ import { Tenant, TenantListDelegate, TenantPickerListRenderer } from 'sql/workbe
|
|||||||
export class AccountPicker extends Disposable {
|
export class AccountPicker extends Disposable {
|
||||||
public static ACCOUNTPICKERLIST_HEIGHT = 47;
|
public static ACCOUNTPICKERLIST_HEIGHT = 47;
|
||||||
public viewModel: AccountPickerViewModel;
|
public viewModel: AccountPickerViewModel;
|
||||||
private _accountList: List<azdata.Account>;
|
private _accountList?: List<azdata.Account>;
|
||||||
private _rootContainer: HTMLElement;
|
private _rootContainer?: HTMLElement;
|
||||||
|
|
||||||
private _accountContainer: HTMLElement;
|
private _accountContainer?: HTMLElement;
|
||||||
private _refreshContainer: HTMLElement;
|
private _refreshContainer?: HTMLElement;
|
||||||
private _accountListContainer: HTMLElement;
|
private _accountListContainer?: HTMLElement;
|
||||||
private _dropdown: DropdownList;
|
private _dropdown?: DropdownList;
|
||||||
private _tenantContainer: HTMLElement;
|
private _tenantContainer?: HTMLElement;
|
||||||
private _tenantListContainer: HTMLElement;
|
private _tenantListContainer?: HTMLElement;
|
||||||
private _tenantList: List<Tenant>;
|
private _tenantList?: List<Tenant>;
|
||||||
private _tenantDropdown: DropdownList;
|
private _tenantDropdown?: DropdownList;
|
||||||
private _refreshAccountAction: RefreshAccountAction;
|
private _refreshAccountAction?: RefreshAccountAction;
|
||||||
|
|
||||||
// EVENTING ////////////////////////////////////////////////////////////
|
// EVENTING ////////////////////////////////////////////////////////////
|
||||||
private _addAccountCompleteEmitter: Emitter<void>;
|
private _addAccountCompleteEmitter: Emitter<void>;
|
||||||
@@ -71,7 +71,7 @@ export class AccountPicker extends Disposable {
|
|||||||
this._addAccountCompleteEmitter = new Emitter<void>();
|
this._addAccountCompleteEmitter = new Emitter<void>();
|
||||||
this._addAccountErrorEmitter = new Emitter<string>();
|
this._addAccountErrorEmitter = new Emitter<string>();
|
||||||
this._addAccountStartEmitter = new Emitter<void>();
|
this._addAccountStartEmitter = new Emitter<void>();
|
||||||
this._onAccountSelectionChangeEvent = new Emitter<azdata.Account>();
|
this._onAccountSelectionChangeEvent = new Emitter<azdata.Account | undefined>();
|
||||||
this._onTenantSelectionChangeEvent = new Emitter<string | undefined>();
|
this._onTenantSelectionChangeEvent = new Emitter<string | undefined>();
|
||||||
|
|
||||||
// Create the view model, wire up the events, and initialize with baseline data
|
// Create the view model, wire up the events, and initialize with baseline data
|
||||||
@@ -88,7 +88,7 @@ export class AccountPicker extends Disposable {
|
|||||||
* Render account picker
|
* Render account picker
|
||||||
*/
|
*/
|
||||||
public render(rootContainer: HTMLElement): void {
|
public render(rootContainer: HTMLElement): void {
|
||||||
DOM.append(rootContainer, this._rootContainer);
|
DOM.append(rootContainer, this._rootContainer!);
|
||||||
}
|
}
|
||||||
|
|
||||||
// PUBLIC METHODS //////////////////////////////////////////////////////
|
// PUBLIC METHODS //////////////////////////////////////////////////////
|
||||||
@@ -156,14 +156,14 @@ export class AccountPicker extends Disposable {
|
|||||||
|
|
||||||
this._register(this._accountList.onDidChangeSelection((e: IListEvent<azdata.Account>) => {
|
this._register(this._accountList.onDidChangeSelection((e: IListEvent<azdata.Account>) => {
|
||||||
if (e.elements.length === 1) {
|
if (e.elements.length === 1) {
|
||||||
this._dropdown.renderLabel();
|
this._dropdown!.renderLabel();
|
||||||
this.onAccountSelectionChange(e.elements[0]);
|
this.onAccountSelectionChange(e.elements[0]);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
this._register(this._tenantList.onDidChangeSelection((e: IListEvent<Tenant>) => {
|
this._register(this._tenantList.onDidChangeSelection((e: IListEvent<Tenant>) => {
|
||||||
if (e.elements.length === 1) {
|
if (e.elements.length === 1) {
|
||||||
this._tenantDropdown.renderLabel();
|
this._tenantDropdown!.renderLabel();
|
||||||
this.onTenantSelectionChange(e.elements[0].id);
|
this.onTenantSelectionChange(e.elements[0].id);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
@@ -214,16 +214,16 @@ export class AccountPicker extends Disposable {
|
|||||||
private onAccountSelectionChange(account: azdata.Account | undefined) {
|
private onAccountSelectionChange(account: azdata.Account | undefined) {
|
||||||
this.viewModel.selectedAccount = account;
|
this.viewModel.selectedAccount = account;
|
||||||
if (account && account.isStale) {
|
if (account && account.isStale) {
|
||||||
this._refreshAccountAction.account = account;
|
this._refreshAccountAction!.account = account;
|
||||||
DOM.show(this._refreshContainer);
|
DOM.show(this._refreshContainer!);
|
||||||
} else {
|
} else if (account) {
|
||||||
DOM.hide(this._refreshContainer);
|
DOM.hide(this._refreshContainer!);
|
||||||
|
|
||||||
if (account.properties.tenants?.length > 1) {
|
if (account.properties.tenants?.length > 1) {
|
||||||
DOM.show(this._tenantContainer);
|
DOM.show(this._tenantContainer!);
|
||||||
this.updateTenantList(account);
|
this.updateTenantList(account);
|
||||||
} else {
|
} else {
|
||||||
DOM.hide(this._tenantContainer);
|
DOM.hide(this._tenantContainer!);
|
||||||
}
|
}
|
||||||
this.onTenantSelectionChange(account?.properties?.tenants[0]?.id);
|
this.onTenantSelectionChange(account?.properties?.tenants[0]?.id);
|
||||||
}
|
}
|
||||||
@@ -243,7 +243,7 @@ export class AccountPicker extends Disposable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectedAccounts = this._accountList.getSelectedElements();
|
const selectedAccounts = this._accountList!.getSelectedElements();
|
||||||
const account = selectedAccounts ? selectedAccounts[0] : undefined;
|
const account = selectedAccounts ? selectedAccounts[0] : undefined;
|
||||||
if (account) {
|
if (account) {
|
||||||
const badge = DOM.$('div.badge');
|
const badge = DOM.$('div.badge');
|
||||||
@@ -278,7 +278,7 @@ export class AccountPicker extends Disposable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const selectedTenants = this._tenantList.getSelectedElements();
|
const selectedTenants = this._tenantList!.getSelectedElements();
|
||||||
const tenant = selectedTenants ? selectedTenants[0] : undefined;
|
const tenant = selectedTenants ? selectedTenants[0] : undefined;
|
||||||
if (tenant) {
|
if (tenant) {
|
||||||
const row = DOM.append(container, DOM.$('div.selected-tenant-container'));
|
const row = DOM.append(container, DOM.$('div.selected-tenant-container'));
|
||||||
@@ -291,15 +291,15 @@ export class AccountPicker extends Disposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private updateTenantList(account: azdata.Account): void {
|
private updateTenantList(account: azdata.Account): void {
|
||||||
this._tenantList.splice(0, this._tenantList.length, account?.properties?.tenants ?? []);
|
this._tenantList!.splice(0, this._tenantList!.length, account?.properties?.tenants ?? []);
|
||||||
this._tenantList.setSelection([0]);
|
this._tenantList!.setSelection([0]);
|
||||||
this._tenantDropdown.renderLabel();
|
this._tenantDropdown!.renderLabel();
|
||||||
this._tenantList.layout(this._tenantList.contentHeight);
|
this._tenantList!.layout(this._tenantList!.contentHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateAccountList(accounts: azdata.Account[]): void {
|
private updateAccountList(accounts: azdata.Account[]): void {
|
||||||
// keep the selection to the current one
|
// keep the selection to the current one
|
||||||
const selectedElements = this._accountList.getSelectedElements();
|
const selectedElements = this._accountList!.getSelectedElements();
|
||||||
|
|
||||||
// find selected index
|
// find selected index
|
||||||
let selectedIndex: number | undefined;
|
let selectedIndex: number | undefined;
|
||||||
@@ -310,21 +310,21 @@ export class AccountPicker extends Disposable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Replace the existing list with the new one
|
// Replace the existing list with the new one
|
||||||
this._accountList.splice(0, this._accountList.length, accounts);
|
this._accountList!.splice(0, this._accountList!.length, accounts);
|
||||||
|
|
||||||
if (this._accountList.length > 0) {
|
if (this._accountList!.length > 0) {
|
||||||
if (selectedIndex && selectedIndex !== -1) {
|
if (selectedIndex && selectedIndex !== -1) {
|
||||||
this._accountList.setSelection([selectedIndex]);
|
this._accountList!.setSelection([selectedIndex]);
|
||||||
} else {
|
} else {
|
||||||
this._accountList.setSelection([0]);
|
this._accountList!.setSelection([0]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// if the account is empty, re-render dropdown label
|
// if the account is empty, re-render dropdown label
|
||||||
this.onAccountSelectionChange(undefined);
|
this.onAccountSelectionChange(undefined);
|
||||||
this._dropdown.renderLabel();
|
this._dropdown!.renderLabel();
|
||||||
}
|
}
|
||||||
|
|
||||||
this._accountList.layout(this._accountList.contentHeight);
|
this._accountList!.layout(this._accountList!.contentHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -333,9 +333,8 @@ export class AccountPicker extends Disposable {
|
|||||||
private updateTheme(theme: IColorTheme): void {
|
private updateTheme(theme: IColorTheme): void {
|
||||||
const linkColor = theme.getColor(buttonBackground);
|
const linkColor = theme.getColor(buttonBackground);
|
||||||
const link = linkColor ? linkColor.toString() : null;
|
const link = linkColor ? linkColor.toString() : null;
|
||||||
this._refreshContainer.style.color = link;
|
|
||||||
if (this._refreshContainer) {
|
if (this._refreshContainer) {
|
||||||
this._refreshContainer.style.color = link;
|
this._refreshContainer.style.color = link ?? '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import { AccountPicker } from 'sql/workbench/services/accountManagement/browser/
|
|||||||
export class AccountPickerService implements IAccountPickerService {
|
export class AccountPickerService implements IAccountPickerService {
|
||||||
_serviceBrand: undefined;
|
_serviceBrand: undefined;
|
||||||
|
|
||||||
private _accountPicker: AccountPicker;
|
private _accountPicker?: AccountPicker;
|
||||||
|
|
||||||
// EVENTING ////////////////////////////////////////////////////////////
|
// EVENTING ////////////////////////////////////////////////////////////
|
||||||
private _addAccountCompleteEmitter: Emitter<void>;
|
private _addAccountCompleteEmitter: Emitter<void>;
|
||||||
@@ -38,7 +38,7 @@ export class AccountPickerService implements IAccountPickerService {
|
|||||||
this._addAccountCompleteEmitter = new Emitter<void>();
|
this._addAccountCompleteEmitter = new Emitter<void>();
|
||||||
this._addAccountErrorEmitter = new Emitter<string>();
|
this._addAccountErrorEmitter = new Emitter<string>();
|
||||||
this._addAccountStartEmitter = new Emitter<void>();
|
this._addAccountStartEmitter = new Emitter<void>();
|
||||||
this._onAccountSelectionChangeEvent = new Emitter<azdata.Account>();
|
this._onAccountSelectionChangeEvent = new Emitter<azdata.Account | undefined>();
|
||||||
this._onTenantSelectionChangeEvent = new Emitter<string | undefined>();
|
this._onTenantSelectionChangeEvent = new Emitter<string | undefined>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +46,11 @@ export class AccountPickerService implements IAccountPickerService {
|
|||||||
* Get selected account
|
* Get selected account
|
||||||
*/
|
*/
|
||||||
public get selectedAccount(): azdata.Account | undefined {
|
public get selectedAccount(): azdata.Account | undefined {
|
||||||
return this._accountPicker.viewModel.selectedAccount;
|
if (this._accountPicker) {
|
||||||
|
return this._accountPicker.viewModel.selectedAccount;
|
||||||
|
} else {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -27,11 +27,11 @@ import { attachModalDialogStyler } from 'sql/workbench/common/styler';
|
|||||||
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
|
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
|
||||||
|
|
||||||
export class AutoOAuthDialog extends Modal {
|
export class AutoOAuthDialog extends Modal {
|
||||||
private _copyAndOpenButton: Button;
|
private _copyAndOpenButton?: Button;
|
||||||
private _closeButton: Button;
|
private _closeButton?: Button;
|
||||||
private _userCodeInputBox: InputBox;
|
private _userCodeInputBox?: InputBox;
|
||||||
private _websiteInputBox: InputBox;
|
private _websiteInputBox?: InputBox;
|
||||||
private _descriptionElement: HTMLElement;
|
private _descriptionElement?: HTMLElement;
|
||||||
|
|
||||||
// EVENTING ////////////////////////////////////////////////////////////
|
// EVENTING ////////////////////////////////////////////////////////////
|
||||||
private _onHandleAddAccount = new Emitter<void>();
|
private _onHandleAddAccount = new Emitter<void>();
|
||||||
@@ -75,14 +75,14 @@ export class AutoOAuthDialog extends Modal {
|
|||||||
public render() {
|
public render() {
|
||||||
super.render();
|
super.render();
|
||||||
attachModalDialogStyler(this, this._themeService);
|
attachModalDialogStyler(this, this._themeService);
|
||||||
this.backButton.onDidClick(() => this.cancel());
|
this.backButton!.onDidClick(() => this.cancel());
|
||||||
this._register(attachButtonStyler(this.backButton, this._themeService, { buttonBackground: SIDE_BAR_BACKGROUND, buttonHoverBackground: SIDE_BAR_BACKGROUND }));
|
this._register(attachButtonStyler(this.backButton!, this._themeService, { buttonBackground: SIDE_BAR_BACKGROUND, buttonHoverBackground: SIDE_BAR_BACKGROUND }));
|
||||||
|
|
||||||
this._copyAndOpenButton = this.addFooterButton(localize('copyAndOpen', "Copy & Open"), () => this.addAccount());
|
this._copyAndOpenButton = this.addFooterButton(localize('copyAndOpen', "Copy & Open"), () => this.addAccount());
|
||||||
this._closeButton = this.addFooterButton(localize('oauthDialog.cancel', "Cancel"), () => this.cancel());
|
this._closeButton = this.addFooterButton(localize('oauthDialog.cancel', "Cancel"), () => this.cancel());
|
||||||
this.registerListeners();
|
this.registerListeners();
|
||||||
this._userCodeInputBox.disable();
|
this._userCodeInputBox!.disable();
|
||||||
this._websiteInputBox.disable();
|
this._websiteInputBox!.disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected layout(height?: number): void {
|
protected layout(height?: number): void {
|
||||||
@@ -110,10 +110,10 @@ export class AutoOAuthDialog extends Modal {
|
|||||||
|
|
||||||
private registerListeners(): void {
|
private registerListeners(): void {
|
||||||
// Theme styler
|
// Theme styler
|
||||||
this._register(attachButtonStyler(this._copyAndOpenButton, this._themeService));
|
this._register(attachButtonStyler(this._copyAndOpenButton!, this._themeService));
|
||||||
this._register(attachButtonStyler(this._closeButton, this._themeService));
|
this._register(attachButtonStyler(this._closeButton!, this._themeService));
|
||||||
this._register(attachInputBoxStyler(this._userCodeInputBox, this._themeService));
|
this._register(attachInputBoxStyler(this._userCodeInputBox!, this._themeService));
|
||||||
this._register(attachInputBoxStyler(this._websiteInputBox, this._themeService));
|
this._register(attachInputBoxStyler(this._websiteInputBox!, this._themeService));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,8 +128,8 @@ export class AutoOAuthDialog extends Modal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private addAccount() {
|
private addAccount() {
|
||||||
if (this._copyAndOpenButton.enabled) {
|
if (this._copyAndOpenButton!.enabled) {
|
||||||
this._copyAndOpenButton.enabled = false;
|
this._copyAndOpenButton!.enabled = false;
|
||||||
this.spinner = true;
|
this.spinner = true;
|
||||||
this._onHandleAddAccount.fire();
|
this._onHandleAddAccount.fire();
|
||||||
}
|
}
|
||||||
@@ -140,7 +140,7 @@ export class AutoOAuthDialog extends Modal {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public close() {
|
public close() {
|
||||||
this._copyAndOpenButton.enabled = true;
|
this._copyAndOpenButton!.enabled = true;
|
||||||
this._onCloseEvent.fire();
|
this._onCloseEvent.fire();
|
||||||
this.spinner = false;
|
this.spinner = false;
|
||||||
this.hide();
|
this.hide();
|
||||||
@@ -149,10 +149,10 @@ export class AutoOAuthDialog extends Modal {
|
|||||||
public open(title: string, message: string, userCode: string, uri: string) {
|
public open(title: string, message: string, userCode: string, uri: string) {
|
||||||
// Update dialog
|
// Update dialog
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this._descriptionElement.innerText = message;
|
this._descriptionElement!.innerText = message;
|
||||||
this._userCodeInputBox.value = userCode;
|
this._userCodeInputBox!.value = userCode;
|
||||||
this._websiteInputBox.value = uri;
|
this._websiteInputBox!.value = uri;
|
||||||
this.show();
|
this.show();
|
||||||
this._copyAndOpenButton.focus();
|
this._copyAndOpenButton!.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ import { IErrorMessageService } from 'sql/platform/errorMessage/common/errorMess
|
|||||||
|
|
||||||
export class AutoOAuthDialogController {
|
export class AutoOAuthDialogController {
|
||||||
// MEMBER VARIABLES ////////////////////////////////////////////////////
|
// MEMBER VARIABLES ////////////////////////////////////////////////////
|
||||||
private _autoOAuthDialog: AutoOAuthDialog;
|
private _autoOAuthDialog?: AutoOAuthDialog;
|
||||||
private _providerId?: string;
|
private _providerId?: string;
|
||||||
private _userCode: string;
|
private _userCode?: string;
|
||||||
private _uri: string;
|
private _uri?: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||||
@@ -27,7 +27,7 @@ export class AutoOAuthDialogController {
|
|||||||
/**
|
/**
|
||||||
* Open auto OAuth dialog
|
* Open auto OAuth dialog
|
||||||
*/
|
*/
|
||||||
public openAutoOAuthDialog(providerId: string, title: string, message: string, userCode: string, uri: string): Thenable<void> {
|
public openAutoOAuthDialog(providerId: string, title: string, message: string, userCode: string, uri: string): Promise<void> {
|
||||||
if (this._providerId !== undefined) {
|
if (this._providerId !== undefined) {
|
||||||
// If a oauth flyout is already open, return an error
|
// If a oauth flyout is already open, return an error
|
||||||
const errorMessage = localize('oauthFlyoutIsAlreadyOpen', "Cannot start auto OAuth. An auto OAuth is already in progress.");
|
const errorMessage = localize('oauthFlyoutIsAlreadyOpen', "Cannot start auto OAuth. An auto OAuth is already in progress.");
|
||||||
@@ -57,7 +57,9 @@ export class AutoOAuthDialogController {
|
|||||||
* Close auto OAuth dialog
|
* Close auto OAuth dialog
|
||||||
*/
|
*/
|
||||||
public closeAutoOAuthDialog(): void {
|
public closeAutoOAuthDialog(): void {
|
||||||
this._autoOAuthDialog.close();
|
if (this._autoOAuthDialog) {
|
||||||
|
this._autoOAuthDialog.close();
|
||||||
|
}
|
||||||
this._providerId = undefined;
|
this._providerId = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,6 +73,10 @@ export class AutoOAuthDialogController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private handleOnAddAccount(): void {
|
private handleOnAddAccount(): void {
|
||||||
this._accountManagementService.copyUserCodeAndOpenBrowser(this._userCode, this._uri);
|
if (this._userCode && this._uri) {
|
||||||
|
this._accountManagementService.copyUserCodeAndOpenBrowser(this._userCode, this._uri);
|
||||||
|
} else {
|
||||||
|
throw new Error('Missing user code and uri');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,10 +118,11 @@ suite('Account Management Service Tests:', () => {
|
|||||||
state.mockAccountStore.verify(x => x.addOrUpdate(TypeMoq.It.isAny()), TypeMoq.Times.once());
|
state.mockAccountStore.verify(x => x.addOrUpdate(TypeMoq.It.isAny()), TypeMoq.Times.once());
|
||||||
|
|
||||||
// ... The account list was updated
|
// ... The account list was updated
|
||||||
state.eventVerifierUpdate.assertFiredWithVerify((params: UpdateAccountListEventParams) => {
|
state.eventVerifierUpdate.assertFiredWithVerify((params: UpdateAccountListEventParams | undefined) => {
|
||||||
assert.equal(params.providerId, hasAccountProvider.id);
|
assert.ok(params);
|
||||||
assert.ok(Array.isArray(params.accountList));
|
assert.equal(params!.providerId, hasAccountProvider.id);
|
||||||
assert.equal(params.accountList.length, 1);
|
assert.ok(Array.isArray(params!.accountList));
|
||||||
|
assert.equal(params!.accountList.length, 1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -157,10 +158,11 @@ suite('Account Management Service Tests:', () => {
|
|||||||
|
|
||||||
// ... The account list change should have been fired
|
// ... The account list change should have been fired
|
||||||
state.eventVerifierUpdate.assertFiredWithVerify(param => {
|
state.eventVerifierUpdate.assertFiredWithVerify(param => {
|
||||||
assert.equal(param.providerId, hasAccountProvider.id);
|
assert.ok(param);
|
||||||
assert.ok(Array.isArray(param.accountList));
|
assert.equal(param!.providerId, hasAccountProvider.id);
|
||||||
assert.equal(param.accountList.length, 1);
|
assert.ok(Array.isArray(param!.accountList));
|
||||||
assert.equal(param.accountList[0], account);
|
assert.equal(param!.accountList.length, 1);
|
||||||
|
assert.equal(param!.accountList[0], account);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -196,10 +198,11 @@ suite('Account Management Service Tests:', () => {
|
|||||||
|
|
||||||
// ... The account list change should have been fired
|
// ... The account list change should have been fired
|
||||||
state.eventVerifierUpdate.assertFiredWithVerify(param => {
|
state.eventVerifierUpdate.assertFiredWithVerify(param => {
|
||||||
assert.equal(param.providerId, hasAccountProvider.id);
|
assert.ok(param);
|
||||||
assert.ok(Array.isArray(param.accountList));
|
assert.equal(param!.providerId, hasAccountProvider.id);
|
||||||
assert.equal(param.accountList.length, 1);
|
assert.ok(Array.isArray(param!.accountList));
|
||||||
assert.equal(param.accountList[0], account);
|
assert.equal(param!.accountList.length, 1);
|
||||||
|
assert.equal(param!.accountList[0], account);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -246,7 +249,7 @@ suite('Account Management Service Tests:', () => {
|
|||||||
let state = getTestState();
|
let state = getTestState();
|
||||||
state.accountManagementService._providers[noAccountProvider.id] = {
|
state.accountManagementService._providers[noAccountProvider.id] = {
|
||||||
accounts: [],
|
accounts: [],
|
||||||
provider: null, // Doesn't matter
|
provider: undefined!, // Doesn't matter
|
||||||
metadata: noAccountProvider
|
metadata: noAccountProvider
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -290,7 +293,7 @@ suite('Account Management Service Tests:', () => {
|
|||||||
let ams = getTestState().accountManagementService;
|
let ams = getTestState().accountManagementService;
|
||||||
ams._providers[noAccountProvider.id] = {
|
ams._providers[noAccountProvider.id] = {
|
||||||
accounts: [],
|
accounts: [],
|
||||||
provider: null, // Doesn't matter
|
provider: undefined!, // Doesn't matter
|
||||||
metadata: noAccountProvider
|
metadata: noAccountProvider
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -308,7 +311,7 @@ suite('Account Management Service Tests:', () => {
|
|||||||
let ams = getTestState().accountManagementService;
|
let ams = getTestState().accountManagementService;
|
||||||
ams._providers[hasAccountProvider.id] = {
|
ams._providers[hasAccountProvider.id] = {
|
||||||
accounts: [account],
|
accounts: [account],
|
||||||
provider: null, // Doesn't matter
|
provider: undefined!, // Doesn't matter
|
||||||
metadata: hasAccountProvider
|
metadata: hasAccountProvider
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -350,10 +353,11 @@ suite('Account Management Service Tests:', () => {
|
|||||||
mockProvider.verify(x => x.clear(TypeMoq.It.isValue(account.key)), TypeMoq.Times.once());
|
mockProvider.verify(x => x.clear(TypeMoq.It.isValue(account.key)), TypeMoq.Times.once());
|
||||||
|
|
||||||
// ... The updated account list event should have fired
|
// ... The updated account list event should have fired
|
||||||
state.eventVerifierUpdate.assertFiredWithVerify((params: UpdateAccountListEventParams) => {
|
state.eventVerifierUpdate.assertFiredWithVerify((params: UpdateAccountListEventParams | undefined) => {
|
||||||
assert.equal(params.providerId, hasAccountProvider.id);
|
assert.ok(params);
|
||||||
assert.ok(Array.isArray(params.accountList));
|
assert.equal(params!.providerId, hasAccountProvider.id);
|
||||||
assert.equal(params.accountList.length, 0);
|
assert.ok(Array.isArray(params!.accountList));
|
||||||
|
assert.equal(params!.accountList.length, 0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -404,7 +408,7 @@ suite('Account Management Service Tests:', () => {
|
|||||||
mockDialogController.setup(x => x.openAccountDialog());
|
mockDialogController.setup(x => x.openAccountDialog());
|
||||||
mockDialogController.setup(x => x.accountDialog).returns(() => <AccountDialog>mockAccountDialog);
|
mockDialogController.setup(x => x.accountDialog).returns(() => <AccountDialog>mockAccountDialog);
|
||||||
let mockAccountDialogCloseEvent = new Emitter<void>();
|
let mockAccountDialogCloseEvent = new Emitter<void>();
|
||||||
mockAccountDialog['onCloseEvent'] = mockAccountDialogCloseEvent.event;
|
(mockAccountDialog as any).onCloseEvent = mockAccountDialogCloseEvent.event;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
mockAccountDialogCloseEvent.fire();
|
mockAccountDialogCloseEvent.fire();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
@@ -434,7 +438,7 @@ suite('Account Management Service Tests:', () => {
|
|||||||
mockDialogController.setup(x => x.openAccountDialog());
|
mockDialogController.setup(x => x.openAccountDialog());
|
||||||
mockDialogController.setup(x => x.accountDialog).returns(() => <AccountDialog>mockAccountDialog);
|
mockDialogController.setup(x => x.accountDialog).returns(() => <AccountDialog>mockAccountDialog);
|
||||||
let mockAccountDialogCloseEvent = new Emitter<void>();
|
let mockAccountDialogCloseEvent = new Emitter<void>();
|
||||||
mockAccountDialog['onCloseEvent'] = mockAccountDialogCloseEvent.event;
|
(mockAccountDialog as any).onCloseEvent = mockAccountDialogCloseEvent.event;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
mockAccountDialogCloseEvent.fire();
|
mockAccountDialogCloseEvent.fire();
|
||||||
}, 1000);
|
}, 1000);
|
||||||
@@ -468,7 +472,7 @@ suite('Account Management Service Tests:', () => {
|
|||||||
// ... Create ams, account store that will accept account add/update
|
// ... Create ams, account store that will accept account add/update
|
||||||
let mocks = getTestState();
|
let mocks = getTestState();
|
||||||
mocks.mockAccountStore.setup(x => x.addOrUpdate(TypeMoq.It.isAny()))
|
mocks.mockAccountStore.setup(x => x.addOrUpdate(TypeMoq.It.isAny()))
|
||||||
.returns(() => Promise.resolve(undefined));
|
.returns(() => Promise.resolve(undefined!));
|
||||||
|
|
||||||
// ... Create mock account provider
|
// ... Create mock account provider
|
||||||
let mockProvider = getMockAccountProvider();
|
let mockProvider = getMockAccountProvider();
|
||||||
@@ -484,10 +488,11 @@ suite('Account Management Service Tests:', () => {
|
|||||||
mockProvider.verify(x => x.initialize(TypeMoq.It.isAny()), TypeMoq.Times.once());
|
mockProvider.verify(x => x.initialize(TypeMoq.It.isAny()), TypeMoq.Times.once());
|
||||||
|
|
||||||
// ... The provider added event should have fired
|
// ... The provider added event should have fired
|
||||||
mocks.eventVerifierProviderAdded.assertFiredWithVerify((param: AccountProviderAddedEventParams) => {
|
mocks.eventVerifierProviderAdded.assertFiredWithVerify((param: AccountProviderAddedEventParams | undefined) => {
|
||||||
assert.equal(param.addedProvider, noAccountProvider);
|
assert.ok(param);
|
||||||
assert.ok(Array.isArray(param.initialAccounts));
|
assert.equal(param!.addedProvider, noAccountProvider);
|
||||||
assert.equal(param.initialAccounts.length, 0);
|
assert.ok(Array.isArray(param!.initialAccounts));
|
||||||
|
assert.equal(param!.initialAccounts.length, 0);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -530,7 +535,7 @@ function getTestState(): AccountManagementState {
|
|||||||
const testNotificationService = new TestNotificationService();
|
const testNotificationService = new TestNotificationService();
|
||||||
|
|
||||||
// Create the account management service
|
// Create the account management service
|
||||||
let ams = new AccountManagementService(mockMemento, mockInstantiationService.object, new TestStorageService(), null, null, undefined, testNotificationService);
|
let ams = new AccountManagementService(mockMemento, mockInstantiationService.object, new TestStorageService(), undefined!, undefined!, undefined!, testNotificationService);
|
||||||
|
|
||||||
// Wire up event handlers
|
// Wire up event handlers
|
||||||
let evUpdate = new EventVerifierSingle<UpdateAccountListEventParams>();
|
let evUpdate = new EventVerifierSingle<UpdateAccountListEventParams>();
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ suite('Account picker service tests', () => {
|
|||||||
properties: [],
|
properties: [],
|
||||||
isStale: false
|
isStale: false
|
||||||
};
|
};
|
||||||
let evOnAccountSelectionChangeEvent = new EventVerifierSingle<azdata.Account>();
|
let evOnAccountSelectionChangeEvent = new EventVerifierSingle<azdata.Account | undefined>();
|
||||||
service.onAccountSelectionChangeEvent(evOnAccountSelectionChangeEvent.eventHandler);
|
service.onAccountSelectionChangeEvent(evOnAccountSelectionChangeEvent.eventHandler);
|
||||||
mockOnAccountSelectionChangeEvent.fire(account);
|
mockOnAccountSelectionChangeEvent.fire(account);
|
||||||
evOnAccountSelectionChangeEvent.assertFired(account);
|
evOnAccountSelectionChangeEvent.assertFired(account);
|
||||||
|
|||||||
@@ -13,15 +13,17 @@ const languageRegistry = Registry.as<ILanguageAssociationRegistry>(ILanguageAsso
|
|||||||
|
|
||||||
export function doHandleUpgrade(editor?: EditorInput): EditorInput | undefined {
|
export function doHandleUpgrade(editor?: EditorInput): EditorInput | undefined {
|
||||||
if (editor instanceof UntitledTextEditorInput || editor instanceof FileEditorInput) {
|
if (editor instanceof UntitledTextEditorInput || editor instanceof FileEditorInput) {
|
||||||
let language: string;
|
let language: string | undefined;
|
||||||
if (editor instanceof UntitledTextEditorInput) {
|
if (editor instanceof UntitledTextEditorInput) {
|
||||||
language = editor.getMode();
|
language = editor.getMode();
|
||||||
} else {
|
} else {
|
||||||
editor.getPreferredMode();
|
language = editor.getPreferredMode();
|
||||||
}
|
}
|
||||||
const association = languageRegistry.getAssociationForLanguage(language);
|
if (language) {
|
||||||
if (association && association.syncConvertinput) {
|
const association = languageRegistry.getAssociationForLanguage(language);
|
||||||
return association.syncConvertinput(editor);
|
if (association && association.syncConvertinput) {
|
||||||
|
return association.syncConvertinput(editor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return editor;
|
return editor;
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ type ILanguageAssociationSignature<Services extends BrandedService[]> = new (...
|
|||||||
|
|
||||||
export interface ILanguageAssociationRegistry {
|
export interface ILanguageAssociationRegistry {
|
||||||
registerLanguageAssociation<Services extends BrandedService[]>(languages: string[], contribution: ILanguageAssociationSignature<Services>, isDefault?: boolean): IDisposable;
|
registerLanguageAssociation<Services extends BrandedService[]>(languages: string[], contribution: ILanguageAssociationSignature<Services>, isDefault?: boolean): IDisposable;
|
||||||
getAssociationForLanguage(language: string): ILanguageAssociation;
|
getAssociationForLanguage(language: string): ILanguageAssociation | undefined;
|
||||||
readonly defaultAssociation: [string, ILanguageAssociation];
|
readonly defaultAssociation: [string, ILanguageAssociation] | undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Starts the registry by providing the required services.
|
* Starts the registry by providing the required services.
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export interface IQueryManagementService {
|
|||||||
registerRunner(runner: QueryRunner, uri: string): void;
|
registerRunner(runner: QueryRunner, uri: string): void;
|
||||||
|
|
||||||
cancelQuery(ownerUri: string): Promise<QueryCancelResult>;
|
cancelQuery(ownerUri: string): Promise<QueryCancelResult>;
|
||||||
runQuery(ownerUri: string, range: IRange, runOptions?: ExecutionPlanOptions): Promise<void>;
|
runQuery(ownerUri: string, range?: IRange, runOptions?: ExecutionPlanOptions): Promise<void>;
|
||||||
runQueryStatement(ownerUri: string, line: number, column: number): Promise<void>;
|
runQueryStatement(ownerUri: string, line: number, column: number): Promise<void>;
|
||||||
runQueryString(ownerUri: string, queryString: string): Promise<void>;
|
runQueryString(ownerUri: string, queryString: string): Promise<void>;
|
||||||
runQueryAndReturn(ownerUri: string, queryString: string): Promise<azdata.SimpleExecuteResult>;
|
runQueryAndReturn(ownerUri: string, queryString: string): Promise<azdata.SimpleExecuteResult>;
|
||||||
@@ -79,7 +79,7 @@ export interface IQueryManagementService {
|
|||||||
*/
|
*/
|
||||||
export interface IQueryRequestHandler {
|
export interface IQueryRequestHandler {
|
||||||
cancelQuery(ownerUri: string): Promise<azdata.QueryCancelResult>;
|
cancelQuery(ownerUri: string): Promise<azdata.QueryCancelResult>;
|
||||||
runQuery(ownerUri: string, selection: azdata.ISelectionData, runOptions?: ExecutionPlanOptions): Promise<void>;
|
runQuery(ownerUri: string, selection?: azdata.ISelectionData, runOptions?: ExecutionPlanOptions): Promise<void>;
|
||||||
runQueryStatement(ownerUri: string, line: number, column: number): Promise<void>;
|
runQueryStatement(ownerUri: string, line: number, column: number): Promise<void>;
|
||||||
runQueryString(ownerUri: string, queryString: string): Promise<void>;
|
runQueryString(ownerUri: string, queryString: string): Promise<void>;
|
||||||
runQueryAndReturn(ownerUri: string, queryString: string): Promise<azdata.SimpleExecuteResult>;
|
runQueryAndReturn(ownerUri: string, queryString: string): Promise<azdata.SimpleExecuteResult>;
|
||||||
|
|||||||
@@ -254,6 +254,7 @@ export class QueryModelService implements IQueryModelService {
|
|||||||
text: strings.format(nls.localize('runQueryBatchStartLine', "Line {0}"), b.range.startLineNumber)
|
text: strings.format(nls.localize('runQueryBatchStartLine', "Line {0}"), b.range.startLineNumber)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
info.range!.push(b.range);
|
||||||
}
|
}
|
||||||
let message = {
|
let message = {
|
||||||
message: messageText,
|
message: messageText,
|
||||||
@@ -263,7 +264,6 @@ export class QueryModelService implements IQueryModelService {
|
|||||||
link: link
|
link: link
|
||||||
};
|
};
|
||||||
this._fireQueryEvent(uri, 'message', message);
|
this._fireQueryEvent(uri, 'message', message);
|
||||||
info.range!.push(b.range);
|
|
||||||
});
|
});
|
||||||
queryRunner.onMessage(m => {
|
queryRunner.onMessage(m => {
|
||||||
this._fireQueryEvent(uri, 'message', m);
|
this._fireQueryEvent(uri, 'message', m);
|
||||||
|
|||||||
@@ -138,7 +138,9 @@ export default class QueryRunner extends Disposable {
|
|||||||
*/
|
*/
|
||||||
public runQuery(input: IRange | undefined, runOptions?: ExecutionPlanOptions): Promise<void>;
|
public runQuery(input: IRange | undefined, runOptions?: ExecutionPlanOptions): Promise<void>;
|
||||||
public runQuery(input: string | IRange | undefined, runOptions?: ExecutionPlanOptions): Promise<void> {
|
public runQuery(input: string | IRange | undefined, runOptions?: ExecutionPlanOptions): Promise<void> {
|
||||||
if (types.isString(input) || types.isUndefined(input)) {
|
if (types.isString(input)) {
|
||||||
|
return this.doRunQuery(input, false, runOptions);
|
||||||
|
} else if (types.isUndefined(input)) {
|
||||||
return this.doRunQuery(input, false, runOptions);
|
return this.doRunQuery(input, false, runOptions);
|
||||||
} else {
|
} else {
|
||||||
return this.doRunQuery(input, false, runOptions);
|
return this.doRunQuery(input, false, runOptions);
|
||||||
@@ -157,8 +159,9 @@ export default class QueryRunner extends Disposable {
|
|||||||
* Implementation that runs the query with the provided query
|
* Implementation that runs the query with the provided query
|
||||||
* @param input Query string to execute
|
* @param input Query string to execute
|
||||||
*/
|
*/
|
||||||
private doRunQuery(input: string, runCurrentStatement: boolean, runOptions?: ExecutionPlanOptions): Promise<void>;
|
private doRunQuery(input: string, runCurrentStatement: false, runOptions?: ExecutionPlanOptions): Promise<void>;
|
||||||
private doRunQuery(input: IRange | undefined, runCurrentStatement: boolean, runOptions?: ExecutionPlanOptions): Promise<void>;
|
private doRunQuery(input: IRange | undefined, runCurrentStatement: false, runOptions?: ExecutionPlanOptions): Promise<void>;
|
||||||
|
private doRunQuery(input: IRange, runCurrentStatement: true, runOptions?: ExecutionPlanOptions): Promise<void>;
|
||||||
private doRunQuery(input: string | IRange | undefined, runCurrentStatement: boolean, runOptions?: ExecutionPlanOptions): Promise<void> {
|
private doRunQuery(input: string | IRange | undefined, runCurrentStatement: boolean, runOptions?: ExecutionPlanOptions): Promise<void> {
|
||||||
if (this.isExecuting) {
|
if (this.isExecuting) {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
@@ -181,7 +184,7 @@ export default class QueryRunner extends Disposable {
|
|||||||
|
|
||||||
// Send the request to execute the query
|
// Send the request to execute the query
|
||||||
return runCurrentStatement
|
return runCurrentStatement
|
||||||
? this.queryManagementService.runQueryStatement(this.uri, input.startLineNumber, input.startColumn).then(() => this.handleSuccessRunQueryResult(), e => this.handleFailureRunQueryResult(e))
|
? this.queryManagementService.runQueryStatement(this.uri, input!.startLineNumber, input!.startColumn).then(() => this.handleSuccessRunQueryResult(), e => this.handleFailureRunQueryResult(e))
|
||||||
: this.queryManagementService.runQuery(this.uri, input, runOptions).then(() => this.handleSuccessRunQueryResult(), e => this.handleFailureRunQueryResult(e));
|
: this.queryManagementService.runQuery(this.uri, input, runOptions).then(() => this.handleSuccessRunQueryResult(), e => this.handleFailureRunQueryResult(e));
|
||||||
} else {
|
} else {
|
||||||
// Update internal state to show that we're executing the query
|
// Update internal state to show that we're executing the query
|
||||||
@@ -232,7 +235,9 @@ export default class QueryRunner extends Disposable {
|
|||||||
|
|
||||||
this._batchSets.map(batch => {
|
this._batchSets.map(batch => {
|
||||||
if (batch.range) {
|
if (batch.range) {
|
||||||
batch.range = new Range(batch.range.startLineNumber + this._resultLineOffset, batch.range.startColumn + this._resultColumnOffset, batch.range.endLineNumber + this._resultLineOffset, batch.range.endColumn + this._resultColumnOffset);
|
const columnOffset = (this._resultColumnOffset ?? 0);
|
||||||
|
const lineOffest = (this._resultLineOffset ?? 0);
|
||||||
|
batch.range = new Range(batch.range.startLineNumber + lineOffest, batch.range.startColumn + columnOffset, batch.range.endLineNumber + lineOffest, batch.range.endColumn + columnOffset);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -256,7 +261,9 @@ export default class QueryRunner extends Disposable {
|
|||||||
public handleBatchStart(batch: BatchStartSummary): void {
|
public handleBatchStart(batch: BatchStartSummary): void {
|
||||||
// Recalculate the start and end lines, relative to the result line offset
|
// Recalculate the start and end lines, relative to the result line offset
|
||||||
if (batch.range) {
|
if (batch.range) {
|
||||||
batch.range = new Range(batch.range.startLineNumber + this._resultLineOffset, batch.range.startColumn + this._resultColumnOffset, batch.range.endLineNumber + this._resultLineOffset, batch.range.endColumn + this._resultColumnOffset);
|
const columnOffset = (this._resultColumnOffset ?? 0);
|
||||||
|
const lineOffest = (this._resultLineOffset ?? 0);
|
||||||
|
batch.range = new Range(batch.range.startLineNumber + lineOffest, batch.range.startColumn + columnOffset, batch.range.endLineNumber + lineOffest, batch.range.endColumn + columnOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store the batch
|
// Store the batch
|
||||||
@@ -305,6 +312,7 @@ export default class QueryRunner extends Disposable {
|
|||||||
batchSet = <BatchSummary>{
|
batchSet = <BatchSummary>{
|
||||||
id: 0,
|
id: 0,
|
||||||
range: undefined,
|
range: undefined,
|
||||||
|
executionStart: Date.now().toString(),
|
||||||
hasError: false,
|
hasError: false,
|
||||||
resultSetSummaries: []
|
resultSetSummaries: []
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -28,70 +28,71 @@
|
|||||||
"./sql/base/**/*.ts",
|
"./sql/base/**/*.ts",
|
||||||
"./sql/editor/**/*.ts",
|
"./sql/editor/**/*.ts",
|
||||||
"./sql/platform/**/*.ts",
|
"./sql/platform/**/*.ts",
|
||||||
// "./sql/workbench/services/**/*.ts"
|
"./sql/workbench/common/**/*.ts",
|
||||||
|
"./sql/workbench/services/accountManagement/**/*.ts",
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"./vs/platform/workspaces/test/electron-main/workspacesMainService.test.ts",
|
// "./vs/platform/workspaces/test/electron-main/workspacesMainService.test.ts",
|
||||||
// sql services
|
// // sql services
|
||||||
"./sql/workbench/services/accountManagement/**/*.ts", // 3101 errors
|
// "./sql/workbench/services/accountManagement/**/*.ts", // 3101 errors
|
||||||
"./sql/workbench/services/bootstrap/**/*.ts", // 3087 errors
|
// "./sql/workbench/services/bootstrap/**/*.ts", // 3087 errors
|
||||||
"./sql/workbench/services/connection/**/*.ts", // 3192 errors
|
// "./sql/workbench/services/connection/**/*.ts", // 3192 errors
|
||||||
"./sql/workbench/services/dashboard/**/*.ts", // 57 errors
|
// "./sql/workbench/services/dashboard/**/*.ts", // 57 errors
|
||||||
"./sql/workbench/services/dialog/**/*.ts", // 3094 errors
|
// "./sql/workbench/services/dialog/**/*.ts", // 3094 errors
|
||||||
"./sql/workbench/services/errorMessage/**/*.ts", // 61 errors
|
// "./sql/workbench/services/errorMessage/**/*.ts", // 61 errors
|
||||||
"./sql/workbench/services/fileBrowser/**/*.ts", // 3087
|
// "./sql/workbench/services/fileBrowser/**/*.ts", // 3087
|
||||||
"./sql/workbench/services/insights/**/*.ts", // 3151
|
// "./sql/workbench/services/insights/**/*.ts", // 3151
|
||||||
"./sql/workbench/services/jobManagement/**/*.ts", // 3132
|
// "./sql/workbench/services/jobManagement/**/*.ts", // 3132
|
||||||
"./sql/workbench/services/languageAssociation/**/*.ts", // 3087
|
// "./sql/workbench/services/languageAssociation/**/*.ts", // 3087
|
||||||
"./sql/workbench/services/notebook/**/*.ts", // 3087
|
// "./sql/workbench/services/notebook/**/*.ts", // 3087
|
||||||
"./sql/workbench/services/objectExplorer/**/*.ts", // 3143
|
// "./sql/workbench/services/objectExplorer/**/*.ts", // 3143
|
||||||
"./sql/workbench/services/profiler/**/*.ts", // 3087
|
// "./sql/workbench/services/profiler/**/*.ts", // 3087
|
||||||
"./sql/workbench/services/query/**/*.ts", // 3089
|
// "./sql/workbench/services/query/**/*.ts", // 3089
|
||||||
"./sql/workbench/services/queryEditor/**/*.ts", // 3087
|
// "./sql/workbench/services/queryEditor/**/*.ts", // 3087
|
||||||
"./sql/workbench/services/queryHistory/**/*.ts", // 3091
|
// "./sql/workbench/services/queryHistory/**/*.ts", // 3091
|
||||||
"./sql/workbench/services/resourceProvider/**/*.ts", // 70
|
// "./sql/workbench/services/resourceProvider/**/*.ts", // 70
|
||||||
"./sql/workbench/services/restore/**/*.ts", // 3100
|
// "./sql/workbench/services/restore/**/*.ts", // 3100
|
||||||
"./sql/workbench/services/serverGroup/**/*.ts", // 49
|
// "./sql/workbench/services/serverGroup/**/*.ts", // 49
|
||||||
// vs services
|
// // vs services
|
||||||
"./vs/workbench/services/accessibility/**/*.ts", // 3087
|
// "./vs/workbench/services/accessibility/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/authentication/**/*.ts", // 3087
|
// "./vs/workbench/services/authentication/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/backup/**/*.ts", // 3087
|
// "./vs/workbench/services/backup/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/bulkEdit/**/*.ts", // 3087
|
// "./vs/workbench/services/bulkEdit/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/configuration/**/*.ts", // 3087
|
// "./vs/workbench/services/configuration/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/configurationResolver/**/*.ts", // 3087
|
// "./vs/workbench/services/configurationResolver/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/credentials/**/*.ts", // 3087
|
// "./vs/workbench/services/credentials/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/dialogs/**/*.ts", // 3087
|
// "./vs/workbench/services/dialogs/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/editor/**/*.ts", // 3087
|
// "./vs/workbench/services/editor/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/electron/**/*.ts", // 3087
|
// "./vs/workbench/services/electron/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/environment/**/*.ts", // 3087
|
// "./vs/workbench/services/environment/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/extensionManagement/**/*.ts", // 3087
|
// "./vs/workbench/services/extensionManagement/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/extensions/**/*.ts", // 3287
|
// "./vs/workbench/services/extensions/**/*.ts", // 3287
|
||||||
"./vs/workbench/services/filesConfiguration/**/*.ts", // 3087
|
// "./vs/workbench/services/filesConfiguration/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/history/**/*.ts", // 3087
|
// "./vs/workbench/services/history/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/host/**/*.ts", // 3087
|
// "./vs/workbench/services/host/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/keybinding/**/*.ts", // 3087
|
// "./vs/workbench/services/keybinding/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/label/**/*.ts", // 3087
|
// "./vs/workbench/services/label/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/lifecycle/**/*.ts", // 3087
|
// "./vs/workbench/services/lifecycle/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/output/**/*.ts", // 3087
|
// "./vs/workbench/services/output/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/path/**/*.ts", // 3087
|
// "./vs/workbench/services/path/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/preferences/**/*.ts", // 3087
|
// "./vs/workbench/services/preferences/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/progress/**/*.ts", // 3087
|
// "./vs/workbench/services/progress/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/remote/**/*.ts", // 3087
|
// "./vs/workbench/services/remote/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/search/**/*.ts", // 3087
|
// "./vs/workbench/services/search/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/sharedProcess/**/*.ts", // 3087
|
// "./vs/workbench/services/sharedProcess/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/telemetry/**/*.ts", // 3087
|
// "./vs/workbench/services/telemetry/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/textfile/**/*.ts", // 3087
|
// "./vs/workbench/services/textfile/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/textmodelResolver/**/*.ts", // 3087
|
// "./vs/workbench/services/textmodelResolver/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/textresourceProperties/**/*.ts", // 3087
|
// "./vs/workbench/services/textresourceProperties/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/themes/**/*.ts", // 3087
|
// "./vs/workbench/services/themes/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/timer/**/*.ts", // 3087
|
// "./vs/workbench/services/timer/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/untitled/**/*.ts", // 3087
|
// "./vs/workbench/services/untitled/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/update/**/*.ts", // 3087
|
// "./vs/workbench/services/update/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/url/**/*.ts", // 3087
|
// "./vs/workbench/services/url/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/userData/**/*.ts", // 3087
|
// "./vs/workbench/services/userData/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/viewlet/**/*.ts", // 3087
|
// "./vs/workbench/services/viewlet/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/views/**/*.ts", // 3087
|
// "./vs/workbench/services/views/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/workingCopy/**/*.ts", // 3087
|
// "./vs/workbench/services/workingCopy/**/*.ts", // 3087
|
||||||
"./vs/workbench/services/workspaces/**/*.ts", // 3087
|
// "./vs/workbench/services/workspaces/**/*.ts", // 3087
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -377,7 +377,7 @@ export function fillResourceDataTransfers(accessor: ServicesAccessor, resources:
|
|||||||
// to restore dirty state. Get that from the text model directly
|
// to restore dirty state. Get that from the text model directly
|
||||||
let dirtyContent: string | undefined = undefined;
|
let dirtyContent: string | undefined = undefined;
|
||||||
if (model?.isDirty()) {
|
if (model?.isDirty()) {
|
||||||
dirtyContent = model.textEditorModel.getValue();
|
dirtyContent = model.textEditorModel!.getValue(); // {{SQL CARBON EDIT}} strict-null-checks
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add as dragged editor
|
// Add as dragged editor
|
||||||
|
|||||||
Reference in New Issue
Block a user