Skip to content

[BUG]nodered-dashboard2页面无法显示,编辑Layout后无法保存 #2018

@WuBingo12

Description

@WuBingo12

首先建议增加西门子S7无法更改端口功能(plc模拟软件调试的时候特别需要修改端口)
server\runtime\devices\s7\index.js 38行 在ConnectTo连接前增加参数设置远程端口

                        if (data.property.port != null && data.property.port >= 0 ){
                            s7client.SetParam(2, data.property.port);
                        }

增加界面修改端口功能 client\src\app\device\device-property\device-property.component.html 134行property-slot下增加property-port ***

                    <div class="my-form-field" style="display: inline-block;margin-bottom: 10px;padding-left: 10px;">
                       <span>{{'device.property-port' | translate}}</span>
                       <input numberOnly [(ngModel)]="data.device.property.port" style="width: 80px" type="text">
                    </div>

然后我按照wiki提示的安装了nodered-dashboard2,但是无法通过教程中的路径访问,后面我调试修改了代码
server\integrations\node-red\index.js130行 增加少写的/api路径

        app.use('/nodered/api', allowDashboard, RED.httpNode);

这样/nodered/api/dashboard就能正常访问,但是还有一个问题没有解决,希望能您能帮助解决:
Image
上面的两个窗体无法点击打开,其中Open Dashboard 可以通过右键打开http://localhost:1881/nodered/api/dashboard/page1
但是Layout Editor这个窗体无法打开,如果我修改
server\integrations\node-red\index.js118行增加nodered跳过权限验证,可以直接通过http://localhost:1881/nodered访问控制面板

if (req.path.includes('/dashboard') || req.baseUrl.includes('/nodered') || req.path.includes('/socket.io')) return next();

并设置调整UI页面路径,在server_appdata\node-red\node_modules@flowfuse\node-red-dashboard\nodes\config\ui_base.html文件316行showDashboardWysiwygEditor函数中,增加RED.settings.httpNodeRoot前缀

const _url = new URL(`${RED.settings.httpNodeRoot}/${dashboardBasePath}/${data.path}`.replace(/\/\//g, '/'), windowUrl.origin)

这样能正常打开Layout Editor页面http://localhost:1881/nodered/api/dashboard/page1?edit-key=kvfr3lvv0lo&editor-path=nodered
但是修改Layout 后无法保存,发现保存的路径为 PATCH /nodered/nodered/api/dashboard/api/v1/287fb08ba6bc1372/flows 404 1.664 ms 无法访问
Image

请帮忙测试或者修复,万分感谢!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions