Skip to content

Commit 0f40afc

Browse files
authored
Allow user to select deployment template when add module (#548)
* Allow user to select deployment template when add module * Update version to 1.22.0 Co-authored-by: rentu <[email protected]>
1 parent d1e44bd commit 0f40afc

File tree

5 files changed

+24
-22
lines changed

5 files changed

+24
-22
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
# Change Log
2+
3+
## 1.22.0 - 2020-5-xx
4+
### Changed
5+
* Allow user to select deployment template when add module
6+
* Adopt VS Code's 'asWebviewUri' API
7+
28
## 1.21.0 - 2020-4-07
39
### Added
410
* Add check when input repository URL

README.md

+3-11
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,10 @@
2121

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

24-
## What's New (v1.21.0)
25-
### Added
26-
* Add check when input repository URL
27-
* Add retry logic when download standalone simulator
28-
* Add single module debug support for Python
29-
* Add arm64v8 platform support
30-
24+
## What's New (v1.22.0)
3125
### Changed
32-
* Use pip package URL instead of GitHub API to avoid rate limitation
33-
34-
### Fixed
35-
* Fixed image placeholder and docker path verification issue: [#159](https://github.com/microsoft/vscode-azure-iot-edge/issues/159)
26+
* Allow user to select deployment template when add module
27+
* Adopt VS Code's 'asWebviewUri' API
3628

3729
## Known Issues
3830
* [C module remote debug error](https://github.com/Microsoft/vscode-azure-iot-edge/issues/283)

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "azure-iot-edge",
33
"displayName": "Azure IoT Edge",
44
"description": "This extension is now a part of Azure IoT Tools extension pack. We highly recommend installing Azure IoT Tools to get full capabilities for Azure IoT development. Develop, deploy, debug, and manage your IoT Edge solution.",
5-
"version": "1.21.0",
5+
"version": "1.22.0-rc",
66
"publisher": "vsciot-vscode",
77
"aiKey": "95b20d64-f54f-4de3-8ad5-165a75a6c6fe",
88
"icon": "logo.png",

src/edge/edgeManager.ts

+13-9
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ export class EdgeManager {
5959
}
6060

6161
public async addModuleForSolution(outputChannel: vscode.OutputChannel, templateUri?: vscode.Uri): Promise<void> {
62+
const pattern = `{${Constants.deploymentTsonPattern}}`;
6263
let templateFile: string = await Utility.getInputFilePath(templateUri,
63-
Constants.deploymentTemplatePattern,
64+
pattern,
6465
Constants.deploymentTemplateDesc,
6566
`${Constants.addModuleEvent}.selectTemplate`);
6667
if (!templateFile) {
@@ -246,21 +247,24 @@ export class EdgeManager {
246247
const isTempsensorNeeded = isNewSolution && this.isCustomModule(template);
247248
const { usernameEnv, passwordEnv } = await this.addModuleToDeploymentTemplate(templateJson, templateFile, envFilePath, moduleInfo, isTempsensorNeeded);
248249

249-
const templateDebugFile = path.join(slnPath, Constants.deploymentDebugTemplate);
250250
const debugTemplateEnv = { usernameEnv: undefined, passwordEnv: undefined };
251251
let debugExist = false;
252-
if (await fse.pathExists(templateDebugFile)) {
253-
debugExist = true;
254-
const templateDebugJson = Utility.updateSchema(await fse.readJson(templateDebugFile));
255-
const envs = await this.addModuleToDeploymentTemplate(templateDebugJson, templateDebugFile, envFilePath, moduleInfo, isTempsensorNeeded, true);
256-
debugTemplateEnv.usernameEnv = envs.usernameEnv;
257-
debugTemplateEnv.passwordEnv = envs.passwordEnv;
252+
const templateName = path.basename(templateFile);
253+
if (templateName === Constants.deploymentTemplate) {
254+
const templateDebugFile = path.join(slnPath, Constants.deploymentDebugTemplate);
255+
if (await fse.pathExists(templateDebugFile)) {
256+
debugExist = true;
257+
const templateDebugJson = Utility.updateSchema(await fse.readJson(templateDebugFile));
258+
const envs = await this.addModuleToDeploymentTemplate(templateDebugJson, templateDebugFile, envFilePath, moduleInfo, isTempsensorNeeded, true);
259+
debugTemplateEnv.usernameEnv = envs.usernameEnv;
260+
debugTemplateEnv.passwordEnv = envs.passwordEnv;
261+
}
258262
}
259263

260264
if (!isNewSolution) {
261265
const launchUpdated: string = debugGenerated ? "and 'launch.json' are updated." : "are updated.";
262266
const moduleCreationMessage = isProjCreated ? `Module '${moduleInfo.moduleName}' has been created. ` : "";
263-
const deploymentTemlateMessage = debugExist ? "deployment.template.json, deployment.debug.template.json" : "deployment.template.json";
267+
const deploymentTemlateMessage = debugExist ? `${Constants.deploymentTemplate}, ${Constants.deploymentDebugTemplate}` : templateName;
264268
vscode.window.showInformationMessage(`${moduleCreationMessage} ${deploymentTemlateMessage} ${launchUpdated}`);
265269
}
266270
const address = await Utility.getRegistryAddress(moduleInfo.repositoryName);

0 commit comments

Comments
 (0)