From bea803d18ec349892b9fd9ac2089985a00c50e5e Mon Sep 17 00:00:00 2001 From: alexyaang <59073590+alexyaang@users.noreply.github.com> Date: Fri, 25 Aug 2023 10:47:36 -0400 Subject: [PATCH 1/5] adjusted context values --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index f6ac326631..5c1157b3f9 100644 --- a/package.json +++ b/package.json @@ -506,12 +506,12 @@ }, { "command": "vscode-docker.registries.copyRemoteFullTag", - "when": "view == dockerRegistries && viewItem =~ /(dockerHubTag|registryV2Tag|azureContainerTag)/i", + "when": "view == dockerRegistries && viewItem =~ /(dockerHubTag|genericRegistryV2Tag|azureContainerTag|githubRegistryTag)/i", "group": "regs_tag_1_general@2" }, { "command": "vscode-docker.registries.copyImageDigest", - "when": "view == dockerRegistries && viewItem =~ /(dockerHubTag|registryV2Tag|azureContainerTag|githubRegistryTag)/", + "when": "view == dockerRegistries && viewItem =~ /(dockerHubTag|genericRegistryV2Tag|azureContainerTag|githubRegistryTag)/", "group": "regs_tag_1_general@3" }, { @@ -531,7 +531,7 @@ }, { "command": "vscode-docker.registries.deleteImage", - "when": "view == dockerRegistries && viewItem =~ /(genericRegistryV2Tag|azureContainerTag|githubRegistryTag)/i", + "when": "view == dockerRegistries && viewItem =~ /(genericRegistryV2Tag|azureContainerTag)/i", "group": "regs_tag_2_destructive@2" }, { From 54ca6c7f8e1f92fe233f93cd6435ec20e31f3692 Mon Sep 17 00:00:00 2001 From: alexyaang <59073590+alexyaang@users.noreply.github.com> Date: Fri, 25 Aug 2023 11:55:51 -0400 Subject: [PATCH 2/5] added untag Image --- package-lock.json | 2 +- src/commands/registries/azure/untagAzureImage.ts | 3 ++- src/commands/registries/deleteRemoteImage.ts | 6 ++---- src/tree/registries/Azure/AzureRegistryDataProvider.ts | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 69a751f00d..bac0e3135e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -824,7 +824,7 @@ "node_modules/@microsoft/vscode-docker-registries": { "version": "0.0.1-alpha", "resolved": "file:../vscode-docker-extensibility/packages/vscode-docker-registries/microsoft-vscode-docker-registries-0.0.1-alpha.tgz", - "integrity": "sha512-SA18suNyHYMsmrfWRN4fkgAHXHG29inYpy5vfhHv7TNs7ha7HRZp93NXpebD1DuPYxFPpmFx3rjdLyADc6DdNA==", + "integrity": "sha512-8lbvSpwXXQDWw/Z6kbwuOEd5HEU+P4lYoGFgJW1FOE9+MF7xHsABvW/C4hA8ydJ3GRKEHvoaQB7Gf8yQG9a+0w==", "license": "See LICENSE in the project root for license information.", "dependencies": { "dayjs": "^1.11.7", diff --git a/src/commands/registries/azure/untagAzureImage.ts b/src/commands/registries/azure/untagAzureImage.ts index f5713131b6..fa80f814b9 100644 --- a/src/commands/registries/azure/untagAzureImage.ts +++ b/src/commands/registries/azure/untagAzureImage.ts @@ -23,10 +23,11 @@ export async function untagAzureImage(context: IActionContext, node?: UnifiedReg const untagging = l10n.t('Untagging image "{0}"...', fullTag); await window.withProgress({ location: ProgressLocation.Notification, title: untagging }, async () => { const provider = node.provider as unknown as AzureRegistryDataProvider; - await provider.deleteTag(node.wrappedItem); + await provider.untagImage(node.wrappedItem); }); // don't wait + void ext.registriesTree.refresh(); /* eslint-disable-next-line @typescript-eslint/no-floating-promises */ window.showInformationMessage(l10n.t('Successfully untagged image "{0}".', fullTag)); } diff --git a/src/commands/registries/deleteRemoteImage.ts b/src/commands/registries/deleteRemoteImage.ts index 6a16de34cd..1c523cbc7e 100644 --- a/src/commands/registries/deleteRemoteImage.ts +++ b/src/commands/registries/deleteRemoteImage.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { DialogResponses, IActionContext, UserCancelledError, parseError } from '@microsoft/vscode-azext-utils'; -import { CommonTag, GenericRegistryV2DataProvider } from '@microsoft/vscode-docker-registries'; +import { CommonRegistryDataProvider, CommonTag } from '@microsoft/vscode-docker-registries'; import { ProgressLocation, l10n, window } from 'vscode'; import { ext } from '../../extensionVariables'; import { UnifiedRegistryItem } from '../../tree/registries/UnifiedRegistryTreeDataProvider'; @@ -23,7 +23,7 @@ export async function deleteRemoteImage(context: IActionContext, node?: UnifiedR const deleting = l10n.t('Deleting image "{0}"...', tagName); await window.withProgress({ location: ProgressLocation.Notification, title: deleting }, async () => { - const provider = node.provider as unknown as GenericRegistryV2DataProvider; + const provider = node.provider as unknown as CommonRegistryDataProvider; try { await provider.deleteTag(node.wrappedItem); @@ -40,8 +40,6 @@ export async function deleteRemoteImage(context: IActionContext, node?: UnifiedR } }); - // TODO: investigate if we can do this for GitHub - // Other tags that also matched the image may have been deleted, so refresh the whole repository // don't wait void ext.registriesTree.refresh(); diff --git a/src/tree/registries/Azure/AzureRegistryDataProvider.ts b/src/tree/registries/Azure/AzureRegistryDataProvider.ts index f3ac530d4d..5a015c5067 100644 --- a/src/tree/registries/Azure/AzureRegistryDataProvider.ts +++ b/src/tree/registries/Azure/AzureRegistryDataProvider.ts @@ -181,7 +181,7 @@ export class AzureRegistryDataProvider extends RegistryV2DataProvider implements await client.registries.beginDeleteAndWait(resourceGroup, item.label); } - public override async deleteTag(item: AzureTag): Promise { + public async untagImage(item: AzureTag): Promise { const authenticationProvider = this.getAuthenticationProvider(item.parent.parent as unknown as AzureRegistryItem); const reponse = await registryV2Request({ From 1028b6546d02dbbe75d9c95324569fc76fbae111 Mon Sep 17 00:00:00 2001 From: alexyaang <59073590+alexyaang@users.noreply.github.com> Date: Fri, 25 Aug 2023 12:07:00 -0400 Subject: [PATCH 3/5] remove github option for delete tag --- src/commands/registries/deleteRemoteImage.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/commands/registries/deleteRemoteImage.ts b/src/commands/registries/deleteRemoteImage.ts index 1c523cbc7e..1b952719c2 100644 --- a/src/commands/registries/deleteRemoteImage.ts +++ b/src/commands/registries/deleteRemoteImage.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { DialogResponses, IActionContext, UserCancelledError, parseError } from '@microsoft/vscode-azext-utils'; -import { CommonRegistryDataProvider, CommonTag } from '@microsoft/vscode-docker-registries'; +import { CommonTag, RegistryV2DataProvider } from '@microsoft/vscode-docker-registries'; import { ProgressLocation, l10n, window } from 'vscode'; import { ext } from '../../extensionVariables'; import { UnifiedRegistryItem } from '../../tree/registries/UnifiedRegistryTreeDataProvider'; @@ -13,7 +13,7 @@ import { registryExperience } from '../../utils/registryExperience'; export async function deleteRemoteImage(context: IActionContext, node?: UnifiedRegistryItem): Promise { if (!node) { - node = await registryExperience(context, ext.registriesTree, { include: ['genericRegistryV2Tag', 'azureContainerTag', 'githubRegistryTag'] }, false); + node = await registryExperience(context, ext.registriesTree, { include: ['genericRegistryV2Tag', 'azureContainerTag'] }, false); } const tagName = getImageNameFromRegistryTagItem(node.wrappedItem); @@ -23,7 +23,7 @@ export async function deleteRemoteImage(context: IActionContext, node?: UnifiedR const deleting = l10n.t('Deleting image "{0}"...', tagName); await window.withProgress({ location: ProgressLocation.Notification, title: deleting }, async () => { - const provider = node.provider as unknown as CommonRegistryDataProvider; + const provider = node.provider as unknown as RegistryV2DataProvider; try { await provider.deleteTag(node.wrappedItem); From f1f0e1b3548ff4f8148dcdd1674a5ae29bd3b0ea Mon Sep 17 00:00:00 2001 From: alexyaang <59073590+alexyaang@users.noreply.github.com> Date: Fri, 25 Aug 2023 12:08:04 -0400 Subject: [PATCH 4/5] commtag -> v2tag --- src/commands/registries/deleteRemoteImage.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/commands/registries/deleteRemoteImage.ts b/src/commands/registries/deleteRemoteImage.ts index 1b952719c2..add9a4b318 100644 --- a/src/commands/registries/deleteRemoteImage.ts +++ b/src/commands/registries/deleteRemoteImage.ts @@ -4,14 +4,14 @@ *--------------------------------------------------------------------------------------------*/ import { DialogResponses, IActionContext, UserCancelledError, parseError } from '@microsoft/vscode-azext-utils'; -import { CommonTag, RegistryV2DataProvider } from '@microsoft/vscode-docker-registries'; +import { RegistryV2DataProvider, V2Tag } from '@microsoft/vscode-docker-registries'; import { ProgressLocation, l10n, window } from 'vscode'; import { ext } from '../../extensionVariables'; import { UnifiedRegistryItem } from '../../tree/registries/UnifiedRegistryTreeDataProvider'; import { getImageNameFromRegistryTagItem } from '../../tree/registries/registryTreeUtils'; import { registryExperience } from '../../utils/registryExperience'; -export async function deleteRemoteImage(context: IActionContext, node?: UnifiedRegistryItem): Promise { +export async function deleteRemoteImage(context: IActionContext, node?: UnifiedRegistryItem): Promise { if (!node) { node = await registryExperience(context, ext.registriesTree, { include: ['genericRegistryV2Tag', 'azureContainerTag'] }, false); } From 76744a821c2483559fa782d051042fb93fcca9f6 Mon Sep 17 00:00:00 2001 From: alexyaang <59073590+alexyaang@users.noreply.github.com> Date: Fri, 25 Aug 2023 14:03:38 -0400 Subject: [PATCH 5/5] slighty changed context values --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5c1157b3f9..c60b4f7510 100644 --- a/package.json +++ b/package.json @@ -506,7 +506,7 @@ }, { "command": "vscode-docker.registries.copyRemoteFullTag", - "when": "view == dockerRegistries && viewItem =~ /(dockerHubTag|genericRegistryV2Tag|azureContainerTag|githubRegistryTag)/i", + "when": "view == dockerRegistries && viewItem =~ /(dockerHubTag|registryV2Tag)/i", "group": "regs_tag_1_general@2" }, {