Skip to content

Commit

Permalink
Dev/hshami/automatic user for environment (#610)
Browse files Browse the repository at this point in the history
* automatic

* 1- Update Readme. 2- Reload in dev container when 'Add Dev Container definition files...'

* Friendly prompt
  • Loading branch information
mhshami01 authored Oct 6, 2021
1 parent 3fce536 commit efff19c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@

![Added](images/multipleplatform.gif)

## What's New (v1.25.0)
* Generate Dev Container definition files with new Edge Solutions.
* Ability to add Dev Container definition files to existing Edge Solutions.

## What's New (v1.22.0)
### Changed
* Allow user to select deployment template when add module
Expand Down
2 changes: 1 addition & 1 deletion assets/containers/CSharp/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ COPY library-scripts/*.sh /tmp/library-scripts/
RUN \
apt-get update -y \
# Use Docker script from script library to set things up - enable non-root docker, user vscode, using moby
&& /bin/bash /tmp/library-scripts/docker-in-docker-debian.sh "true" "vscode" "true" \
&& /bin/bash /tmp/library-scripts/docker-in-docker-debian.sh "true" "automatic" "true" \
# install iotedgehubdev
&& apt-get install -y python3-pip && pip3 install iotedgehubdev \
# Clean up
Expand Down
3 changes: 3 additions & 0 deletions src/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ export class Constants {
public static CHOICE_REPLACE_DECRIPTION = "Replace existing Dev Container definitions";
public static CHOICE_KEEP = "Keep";
public static CHOICE_KEEP_DECRIPTION = "Keep existing Dev Container definitions";
public static CHOICE_YES = "Yes";
public static CHOICE_NO = "No";
public static LANGUAGE_CSHARP = "C# Module";
public static LANGUAGE_NODE = "Node.js Module";
public static LANGUAGE_PYTHON = "Python Module";
Expand Down Expand Up @@ -241,6 +243,7 @@ export class Constants {

public static canOnlyUseWithEdgeSolution = "This option is only available when an Azure IoT EdgeSolution is open.";
public static containerDefinitionIsPresent = "This solution currently uses a Dev Container";
public static reloadInDevContainer = "Reload Workspace in Dev Container";

public static openSampleEvent = "openSample";
public static openSampleUrlEvent = "openSampleUrl";
Expand Down
19 changes: 16 additions & 3 deletions src/edge/edgeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ export class EdgeManager {
const workspaceFolder = defaultFolder.fsPath;
const dotDevContainer = path.join(workspaceFolder, Constants.dotDevContainer);
if (await fse.pathExists(dotDevContainer)) {
const templatePicks: vscode.QuickPickItem[] = [
const replaceDontReplace: vscode.QuickPickItem[] = [
{
label: Constants.CHOICE_REPLACE,
description: Constants.CHOICE_REPLACE_DECRIPTION,
Expand All @@ -325,7 +325,7 @@ export class EdgeManager {
description: Constants.CHOICE_KEEP_DECRIPTION,
},
];
const doYouWishToOverride = await vscode.window.showQuickPick(templatePicks, { placeHolder: Constants.containerDefinitionIsPresent, ignoreFocusOut: true });
const doYouWishToOverride = await vscode.window.showQuickPick(replaceDontReplace, { placeHolder: Constants.containerDefinitionIsPresent, ignoreFocusOut: true });
if (!doYouWishToOverride) {
throw new UserCancelledError();
}
Expand All @@ -338,7 +338,20 @@ export class EdgeManager {
const selection = await this.selectDevContainerKind();
if (selection) {
await this.generateDevContainerDirectory(selection, workspaceFolder);
await vscode.commands.executeCommand("vscode.openFolder", vscode.Uri.file(workspaceFolder), false);
const reloadDontReload: vscode.QuickPickItem[] = [
{
label: Constants.CHOICE_YES,
description: "",
},
{
label: Constants.CHOICE_NO,
description: "",
},
];
const doYouWishToReload = await vscode.window.showQuickPick(reloadDontReload, { placeHolder: Constants.reloadInDevContainer, ignoreFocusOut: true });
if (doYouWishToReload && doYouWishToReload.label === Constants.CHOICE_YES) {
await vscode.commands.executeCommand("remote-containers.reopenInContainer", vscode.Uri.file(workspaceFolder), false);
}
}
}

Expand Down

0 comments on commit efff19c

Please sign in to comment.