Remove Edge snippets, update README and CHANGELOG (#70)
This commit is contained in:
Родитель
8ad8dbf6c8
Коммит
05f8fdc104
|
@ -1,4 +1,4 @@
|
|||
## 0.6.0 (2018-03-??)
|
||||
## 0.6.0 (2018-03-09)
|
||||
### Added
|
||||
* Expose APIs for dependent extensions to use
|
||||
* Return IoT Hub Connection String in create/select IoT Hub APIs
|
||||
|
@ -15,6 +15,8 @@
|
|||
* Sort commands in View title menu
|
||||
* Not show Connection String Input Box on startup
|
||||
* Rename explorer to 'Azure IoT Hub Devices'
|
||||
* Move Edge code snippets to [Azure IoT Edge](https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.azure-iot-edge) extension
|
||||
* The "Generate Edge deployment manifest" command is replaced by [Azure IoT Edge](https://marketplace.visualstudio.com/items?itemName=vsciot-vscode.azure-iot-edge) extension's "Generate IoT Edge deployment manifest file" command
|
||||
|
||||
## 0.5.0 (2017-12-25)
|
||||
* [Added] Create IoT Hub
|
||||
|
|
|
@ -28,7 +28,6 @@ Interact with Azure IoT Hub, IoT Device Management, IoT Edge Management, IoT Hub
|
|||
* Manage Edge runtime
|
||||
* Create deployment for Edge device
|
||||
* Generate Edge setup configuration file
|
||||
* Generate Edge deployment manifest
|
||||
|
||||
### Prerequisites
|
||||
|
||||
|
@ -73,8 +72,6 @@ Instead of copying and pasting to set IoT Hub Connection String, you could sign
|
|||
| iotMonitorC2DMessage | Monitor C2D message from IoT Hub |
|
||||
| iotCallDirectMethods | Send direct methods to device |
|
||||
| iotReceiveDirectMethods | Receive direct methods from IoT Hub |
|
||||
| edgeModule | Add Edge module in Edge deployment manifest |
|
||||
| edgeRoute | Add Edge route in Edge deployment manifest |
|
||||
|
||||
![Snippet](https://github.com/formulahendry/vscode-azure-iot-toolkit/raw/master/images/snippet.gif)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "azure-iot-toolkit",
|
||||
"version": "0.4.3",
|
||||
"version": "0.6.0-rc",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@ -2368,11 +2368,6 @@
|
|||
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
|
||||
"integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus="
|
||||
},
|
||||
"jsonc-parser": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-1.0.0.tgz",
|
||||
"integrity": "sha1-3cyGSucI5gp6bdNtrqABcvqNknI="
|
||||
},
|
||||
"jsonify": {
|
||||
"version": "0.0.0",
|
||||
"resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz",
|
||||
|
|
|
@ -481,7 +481,6 @@
|
|||
"azure-iothub": "^1.1.13",
|
||||
"clipboardy": "^1.1.4",
|
||||
"fqdn-multi": "^0.1.1",
|
||||
"jsonc-parser": "^1.0.0",
|
||||
"ms-rest": "^2.2.4",
|
||||
"ms-rest-azure": "^2.4.1",
|
||||
"strip-json-comments": "^2.0.1",
|
||||
|
|
|
@ -3,7 +3,6 @@ import * as vscode from "vscode";
|
|||
import { AzureIoTExplorer } from "./azureIoTExplorer";
|
||||
import { DeviceTree } from "./deviceTree";
|
||||
import { Executor } from "./executor";
|
||||
import { JsonCompletionItemProvider } from "./jsonCompletionItemProvider";
|
||||
import { TelemetryClient } from "./telemetryClient";
|
||||
|
||||
export function activate(context: vscode.ExtensionContext) {
|
||||
|
@ -14,8 +13,6 @@ export function activate(context: vscode.ExtensionContext) {
|
|||
|
||||
vscode.window.registerTreeDataProvider("iotHubDevices", deviceTree);
|
||||
|
||||
vscode.languages.registerCompletionItemProvider([{ language: "json" }, { language: "jsonc" }], new JsonCompletionItemProvider(), "\"");
|
||||
|
||||
context.subscriptions.push(vscode.commands.registerCommand("azure-iot-toolkit.refresh", (element) => {
|
||||
deviceTree.refresh(element);
|
||||
}));
|
||||
|
|
|
@ -1,82 +0,0 @@
|
|||
"use strict";
|
||||
import { getLocation, Location, parse } from "jsonc-parser";
|
||||
import * as vscode from "vscode";
|
||||
|
||||
export class JsonCompletionItemProvider implements vscode.CompletionItemProvider {
|
||||
public provideCompletionItems(document: vscode.TextDocument, position: vscode.Position): vscode.ProviderResult<vscode.CompletionItem[]> {
|
||||
const location: Location = getLocation(document.getText(), document.offsetAt(position));
|
||||
const range: vscode.Range = document.getWordRangeAtPosition(position) || new vscode.Range(position, position);
|
||||
if (location.path[0] === "moduleContent" && location.path[1] === "$edgeHub" && location.path[2] === "properties.desired" && location.path[3] === "routes") {
|
||||
const json = parse(document.getText());
|
||||
const modules: any = ((json.moduleContent.$edgeAgent || {})["properties.desired"] || {}).modules || {};
|
||||
const moduleIds: string[] = Object.keys(modules);
|
||||
|
||||
const routeCompletionItem: vscode.CompletionItem = new vscode.CompletionItem("edgeRoute");
|
||||
routeCompletionItem.filterText = "\"edgeRoute\"";
|
||||
routeCompletionItem.kind = vscode.CompletionItemKind.Snippet;
|
||||
routeCompletionItem.detail = "Route for the Edge Hub. Route name is used as the key for the route. To delete a route, set the route name as null";
|
||||
routeCompletionItem.range = range;
|
||||
routeCompletionItem.insertText = new vscode.SnippetString(this.getRouteSnippetString(moduleIds));
|
||||
return [routeCompletionItem];
|
||||
}
|
||||
|
||||
if (location.path[0] === "moduleContent" && location.path[1] === "$edgeAgent" && location.path[2] === "properties.desired" && location.path[3] === "modules") {
|
||||
const moduleCompletionItem = new vscode.CompletionItem("edgeModule");
|
||||
moduleCompletionItem.filterText = "\"edgeModule\"";
|
||||
moduleCompletionItem.kind = vscode.CompletionItemKind.Snippet;
|
||||
moduleCompletionItem.detail = "Module for edgeAgent to start";
|
||||
moduleCompletionItem.range = range;
|
||||
moduleCompletionItem.insertText = new vscode.SnippetString([
|
||||
"\"${1:SampleModule}\": {",
|
||||
"\t\"version\": \"${2:1.0}\",",
|
||||
"\t\"type\": \"docker\",",
|
||||
"\t\"status\": \"${3|running,stopped|}\",",
|
||||
"\t\"restartPolicy\": \"${4|always,never,on-failed,on-unhealthy|}\",",
|
||||
"\t\"settings\": {",
|
||||
"\t\t\"image\": \"${5:<registry>}/${6:<image>}:${7:<tag>}\",",
|
||||
"\t\t\"createOptions\": \"${8:{}}\"",
|
||||
"\t}",
|
||||
"}",
|
||||
].join("\n"));
|
||||
return [moduleCompletionItem];
|
||||
}
|
||||
}
|
||||
|
||||
private getRouteSnippetString(moduleIds: string[]): string {
|
||||
const snippet: string[] = ["\"${1:route}\":", "\"FROM"];
|
||||
|
||||
const sources: string[] = ["${2|/*", "/messages/*", "/messages/modules/*"];
|
||||
if (moduleIds.length === 0) {
|
||||
sources.push(`/messages/modules/{moduleId}/*`);
|
||||
sources.push(`/messages/modules/{moduleId}/outputs/*`);
|
||||
sources.push(`/messages/modules/{moduleId}/outputs/{output}`);
|
||||
} else {
|
||||
for (const moduleId of moduleIds) {
|
||||
sources.push(`/messages/modules/${moduleId}/*`);
|
||||
}
|
||||
for (const moduleId of moduleIds) {
|
||||
sources.push(`/messages/modules/${moduleId}/outputs/*`);
|
||||
}
|
||||
for (const moduleId of moduleIds) {
|
||||
sources.push(`/messages/modules/${moduleId}/outputs/{output}`);
|
||||
}
|
||||
}
|
||||
|
||||
snippet.push(sources.join(",") + "|}");
|
||||
snippet.push("WHERE ${3:<condition>} INTO");
|
||||
|
||||
const sinks: string[] = ["${4|$upstream"];
|
||||
if (moduleIds.length === 0) {
|
||||
sinks.push(`BrokeredEndpoint(\\"/modules/{moduleId}/inputs/{input}\\")`);
|
||||
} else {
|
||||
for (const moduleId of moduleIds) {
|
||||
sinks.push(`BrokeredEndpoint(\\"/modules/${moduleId}/inputs/{input}\\")`);
|
||||
}
|
||||
}
|
||||
|
||||
snippet.push(sinks.join(",") + "|}\"");
|
||||
|
||||
return snippet.join(" ");
|
||||
}
|
||||
|
||||
}
|
Загрузка…
Ссылка в новой задаче