forked from microsoft/vscode-docker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to deploy from ACR / Docker Hub to ACI (microsoft#2265)
* Implement ACI deployment * Container action warning
- Loading branch information
1 parent
dde8dad
commit 8dcde5c
Showing
24 changed files
with
349 additions
and
134 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See LICENSE.md in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { DialogResponses, IActionContext } from 'vscode-azureextensionui'; | ||
import { ext } from '../../extensionVariables'; | ||
import { localize } from '../../localize'; | ||
import { getComposeProjectName, NonComposeGroupName } from '../../tree/containers/ContainersTreeItem'; | ||
import { ContainerTreeItem } from '../../tree/containers/ContainerTreeItem'; | ||
|
||
export async function confirmAllAffectedContainers(context: IActionContext, nodes: ContainerTreeItem[]): Promise<string[]> { | ||
if ((await ext.dockerContextManager.getCurrentContext()).Type !== 'aci' || | ||
nodes.every(n => getComposeProjectName(n.containerItem) === NonComposeGroupName)) { | ||
// If we're not in an ACI context, or every node in the list is not part of any ACI container group, return unchanged | ||
return nodes.map(n => n.containerId); | ||
} | ||
|
||
const groupsSet = new Set<string>(); | ||
|
||
nodes.forEach(n => { | ||
const groupName = getComposeProjectName(n.containerItem); | ||
|
||
groupsSet.add(groupName === NonComposeGroupName ? n.containerId : groupName); | ||
}); | ||
|
||
const groupsList = Array.from(groupsSet); | ||
const groupsConfirm = groupsList.map(g => `\'${g}\'`).join(', '); | ||
|
||
const confirm = localize('vscode-docker.commands.containers.aciContainerActionWarning.confirm', 'ACI containers can only be started or stopped in a group. This action will apply to all containers in {0}. Do you want to proceed?', groupsConfirm); | ||
|
||
// No need to check result - cancel will throw a UserCancelledError | ||
await ext.ui.showWarningMessage(confirm, { modal: true }, DialogResponses.yes); | ||
|
||
return groupsList; | ||
} |
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
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
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
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
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
Oops, something went wrong.