Skip to content

Commit 64242e9

Browse files
[DECO-87] Show warning when the name of the selected repo doesn't match the local workspace name (#230)
<img width="1321" alt="Screenshot 2022-11-16 at 15 28 55" src="https://user-images.githubusercontent.com/88345179/202207698-9f7c25f1-75a3-4b65-86cc-f41dee2a3d14.png"> Co-authored-by: Fabian Jakobs <fabian.jakobs@databricks.com>
1 parent c3d6f5b commit 64242e9

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

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

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ export class ConfigurationDataProvider
225225
}
226226

227227
if (element.id === "REPO" && syncDestination) {
228-
return [
228+
const children: Array<TreeItem> = [
229229
{
230230
label: `Name:`,
231231
description: syncDestination.name,
@@ -236,10 +236,25 @@ export class ConfigurationDataProvider
236236
: new ThemeIcon("debug-stop"),
237237
collapsibleState: TreeItemCollapsibleState.None,
238238
},
239+
];
240+
241+
if (
242+
syncDestination.name !== syncDestination.vscodeWorkspacePathName
243+
) {
244+
children.push({
245+
label: "The remote repo name does not match the current vscode workspace name",
246+
tooltip:
247+
"If syncing to repo with a different name is the intended behaviour, this warning can be ignored",
248+
iconPath: new ThemeIcon(
249+
"warning",
250+
new ThemeColor("problemsWarningIcon.foreground")
251+
),
252+
});
253+
}
254+
children.push(
239255
{
240256
label: `URL:`,
241-
description: await this.connectionManager.syncDestination
242-
?.repo.url,
257+
description: await syncDestination.repo.url,
243258
contextValue: "databricks-link",
244259
},
245260
{
@@ -251,8 +266,9 @@ export class ConfigurationDataProvider
251266
label: `Path:`,
252267
description: syncDestination.path.path,
253268
collapsibleState: TreeItemCollapsibleState.None,
254-
},
255-
];
269+
}
270+
);
271+
return children;
256272
}
257273

258274
return [];

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ export class SyncDestination {
4848
return path.basename(this.repoPath.path);
4949
}
5050

51+
get vscodeWorkspacePathName(): string {
52+
return path.basename(this.vscodeWorkspacePath.path);
53+
}
54+
5155
get path(): Uri {
5256
return this.repoPath;
5357
}

0 commit comments

Comments
 (0)