Skip to content

Commit dbbaa00

Browse files
authored
Simplify profile selection UI (#1593)
## Changes And recommend OAuth profiles for new users (who don't have pre-existing profiles defined). There are three main improvements: - Remove confusing `(user to machine)` suffix for OAuth profile type - Add `(recommended)` suffix to OAuth profile type (but only if there are no pre-existing profiles) - Remove separators with headings (make them headless). We already give the context in the item descriptions, additional headings only create clutter (and can even be confused, since they show up for the first item in the group, instead of on top of the group) New UI when there are no pre-existing profiles: <img width="605" alt="Screenshot 2025-03-05 at 13 45 02" src="https://github.com/user-attachments/assets/f3114a22-b5c3-4afa-ab1d-f78db9d11f5a" /> New UI when there are pre-existing profiles (we don't show `recommended` for OAuth then): <img width="606" alt="Screenshot 2025-03-05 at 13 44 03" src="https://github.com/user-attachments/assets/484ea8d1-d608-4fc7-8fc3-d820523a0937" /> Old UI: <img width="605" alt="Screenshot 2025-03-05 at 13 48 20" src="https://github.com/user-attachments/assets/cc87af6e-9d83-4d4b-9249-8abe02853d61" /> <img width="605" alt="Screenshot 2025-03-05 at 13 47 47" src="https://github.com/user-attachments/assets/1d04288b-2784-41fa-b46e-2d1b2e155934" /> ## Tests <!-- How is this tested? -->
1 parent 24c7f1a commit dbbaa00

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

packages/databricks-vscode/src/configuration/LoginWizard.ts

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -134,19 +134,17 @@ export class LoginWizard {
134134
}
135135

136136
private async getProfileQuickPickItems() {
137-
const items: Array<AuthTypeQuickPickItem> = [];
138-
139137
const profiles = (await this.getProfiles())
140138
.filter((profile) => {
141139
return profile.host?.hostname === this.state.host!.hostname;
142140
})
143141
.map((profile) => {
144142
const humanisedAuthType = humaniseSdkAuthType(profile.authType);
145143
const detail = humanisedAuthType
146-
? `Authenticate using ${humaniseSdkAuthType(
144+
? `Select existing profile and authenticate using ${humaniseSdkAuthType(
147145
profile.authType
148146
)}`
149-
: `Authenticate using profile ${profile.name}`;
147+
: `Select existing profile and authenticate`;
150148

151149
return {
152150
label: profile.name,
@@ -155,28 +153,20 @@ export class LoginWizard {
155153
profile: profile.name,
156154
};
157155
});
158-
159-
if (profiles.length !== 0) {
160-
items.push(
161-
{
162-
label: "Existing Databricks CLI Profiles",
163-
kind: QuickPickItemKind.Separator,
164-
},
165-
...profiles
166-
);
167-
}
168-
return items;
156+
return profiles;
169157
}
158+
170159
private async selectAuthMethod(
171160
input: MultiStepInput
172161
): Promise<InputStep | void> {
173162
const items: Array<AuthTypeQuickPickItem> = [];
174-
items.push(...(await this.getProfileQuickPickItems()));
163+
const profileItems = await this.getProfileQuickPickItems();
164+
items.push(...profileItems);
175165

176166
const availableAuthMethods = authMethodsForHostname(this.state.host!);
177-
if (availableAuthMethods.length !== 0) {
167+
if (availableAuthMethods.length !== 0 && profileItems.length !== 0) {
178168
items.push({
179-
label: "Create New Databricks CLI Profile",
169+
label: "",
180170
kind: QuickPickItemKind.Separator,
181171
});
182172
}
@@ -201,7 +191,9 @@ export class LoginWizard {
201191

202192
case "databricks-cli":
203193
items.push({
204-
label: "OAuth (user to machine)",
194+
label:
195+
"OAuth" +
196+
(profileItems.length === 0 ? " (recommended)" : ""),
205197
detail: "Create a profile and authenticate using OAuth",
206198
authType: "databricks-cli",
207199
});
@@ -439,9 +431,9 @@ function humaniseSdkAuthType(sdkAuthType: string) {
439431
case "google-id":
440432
return "Google Service Account";
441433
case "databricks-cli":
442-
return "OAuth (User to Machine)";
434+
return "OAuth";
443435
case "oauth-m2m":
444-
return "OAuth (Machine to Machine)";
436+
return "OAuth M2M (Machine to Machine)";
445437
default:
446438
return sdkAuthType;
447439
}

0 commit comments

Comments
 (0)