Skip to content

Commit 9f16b58

Browse files
Minor fixes for configurationView (#1031)
## Changes * Fix deeplinks for all configuration view entities. * For cluster and sync destination created after deploy, show "Created" tag and tooltip "created after deploy". * Show a notification saying "Loading databricks profiles", when calling list profiles because it is slow and makes UI seem unresponsive. * Don't show empty auth type in the profiles quickpick. ## Tests <!-- How is this tested? -->
1 parent 3682c76 commit 9f16b58

File tree

6 files changed

+96
-29
lines changed

6 files changed

+96
-29
lines changed

packages/databricks-vscode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@
389389
"view/item/context": [
390390
{
391391
"command": "databricks.utils.openExternal",
392-
"when": "view == configurationView && viewItem =~ /^databricks.configuration.(cluster|sync).*$/",
392+
"when": "viewItem =~ /^databricks.*\\.(has-url).*$/",
393393
"group": "inline@1"
394394
},
395395
{

packages/databricks-vscode/resources/light/logo.svg

Lines changed: 21 additions & 1 deletion
Loading

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,15 @@ export class ConnectionCommands implements Disposable {
6767
}
6868

6969
async configureLoginCommand() {
70-
await this.connectionManager.configureLogin();
70+
await window.withProgress(
71+
{
72+
location: {viewId: "configurationView"},
73+
title: "Configuring Databricks login",
74+
},
75+
async () => {
76+
await this.connectionManager.configureLogin();
77+
}
78+
);
7179
}
7280

7381
openDatabricksConfigFileCommand() {

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

Lines changed: 38 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
import {commands, QuickPickItem, QuickPickItemKind, window} from "vscode";
1+
import {
2+
commands,
3+
QuickPickItem,
4+
QuickPickItemKind,
5+
window,
6+
ProgressLocation,
7+
} from "vscode";
28
import {
39
InputFlowAction,
410
InputStep,
@@ -136,11 +142,18 @@ export class LoginWizard {
136142
);
137143
})
138144
.map((profile) => {
145+
const humanisedAuthType = humaniseSdkAuthType(
146+
profile.authType
147+
);
148+
const detail = humanisedAuthType
149+
? `Authenticate using ${humaniseSdkAuthType(
150+
profile.authType
151+
)}`
152+
: `Authenticate using profile ${profile.name}`;
153+
139154
return {
140155
label: profile.name,
141-
detail: `Authenticate using ${humaniseSdkAuthType(
142-
profile.authType
143-
)} from ${profile.name} profile`,
156+
detail,
144157
authType: profile.authType as SdkAuthType,
145158
profile: profile.name,
146159
};
@@ -357,18 +370,28 @@ function humaniseSdkAuthType(sdkAuthType: string) {
357370
}
358371

359372
export async function listProfiles(cliWrapper: CliWrapper) {
360-
const profiles = (
361-
await cliWrapper.listProfiles(workspaceConfigs.databrickscfgLocation)
362-
).filter((profile) => {
363-
try {
364-
UrlUtils.normalizeHost(profile.host!.toString());
365-
return true;
366-
} catch (e) {
367-
return false;
368-
}
369-
});
373+
return await window.withProgress(
374+
{
375+
location: ProgressLocation.Notification,
376+
title: "Loading Databricks profiles",
377+
},
378+
async () => {
379+
const profiles = (
380+
await cliWrapper.listProfiles(
381+
workspaceConfigs.databrickscfgLocation
382+
)
383+
).filter((profile) => {
384+
try {
385+
UrlUtils.normalizeHost(profile.host!.toString());
386+
return true;
387+
} catch (e) {
388+
return false;
389+
}
390+
});
370391

371-
return profiles;
392+
return profiles;
393+
}
394+
);
372395
}
373396

374397
async function validateDatabricksHost(

packages/databricks-vscode/src/configuration/ui/ClusterComponent.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
import {ConfigurationTreeItem} from "./types";
1111
import {Cluster} from "../../sdk-extensions";
1212
import {onError} from "../../utils/onErrorDecorator";
13+
import {LabelUtils} from "../../ui/bundle-resource-explorer/utils";
1314

1415
const TREE_ICON_ID = "CLUSTER";
1516
function getContextValue(key: string) {
@@ -116,15 +117,19 @@ export class ClusterComponent extends BaseComponent {
116117
return [];
117118
}
118119
const {icon, contextValue} = getTreeItemsForClusterState(cluster);
119-
120+
const url = await cluster.url;
120121
return [
121122
{
122-
label: "Cluster",
123+
label: url
124+
? "Cluster"
125+
: LabelUtils.addModifiedTag("Cluster", "created"),
126+
tooltip: url ? undefined : "Created after deploy",
123127
description: cluster.name,
124128
collapsibleState: TreeItemCollapsibleState.Expanded,
125-
contextValue: contextValue,
129+
contextValue: url ? `${contextValue}.has-url` : contextValue,
126130
iconPath: icon,
127131
id: TREE_ICON_ID,
132+
url,
128133
},
129134
];
130135
}

packages/databricks-vscode/src/configuration/ui/SyncDestinationComponent.ts

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {ConnectionManager} from "../ConnectionManager";
55
import {BaseComponent} from "./BaseComponent";
66
import {ConfigurationTreeItem} from "./types";
77
import {TreeItemCollapsibleState, ThemeIcon, ThemeColor} from "vscode";
8+
import {LabelUtils} from "../../ui/bundle-resource-explorer/utils";
89

910
const TREE_ICON_ID = "WORKSPACE";
1011
function getContextValue(key: string) {
@@ -70,10 +71,20 @@ export class SyncDestinationComponent extends BaseComponent {
7071
}),
7172
this.configModel.onDidChangeKey("remoteRootPath")(() => {
7273
this.onDidChangeEmitter.fire();
74+
}),
75+
this.configModel.onDidChangeKey("remoteStateConfig")(() => {
76+
this.onDidChangeEmitter.fire();
7377
})
7478
);
7579
}
7680

81+
async getUrl() {
82+
return this.connectionManager.workspaceClient
83+
? await this.connectionManager.syncDestinationMapper?.remoteUri.getUrl(
84+
this.connectionManager.workspaceClient
85+
)
86+
: undefined;
87+
}
7788
private async getRoot(): Promise<ConfigurationTreeItem[]> {
7889
const config = await this.configModel.get("remoteRootPath");
7990
if (config === undefined) {
@@ -86,19 +97,20 @@ export class SyncDestinationComponent extends BaseComponent {
8697
this.codeSynchronizer
8798
);
8899

100+
const url = await this.getUrl();
101+
89102
return [
90103
{
91-
label: "Sync",
104+
label: url
105+
? "Sync"
106+
: LabelUtils.addModifiedTag("Sync", "created"),
107+
tooltip: url ? undefined : "Created after deploy",
92108
description: posix.basename(posix.dirname(config)),
93109
collapsibleState: TreeItemCollapsibleState.Expanded,
94-
contextValue: contextValue,
110+
contextValue: url ? `${contextValue}.has-url` : contextValue,
95111
iconPath: icon,
96112
id: TREE_ICON_ID,
97-
url: this.connectionManager.workspaceClient
98-
? await this.connectionManager.syncDestinationMapper?.remoteUri.getUrl(
99-
this.connectionManager.workspaceClient
100-
)
101-
: undefined,
113+
url: url,
102114
},
103115
];
104116
}
@@ -121,7 +133,6 @@ export class SyncDestinationComponent extends BaseComponent {
121133
if (workspaceFsPath === undefined) {
122134
return [];
123135
}
124-
//TODO: Disable syncing for all targets (dev/staging/prod)
125136

126137
const children: ConfigurationTreeItem[] = [
127138
{

0 commit comments

Comments
 (0)