Skip to content

Commit 630e267

Browse files
authored
Fix Volume "Open in Databricks" routing to volume URL (#1925)
## Changes When opening a Volume from the Unity Catalog explorer, the "Open in Databricks" action routed to a table-style URL (/explore/data/<catalog>/<schema>/<name>), which points at a non-existent table rather than the volume. getNodeExploreUrl() special-cased models and functions by prefixing their path segment but had no case for volumes, so volumes fell through to the default (table) path. Add a "volume" case that prefixes the path with "volumes/", producing the correct /explore/data/volumes/<catalog>/<schema>/<name> URL. ## Tests UnityCatalogTreeDataProvider.test.ts
1 parent a56cb82 commit 630e267

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

packages/databricks-vscode/src/ui/unity-catalog/UnityCatalogTreeDataProvider.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,36 @@ describe(__filename, () => {
352352
assert.strictEqual(item.copyText, "cat");
353353
});
354354

355+
it("getTreeItem sets volume url with volumes path segment", async () => {
356+
const stubManager = {
357+
onDidChangeState: () => ({dispose() {}}),
358+
databricksWorkspace: {
359+
host: new URL("https://adb-123.azuredatabricks.net/"),
360+
},
361+
} as unknown as ConnectionManager;
362+
363+
const provider = new UnityCatalogTreeDataProvider(
364+
stubManager,
365+
stubStateStorage
366+
);
367+
disposables.push(provider);
368+
369+
const volume: UnityCatalogTreeNode = {
370+
kind: "volume",
371+
catalogName: "cat",
372+
schemaName: "sch",
373+
name: "ev",
374+
fullName: "cat.sch.ev",
375+
};
376+
const item = provider.getTreeItem(volume) as UnityCatalogTreeItem;
377+
378+
assert(item.url, "url should be set");
379+
assert(
380+
item.url!.includes("explore/data/volumes/cat/sch/ev"),
381+
`url should contain explore/data/volumes/cat/sch/ev, got: ${item.url}`
382+
);
383+
});
384+
355385
it("getTreeItem omits url when no host", async () => {
356386
const provider = new UnityCatalogTreeDataProvider(
357387
instance(mockConnectionManager),

packages/databricks-vscode/src/ui/unity-catalog/UnityCatalogTreeDataProvider.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ export class UnityCatalogTreeDataProvider
118118
case "function":
119119
path = `functions/${fullNamePath}`;
120120
break;
121+
case "volume":
122+
path = `volumes/${fullNamePath}`;
123+
break;
121124
}
122125
return this.getExploreUrl(path);
123126
}

0 commit comments

Comments
 (0)