Thingsboard 版本:
v3.6.2PE
小部件:
Entities hierarchy
我正在使用自定义操作(操作来源:
on node selected
)。我可以使用自定义操作基于 EntityType
导航到不同的仪表板。我遇到了一种新情况,其中自定义操作应该接收用户的输入。例如,
以下是我的代码片段,单击节点时会显示弹出窗口。
function showActionPopup(title, actions) {
widgetContext.dialogs.confirm(title, "Select an action:").then(function (selectedAction) {
if (selectedAction === actions[0]) {
openDashboardStates("device_fw_n_sw");
} else if (selectedAction === actions[1]) {
showAlertDialog("Device Details", "Device details to be displayed here");
}
});
}
上面的函数调用自:
$injector.get(widgetContext.servicesMap.get('entityService')).getEntity(entityId.entityType, entityId.id)
.subscribe(function (data) {
if (entityId.entityType == "DEVICE") {
showActionPopup("Title", ["Open Dashboard1", "Open dashboard2"]);
} else if (entityId.entityType == "ASSET") {
showActionPopup("Title", ["Open Asset Dashboard1", "Open Asset Details"]);
}
});
代码片段中看到的操作是示范性的,我的实际操作是不同的。
我使用上面的代码片段得到以下内容:
看来
widgetContext.dialogs.confirm
对我来说没有帮助,并且 widgetContext.dialogs.popup
在 Thingsboard 中不可用。
这个问题如何解决?
谢谢你。