Skip to content

Commit efff19c

Browse files
authored
Dev/hshami/automatic user for environment (#610)
* automatic * 1- Update Readme. 2- Reload in dev container when 'Add Dev Container definition files...' * Friendly prompt
1 parent 3fce536 commit efff19c

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121

2222
![Added](images/multipleplatform.gif)
2323

24+
## What's New (v1.25.0)
25+
* Generate Dev Container definition files with new Edge Solutions.
26+
* Ability to add Dev Container definition files to existing Edge Solutions.
27+
2428
## What's New (v1.22.0)
2529
### Changed
2630
* Allow user to select deployment template when add module

assets/containers/CSharp/.devcontainer/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ COPY library-scripts/*.sh /tmp/library-scripts/
66
RUN \
77
apt-get update -y \
88
# Use Docker script from script library to set things up - enable non-root docker, user vscode, using moby
9-
&& /bin/bash /tmp/library-scripts/docker-in-docker-debian.sh "true" "vscode" "true" \
9+
&& /bin/bash /tmp/library-scripts/docker-in-docker-debian.sh "true" "automatic" "true" \
1010
# install iotedgehubdev
1111
&& apt-get install -y python3-pip && pip3 install iotedgehubdev \
1212
# Clean up

src/common/constants.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ export class Constants {
5050
public static CHOICE_REPLACE_DECRIPTION = "Replace existing Dev Container definitions";
5151
public static CHOICE_KEEP = "Keep";
5252
public static CHOICE_KEEP_DECRIPTION = "Keep existing Dev Container definitions";
53+
public static CHOICE_YES = "Yes";
54+
public static CHOICE_NO = "No";
5355
public static LANGUAGE_CSHARP = "C# Module";
5456
public static LANGUAGE_NODE = "Node.js Module";
5557
public static LANGUAGE_PYTHON = "Python Module";
@@ -241,6 +243,7 @@ export class Constants {
241243

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

245248
public static openSampleEvent = "openSample";
246249
public static openSampleUrlEvent = "openSampleUrl";

src/edge/edgeManager.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ export class EdgeManager {
315315
const workspaceFolder = defaultFolder.fsPath;
316316
const dotDevContainer = path.join(workspaceFolder, Constants.dotDevContainer);
317317
if (await fse.pathExists(dotDevContainer)) {
318-
const templatePicks: vscode.QuickPickItem[] = [
318+
const replaceDontReplace: vscode.QuickPickItem[] = [
319319
{
320320
label: Constants.CHOICE_REPLACE,
321321
description: Constants.CHOICE_REPLACE_DECRIPTION,
@@ -325,7 +325,7 @@ export class EdgeManager {
325325
description: Constants.CHOICE_KEEP_DECRIPTION,
326326
},
327327
];
328-
const doYouWishToOverride = await vscode.window.showQuickPick(templatePicks, { placeHolder: Constants.containerDefinitionIsPresent, ignoreFocusOut: true });
328+
const doYouWishToOverride = await vscode.window.showQuickPick(replaceDontReplace, { placeHolder: Constants.containerDefinitionIsPresent, ignoreFocusOut: true });
329329
if (!doYouWishToOverride) {
330330
throw new UserCancelledError();
331331
}
@@ -338,7 +338,20 @@ export class EdgeManager {
338338
const selection = await this.selectDevContainerKind();
339339
if (selection) {
340340
await this.generateDevContainerDirectory(selection, workspaceFolder);
341-
await vscode.commands.executeCommand("vscode.openFolder", vscode.Uri.file(workspaceFolder), false);
341+
const reloadDontReload: vscode.QuickPickItem[] = [
342+
{
343+
label: Constants.CHOICE_YES,
344+
description: "",
345+
},
346+
{
347+
label: Constants.CHOICE_NO,
348+
description: "",
349+
},
350+
];
351+
const doYouWishToReload = await vscode.window.showQuickPick(reloadDontReload, { placeHolder: Constants.reloadInDevContainer, ignoreFocusOut: true });
352+
if (doYouWishToReload && doYouWishToReload.label === Constants.CHOICE_YES) {
353+
await vscode.commands.executeCommand("remote-containers.reopenInContainer", vscode.Uri.file(workspaceFolder), false);
354+
}
342355
}
343356
}
344357

0 commit comments

Comments
 (0)