-
Notifications
You must be signed in to change notification settings - Fork 517
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Back Open Docker Hub Item in Browser (#4033)
* added view docker hub item in browser command * updated npm package * Added More Commands Back (#4031) * adjusted scheduleRunReuqest to work with new registries tree * delete azure repository command implementation * actually added back delete azure repository * added back delete Azure Registry command * changed registry tree util file name to be more general * added openInAzurePortalCommand * added back create azure registry command * move createAzureClient to azureUtils * added viewAzureProperties command back (partially) * small tweak to make build image in azure work * added untag azure image commad * added logout of docker cli command * add case sensitivity operator to be consistent * Update src/tree/registries/Azure/AzureRegistryDataProvider.ts Co-authored-by: Brandon Waterloo [MSFT] <[email protected]> * added void * removed symbol as it already exists --------- Co-authored-by: Brandon Waterloo [MSFT] <[email protected]> * minor tweak to avoid index out of bounds * use built in methods to determine the type of item --------- Co-authored-by: Brandon Waterloo [MSFT] <[email protected]>
- Loading branch information
1 parent
bdac083
commit c967595
Showing
4 changed files
with
31 additions
and
28 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 27 additions & 25 deletions
52
src/commands/registries/dockerHub/openDockerHubInBrowser.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,32 @@ | ||
// /*--------------------------------------------------------------------------------------------- | ||
// * Copyright (c) Microsoft Corporation. All rights reserved. | ||
// * Licensed under the MIT License. See LICENSE.md in the project root for license information. | ||
// *--------------------------------------------------------------------------------------------*/ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See LICENSE.md in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
// import { IActionContext, contextValueExperience } from "@microsoft/vscode-azext-utils"; | ||
// import * as vscode from "vscode"; | ||
// import { ext } from "../../../extensionVariables"; | ||
// import { UnifiedRegistryItem } from "../../../tree/registries/UnifiedRegistryTreeDataProvider"; | ||
import { IActionContext, contextValueExperience } from "@microsoft/vscode-azext-utils"; | ||
import { CommonRegistryItem, isRegistry, isRepository, isTag } from "@microsoft/vscode-docker-registries"; | ||
import * as vscode from "vscode"; | ||
import { dockerHubUrl } from "../../../constants"; | ||
import { ext } from "../../../extensionVariables"; | ||
import { UnifiedRegistryItem } from "../../../tree/registries/UnifiedRegistryTreeDataProvider"; | ||
|
||
// export async function openDockerHubInBrowser(context: IActionContext, node?: UnifiedRegistryItem<unknown>): Promise<void> { | ||
// if (!node) { | ||
// node = await contextValueExperience(context, ext.registriesRoot, { include: 'dockerhubregistry' }); | ||
// } | ||
export async function openDockerHubInBrowser(context: IActionContext, node?: UnifiedRegistryItem<CommonRegistryItem>): Promise<void> { | ||
if (!node) { | ||
node = await contextValueExperience(context, ext.registriesRoot, { include: ['dockerHubRegistry', 'dockerHubRepository', 'dockerHubTag'] }); | ||
} | ||
|
||
// let url = dockerHubUrl; | ||
// if (node instanceof DockerHubNamespaceTreeItem) { | ||
// url += `u/${node.namespace}`; | ||
// } else if (node instanceof DockerHubRepositoryTreeItem) { | ||
// url += `r/${node.parent.namespace}/${node.repoName}`; | ||
// } else { | ||
// const repoTI = <DockerHubRepositoryTreeItem>node.parent; | ||
// url += `r/${repoTI.parent.namespace}/${repoTI.repoName}/tags`; | ||
// } | ||
let url = dockerHubUrl; | ||
const dockerHubItem = node.wrappedItem; | ||
|
||
// const url = ''; | ||
// // TODO: review this later | ||
if (isRegistry(dockerHubItem)) { | ||
url = `${url}u/${dockerHubItem.label}`; | ||
} else if (isRepository(dockerHubItem)) { | ||
url = `${url}r/${dockerHubItem.parent.label}/${dockerHubItem.label}`; | ||
} else if (isTag(dockerHubItem)) { | ||
url = `${url}r/${dockerHubItem.parent.parent.label}/${dockerHubItem.parent.label}/tags`; | ||
} else { | ||
throw new Error(`Unexpected node type ${dockerHubItem.additionalContextValues || ''}`); | ||
} | ||
|
||
// await vscode.env.openExternal(vscode.Uri.parse(url)); | ||
// } | ||
await vscode.env.openExternal(vscode.Uri.parse(url)); | ||
} |