Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 节点红色:在api响应上添加模式对话框_Jquery_Node.js_Node Red - Fatal编程技术网

Jquery 节点红色:在api响应上添加模式对话框

Jquery 节点红色:在api响应上添加模式对话框,jquery,node.js,node-red,Jquery,Node.js,Node Red,我需要一些关于节点红流编辑器的帮助。我修改了“将节点导出到剪贴板”模式对话框,并在“导出到剪贴板”后添加了一个按钮。单击按钮后,我进行一个外部API调用,该调用工作正常,并从服务器返回响应。进行API调用的代码编写在/API/editor/code.js文件中,如下所示: const { flows } = redNodes.getFlows(); axios.post(externalUrl, flows) .then((response) => { // nic

我需要一些关于节点红流编辑器的帮助。我修改了“将节点导出到剪贴板”模式对话框,并在“导出到剪贴板”后添加了一个按钮。单击按钮后,我进行一个外部API调用,该调用工作正常,并从服务器返回响应。进行API调用的代码编写在/API/editor/code.js文件中,如下所示:

const { flows } = redNodes.getFlows();
axios.post(externalUrl, flows)
    .then((response) => {
        // nice little modal dialog on response
        res.status(200).send(response.data.message);
    })
    .catch((error) => {
        console.log('error', error.message);
    });
我想在Node Red应用程序内的模式对话框上显示从API调用获得的信息。我如何做到这一点

谢谢你有两个选择:

  • Node RED使用jQueryUI,因此您可以使用任何想要的内容创建自己的内容。有很多使用该api的例子,我在这里不再重复

  • 节点红色为下拉通知提供
    RED.notify
    api。您可以使用它来显示结果

  • 在最简单的情况下,您可以调用:

    RED.notify("This is my message");
    
    该消息的默认显示时间为5秒

    如果要让它一直粘住直到用户单击按钮,可以执行以下操作:

    var myNotification = RED.notify("This is the message to display",{
            modal: true,
            fixed: true,
            buttons: [
                {
                    text: "cancel",
                    click: function(e) {
                        myNotification.close();
                    }
                },
                {
                    text: "okay",
                    class:"primary",
                    click: function(e) {
                        myNotification.close();
                    }
                }
            ]
        });
    
    您有两个选择:

  • Node RED使用jQueryUI,因此您可以使用任何想要的内容创建自己的内容。有很多使用该api的例子,我在这里不再重复

  • 节点红色为下拉通知提供
    RED.notify
    api。您可以使用它来显示结果

  • 在最简单的情况下,您可以调用:

    RED.notify("This is my message");
    
    该消息的默认显示时间为5秒

    如果要让它一直粘住直到用户单击按钮,可以执行以下操作:

    var myNotification = RED.notify("This is the message to display",{
            modal: true,
            fixed: true,
            buttons: [
                {
                    text: "cancel",
                    click: function(e) {
                        myNotification.close();
                    }
                },
                {
                    text: "okay",
                    class:"primary",
                    click: function(e) {
                        myNotification.close();
                    }
                }
            ]
        });