From 17da22167ab8c1a47a94c83cd7e276e96a15524d Mon Sep 17 00:00:00 2001 From: alexyaang <59073590+alexyaang@users.noreply.github.com> Date: Mon, 25 Sep 2023 10:40:22 -0400 Subject: [PATCH] added back connect registry tree item --- .../UnifiedRegistryTreeDataProvider.ts | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/src/tree/registries/UnifiedRegistryTreeDataProvider.ts b/src/tree/registries/UnifiedRegistryTreeDataProvider.ts index 55bd0344f6..f4d23218bc 100644 --- a/src/tree/registries/UnifiedRegistryTreeDataProvider.ts +++ b/src/tree/registries/UnifiedRegistryTreeDataProvider.ts @@ -31,7 +31,11 @@ export class UnifiedRegistryTreeDataProvider implements vscode.TreeDataProvider< } public getTreeItem(element: UnifiedRegistryItem): vscode.TreeItem | Thenable { - return element.provider.getTreeItem(element.wrappedItem); + if (!element.provider) { + return element.wrappedItem as vscode.TreeItem; + } else { + return element.provider.getTreeItem(element.wrappedItem); + } } public async getChildren(element?: UnifiedRegistryItem | undefined): Promise[]> { @@ -78,6 +82,22 @@ export class UnifiedRegistryTreeDataProvider implements vscode.TreeDataProvider< }; })); } + + // if there are no connected providers, show a command to connect one + if (unifiedRegistryItems.length === 0) { + unifiedRegistryItems.push({ + provider: undefined, + wrappedItem: { + label: vscode.l10n.t('Connect Registry...'), + type: 'connectregistry', + iconPath: new vscode.ThemeIcon('plug'), + command: { + command: 'vscode-docker.registries.connectRegistry' + } + }, + parent: undefined, + }); + } } return unifiedRegistryItems.sort((a, b) => {