Skip to content

Commit 76c33fd

Browse files
Hide authentication quickpicks when checking auth provider (#1040)
## Changes * Earlier, we had a quickpick fixed in the UI while authproviders were checked. Since auth provider checks have their own UI and retry loops, this made it seem like the quickpick UI is frozen until user clicks out of the auth provider popups. * Now, we just hide the quickpicks until auth provider loops are completed. * Also add logging for cli commands. ## Tests <!-- How is this tested? -->
1 parent 863162f commit 76c33fd

File tree

3 files changed

+58
-12
lines changed

3 files changed

+58
-12
lines changed

packages/databricks-vscode/src/cli/CliWrapper.ts

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,11 @@ export class CliWrapper {
229229
}
230230

231231
public async getBundleSchema(): Promise<string> {
232-
const {stdout} = await execFile(this.cliPath, ["bundle", "schema"]);
232+
const {stdout} = await execFile(this.cliPath, [
233+
"bundle",
234+
"schema",
235+
...this.getLoggingArguments(),
236+
]);
233237
return stdout;
234238
}
235239

@@ -241,7 +245,13 @@ export class CliWrapper {
241245
) {
242246
const {stdout} = await execFile(
243247
this.cliPath,
244-
["bundle", "validate", "--target", target],
248+
[
249+
"bundle",
250+
"validate",
251+
"--target",
252+
target,
253+
...this.getLoggingArguments(),
254+
],
245255
{
246256
cwd: workspaceFolder.fsPath,
247257
env: {
@@ -266,7 +276,13 @@ export class CliWrapper {
266276
) {
267277
const {stdout, stderr} = await execFile(
268278
this.cliPath,
269-
["bundle", "summary", "--target", target],
279+
[
280+
"bundle",
281+
"summary",
282+
"--target",
283+
target,
284+
...this.getLoggingArguments(),
285+
],
270286
{
271287
cwd: workspaceFolder.fsPath,
272288
env: {
@@ -315,6 +331,7 @@ export class CliWrapper {
315331
outputDirPath,
316332
"--config-file",
317333
initConfigFilePath,
334+
...this.getLoggingArguments(),
318335
],
319336
{env: this.getBundleInitEnvVars(authProvider)}
320337
);
@@ -328,7 +345,14 @@ export class CliWrapper {
328345
onStdOut?: (data: string) => void,
329346
onStdError?: (data: string) => void
330347
) {
331-
const cmd = [this.cliPath, "bundle", "deploy", "--target", target];
348+
const cmd = [
349+
this.cliPath,
350+
"bundle",
351+
"deploy",
352+
"--target",
353+
target,
354+
...this.getLoggingArguments(),
355+
];
332356
if (onStdError) {
333357
onStdError(`Deploying the bundle for target ${target}...\n`);
334358
if (this.clusterId) {
@@ -372,7 +396,14 @@ export class CliWrapper {
372396

373397
return {
374398
cmd: this.cliPath,
375-
args: ["bundle", "run", "--target", target, resourceKey],
399+
args: [
400+
"bundle",
401+
"run",
402+
"--target",
403+
target,
404+
resourceKey,
405+
...this.getLoggingArguments(),
406+
],
376407
options: {
377408
cwd: workspaceFolder.fsPath,
378409
env,

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

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -100,17 +100,23 @@ export class LoginWizard {
100100

101101
private async checkAuthProvider(
102102
authProvider: AuthProvider,
103-
authDescription: string
103+
authDescription: string,
104+
input: MultiStepInput
104105
): Promise<InputStep | undefined> {
106+
//Hide the input and let the check show it's own messages and UI.
107+
input.hide();
105108
if (await authProvider.check()) {
106109
return;
107110
}
111+
108112
const choice = await window.showErrorMessage(
109-
`Authentication using ${authDescription} failed. Select another authentication method?`,
110-
"Yes",
111-
"No"
113+
`Authentication using ${authDescription} failed.`,
114+
"Select a different auth method",
115+
"Cancel"
112116
);
113-
if (choice === "Yes") {
117+
if (choice === "Select a different auth method") {
118+
//Show input again with the select auth step.
119+
input.show();
114120
return this.selectAuthMethod.bind(this);
115121
}
116122
throw InputFlowAction.cancel;
@@ -230,7 +236,8 @@ export class LoginWizard {
230236
);
231237
const checkResult = await this.checkAuthProvider(
232238
authProvider,
233-
`profile '${pick.profile}'`
239+
`profile '${pick.profile}'`,
240+
input
234241
);
235242
if (checkResult) {
236243
return checkResult;
@@ -320,7 +327,8 @@ export class LoginWizard {
320327

321328
const checkResult = await this.checkAuthProvider(
322329
authProvider,
323-
authProvider.describe()
330+
authProvider.describe(),
331+
input
324332
);
325333
if (checkResult) {
326334
return checkResult;

packages/databricks-vscode/src/ui/MultiStepInputWizard.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,13 @@ export class MultiStepInput {
8787
private current?: QuickInput;
8888
private steps: InputStep[] = [];
8989

90+
public hide() {
91+
this.current?.hide();
92+
}
93+
public show() {
94+
this.current?.show();
95+
}
96+
9097
private async stepThrough(start: InputStep) {
9198
let step: InputStep | void = start;
9299
while (step) {

0 commit comments

Comments
 (0)