Use tooltip to show connection state (#362)
* Use tooltip to show connection state; Show running status even when module is disconnected * Not show tooltip on Edge deivce
This commit is contained in:
Родитель
0726474519
Коммит
1788fb7d0c
|
@ -13,6 +13,7 @@ export class DeviceItem extends TreeItem implements QuickPickItem {
|
|||
public description: string) {
|
||||
super(deviceId);
|
||||
this.contextValue = "device";
|
||||
this.tooltip = this.connectionState;
|
||||
this.collapsibleState = TreeItemCollapsibleState.Collapsed;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,13 +16,14 @@ export class ModuleItem extends TreeItem {
|
|||
public readonly contextValue: string) {
|
||||
super(moduleId);
|
||||
this.deviceId = deviceItem.deviceId;
|
||||
this.tooltip = connectionState;
|
||||
this.command = {
|
||||
command: "azure-iot-toolkit.getModule",
|
||||
title: "",
|
||||
arguments: [this],
|
||||
};
|
||||
if (connectionState === "Connected") {
|
||||
this.description = runtimeStatus ? `${connectionState} (${runtimeStatus})` : connectionState;
|
||||
if (runtimeStatus) {
|
||||
this.description = runtimeStatus;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -200,12 +200,12 @@ export class Utility {
|
|||
const moduleId = module.moduleId.substring(1);
|
||||
if (desiredTwin.systemModules && desiredTwin.systemModules[moduleId]) {
|
||||
return new ModuleItem(deviceItem, module.moduleId, module.connectionString, module.connectionState,
|
||||
isConnected && reportedTwin ? this.getModuleRuntimeStatus(moduleId, reportedTwin.systemModules) : undefined, iconPath, "edge-module");
|
||||
reportedTwin ? this.getModuleRuntimeStatus(moduleId, reportedTwin.systemModules) : undefined, iconPath, "edge-module");
|
||||
}
|
||||
} else {
|
||||
if (desiredTwin.modules && desiredTwin.modules[module.moduleId]) {
|
||||
return new ModuleItem(deviceItem, module.moduleId, module.connectionString, module.connectionState,
|
||||
isConnected && reportedTwin ? this.getModuleRuntimeStatus(module.moduleId, reportedTwin.modules) : undefined, iconPath, "edge-module");
|
||||
reportedTwin ? this.getModuleRuntimeStatus(module.moduleId, reportedTwin.modules) : undefined, iconPath, "edge-module");
|
||||
}
|
||||
}
|
||||
const moduleType = module.moduleId.startsWith("$") ? "edge-module" : "module";
|
||||
|
@ -292,13 +292,11 @@ export class Utility {
|
|||
return deviceList.map((device) => {
|
||||
const isConnected = device.connectionState.toString() === "Connected";
|
||||
const state: string = isConnected ? "on" : "off";
|
||||
if (isConnected) {
|
||||
device.description = device.connectionState.toString();
|
||||
}
|
||||
let deviceType: string;
|
||||
if (edgeDeviceIdSet.has(device.deviceId)) {
|
||||
deviceType = "edge";
|
||||
device.contextValue = "edge";
|
||||
device.tooltip = "";
|
||||
} else {
|
||||
deviceType = "device";
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче