Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for custom endpoints #23390

Merged
merged 51 commits into from
Jul 18, 2023
Merged

Add support for custom endpoints #23390

merged 51 commits into from
Jul 18, 2023

Conversation

cssuh
Copy link
Member

@cssuh cssuh commented Jun 15, 2023

Added a setting where users can add custom provider endpoints to the settings.json file, where they will be picked up and added as an additional provider.

Also shows a notification message once the custom endpoints file has been successfully loaded:
Screenshot 2023-07-14 at 5 37 20 PM

This shows the behavior if the user is missing required fields in their settings.json file:
Screenshot 2023-07-14 at 5 31 54 PM

This shows the account dialog once the new cloud has been added:
Screenshot 2023-07-14 at 5 35 41 PM

I tested by removing the azure public cloud endpoints from the providerSettings file and added them back in via the JSON file and everything worked correctly, but more testing always helps if you have time.

Fixes #23205

@cssuh cssuh requested a review from kburtram June 15, 2023 00:07
@cssuh cssuh requested a review from kburtram June 15, 2023 01:28
@cheenamalhotra
Copy link
Member

Discussed offline, please consider adding a command to generate json template in user directory from where you want to read settings. And let user modify that and restart ADS.

Provide these instructions in setting description so they know how to proceed.

@Charles-Gagnon
Copy link
Contributor

Is there a reason you want to have a separate config file instead of just having the user enter it into their settings.json directly? That has the added benefit of coming with automatic hover/autocomplete support in ADS.

cssuh and others added 4 commits July 13, 2023 08:49
Co-authored-by: Cheena Malhotra <13396919+cheenamalhotra@users.noreply.github.com>
Co-authored-by: Cheena Malhotra <13396919+cheenamalhotra@users.noreply.github.com>
extensions/azurecore/package.nls.json Outdated Show resolved Hide resolved
@@ -161,6 +166,118 @@ export async function updateTenantIgnoreList(tenantIgnoreList: string[]): Promis
await configuration.update(constants.Filter, tenantIgnoreList, vscode.ConfigurationTarget.Global);
}

export function updateProviderSettings(defaultSettings: ProviderSettings[]): ProviderSettings[] {
let providerSettingsJson: ProviderSettingsJson[] | undefined = vscode.workspace.getConfiguration(constants.AzureSection).get(constants.ProviderSettingsJson) as ProviderSettingsJson[];
vscode.workspace.onDidChangeConfiguration(async (changeEvent) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this behavior if the user has auto-save on? Will it keep popping up the prompt every time they type a letter?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will pop up every time the file is saved yes, but the auto save setting itself will not save after every letter. The options for autosave are onFocusChange, onWindowChange, or afterDelay (which can be set by the user).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I would definitely suggest keeping an eye on this and having extra people test it out themselves to see if the experience is nice to use. It might be worth adding our own debounce delay to this with a longer timeout (especially if these don't take effect until after restart).

Telemetry could help here too if you wanted to add some events like how often the toast is shown...

extensions/azurecore/src/utils.ts Outdated Show resolved Hide resolved
extensions/azurecore/src/utils.ts Outdated Show resolved Hide resolved
extensions/azurecore/src/utils.ts Outdated Show resolved Hide resolved
@Charles-Gagnon
Copy link
Contributor

Would also suggest updating the description with new screenshots/gifs showing the behavior - the current one is outdated.

Copy link
Contributor

@Charles-Gagnon Charles-Gagnon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd definitely suggest adding telemetry at some point to track usage and errors. Indicating what provider is currently being used for any operation in azurecore is probably something that will be useful - especially for error telemetry - as well.

extensions/azurecore/package.json Outdated Show resolved Hide resolved
"config.providerSettingsMetadata": "Cloud Display Name",
"config.providerSettingsId": "Cloud ID",
"config.providerSettings.endpoints.host": "Host Endpoint",
"config.providerSettings.endpoints.clientId": "Client ID for Azure Data Studio",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will you be providing instructions on how to set this up? (and all of this really) It doesn't seem super straightforward, so having a doc about this would probably be the best.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I'll work on creating a doc for this

extensions/azurecore/package.nls.json Outdated Show resolved Hide resolved
@@ -161,6 +166,118 @@ export async function updateTenantIgnoreList(tenantIgnoreList: string[]): Promis
await configuration.update(constants.Filter, tenantIgnoreList, vscode.ConfigurationTarget.Global);
}

export function updateProviderSettings(defaultSettings: ProviderSettings[]): ProviderSettings[] {
let providerSettingsJson: ProviderSettingsJson[] | undefined = vscode.workspace.getConfiguration(constants.AzureSection).get(constants.ProviderSettingsJson) as ProviderSettingsJson[];
vscode.workspace.onDidChangeConfiguration(async (changeEvent) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I would definitely suggest keeping an eye on this and having extra people test it out themselves to see if the experience is nice to use. It might be worth adding our own debounce delay to this with a longer timeout (especially if these don't take effect until after restart).

Telemetry could help here too if you wanted to add some events like how often the toast is shown...

extensions/azurecore/src/utils.ts Outdated Show resolved Hide resolved
extensions/azurecore/src/utils.ts Outdated Show resolved Hide resolved
extensions/azurecore/package.json Outdated Show resolved Hide resolved
cssuh and others added 4 commits July 18, 2023 11:32
Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>
Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>
@cssuh
Copy link
Member Author

cssuh commented Jul 18, 2023

Opened #23922 to track adding the telemetry, will do in a separate PR

@cssuh cssuh merged commit a752c84 into main Jul 18, 2023
@cssuh cssuh deleted the chsuh/customEndpoints branch July 18, 2023 21:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for custom cloud providers
4 participants