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

serviceconnector: Add database subtypes #1581

Merged
merged 4 commits into from
Sep 18, 2023
Merged

Conversation

motm32
Copy link
Contributor

@motm32 motm32 commented Sep 8, 2023

Add in database subtypes and filter the database accounts based on the chosen type. Here is how the new list looks:
image

@motm32 motm32 requested a review from a team as a code owner September 8, 2023 18:30
@@ -43,7 +47,19 @@ export class TargetServiceListStep extends AzureWizardPromptStep<ICreateLinkerCo
case TargetServiceTypeName.Storage:
promptSteps.push(new StorageAccountListStep(storageAccountCreateOptions));
break;
case TargetServiceTypeName.CosmosDB:
case TargetServiceTypeName.Cassandra:
Copy link
Member

Choose a reason for hiding this comment

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

It might make more sense for the switch case to check the group. That shouldn't change anything for Storage (since all of the groups are also TargetServiceTypeName.Storage).

But it'd make this a lot cleaner since all are part of TargetServiceTypeName.CosmosDB and are all using the same promptStep as far as I can tell.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Very true I will do that!

{ label: vscode.l10n.t('NoSQL'), data: { name: "sql", type: TargetServiceTypeName.NoSQL, id: '/databases' }, group: TargetServiceTypeName.CosmosDB },
{ label: vscode.l10n.t('Table'), data: { name: "table", type: TargetServiceTypeName.Table, id: '/databases' }, group: TargetServiceTypeName.CosmosDB },
{ label: vscode.l10n.t('Key Vault'), data: { name: "keyVault", type: TargetServiceTypeName.KeyVault, id: '/keyVault' }, group: TargetServiceTypeName.KeyVault },
{ label: vscode.l10n.t('Blob'), data: { name: "storageBlob", type: TargetServiceTypeName.Storage, id: '/blobServices/default', group: TargetServiceTypeName.Storage }, group: TargetServiceTypeName.Storage },
Copy link
Member

Choose a reason for hiding this comment

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

Heh, this is a little bit goofy. It definitely works, but the repeat code hurts my eyes 😭

Could I suggest that rather than duplicating the group property in data, that you instead save the result of the quickPick item instead of just the data?

Something like this

const result = await context.ui.showQuickPick(picks, { placeHolder, enableGrouping: true };
context.targetServiceType = result.data;

switch (result.group) {
...

@motm32 motm32 merged commit 5d93609 into main Sep 18, 2023
4 checks passed
@motm32 motm32 deleted the meganmott/addDatabaseSubTypes branch September 18, 2023 15:46
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.

2 participants