node-red-contrib-room-tools 1.8.8 → 1.8.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  # ControlPanel 前端页面编写指南
2
2
 
3
- 适用基线:`node-red-contrib-room-tools@1.8.8` 的 `ui-control-panel`,Dashboard 2,Vue Options API。本文按当前代码审核,不表示支持任意 Vue、Vuetify 或第三方组件。
3
+ 适用基线:`node-red-contrib-room-tools@1.8.9` 的 `ui-control-panel`,Dashboard 2,Vue Options API。本文按当前代码审核,不表示支持任意 Vue、Vuetify 或第三方组件。
4
4
 
5
5
  给 AI 编写页面前阅读本文。目标是:页面作者只写普通前端页面;部署人员在网页编辑模式选择设备与点位;ControlPanel 保存映射并负责设备命令、反馈和网页侧量程换算。
6
6
 
@@ -137,7 +137,7 @@ export default {
137
137
  ## 5. 部署与绑定
138
138
 
139
139
  1. 将页面粘贴到 `ui-control-panel` Template,选择 Dashboard 页面,设置 Room ID、普通账号及独立的编辑账号。普通账号密码至少 12 个字符;账号密码由节点配置,不能写入 H5。保存并 Deploy。
140
- 2. 重新打开节点,点击 `Open page binding editor`,用编辑账号登录。Select 默认激活,可以点击、右键或触屏长按可绑定控件。
140
+ 2. 重新打开节点,点击 `Open binding editor`,用编辑账号登录。Select 默认激活,可以点击、右键或触屏长按可绑定控件。`Open page` 打开普通控制页面,使用普通用户账号登录。
141
141
  3. 选择在线设备、模式、Write point、Feedback point、编号方式,保存草稿。草稿和亮紫色边框不表示已部署;边框只在编辑模式显示。
142
142
  4. 点 Apply。节点检查当前模板、目录参数和 Flow 版本,备份后替换该面板此前生成的桥接并部署。不会无限追加旧桥接,也不会清除其他面板的绑定。Apply 成功后仍在编辑页,无需再次登录。
143
143
  5. 点 Exit,回到普通页面登录页,再输入普通账号密码。普通账号不能进入编辑模式;不登录不能操作设备。进程重启或凭据变化可能要求重新登录。
package/README.md CHANGED
@@ -4,7 +4,7 @@ This package provides `ui-control-panel` for Node-RED and MUSE Automator.
4
4
 
5
5
  ## ControlPanel
6
6
 
7
- The page author writes ordinary HTML/CSS/Vue and pastes it into the `ui-control-panel` Template. After configuring a Dashboard page, room ID, control login, and separate editor login, save and Deploy. Reopen the node and select **Open page binding editor**. Sign in with the editor account, right-click a supported control, choose its device points, and Apply.
7
+ The page author writes ordinary HTML/CSS/Vue and pastes it into the `ui-control-panel` Template. After configuring a Dashboard page, room ID, control login, and separate editor login, save and Deploy. Reopen the node and select **Open binding editor**. Sign in with the editor account, right-click a supported control, choose its device points, and Apply. **Open page** opens the normal control page with its separate user login.
8
8
 
9
9
  Both logins work over HTTP on a trusted local network. HTTPS is recommended for other networks because HTTP transmits credentials without encryption. Session cookies are marked `Secure` when the connection uses HTTPS.
10
10
 
@@ -229,9 +229,11 @@
229
229
  })
230
230
 
231
231
  $('#control-binding-auth').show()
232
- $('#control-visual-open').on('click', function () {
232
+ const openDashboardPage = (editMode) => {
233
+ const scope = $templateScope.val() || that.templateScope || 'local'
233
234
  const group = RED.nodes.node($('#node-input-group').val() || that.group)
234
- const page = RED.nodes.node($('#node-input-page').val() || that.page || group?.page)
235
+ const pageId = scope === 'local' ? group?.page : ($('#node-input-page').val() || that.page)
236
+ const page = RED.nodes.node(pageId)
235
237
  const base = RED.nodes.node(page?.ui)
236
238
  if (!page?.path) {
237
239
  RED.notify('Choose a Dashboard page, then save and deploy this node.', { type: 'warning' })
@@ -239,9 +241,11 @@
239
241
  }
240
242
  const url = new URL((base?.path || '/dashboard').replace(/\/$/, '') + '/' +
241
243
  page.path.replace(/^\//, ''), window.location.origin)
242
- url.searchParams.set('cp-edit', that.id)
244
+ if (editMode) url.searchParams.set('cp-edit', that.id)
243
245
  window.open(url.href, '_blank', 'noopener')
244
- })
246
+ }
247
+ $('#control-page-open').on('click', () => openDashboardPage(false))
248
+ $('#control-visual-open').on('click', () => openDashboardPage(true))
245
249
  RED.library.create({
246
250
  url: 'uitemplates', // where to get the data from
247
251
  type: 'ui-template', // the type of object the library is for
@@ -350,7 +354,7 @@
350
354
  <p>普通 HTML/Vue 控件由页面绑定编辑器自动识别,并通过面板的 authenticated session 发送控制。开发者不需要添加标签、调用自定义节点 API,或在 Template 中实现 throttling、latest-wins、队列和设备协议。</p>
351
355
  <p>页面只需按普通 H5/Vue 方式编写控件;编辑模式下在控件上打开绑定菜单,选择设备参数即可。登录、发送、反馈和状态同步由节点负责,Template 不应主动查询设备或把反馈回发成命令。</p>
352
356
  <p>See <code>CONTROL_PANEL_AI_GUIDE.md</code> in the node package for the complete AI authoring contract and examples.</p>
353
- <p>Save and Deploy the panel, then use Open page binding editor. Apply in that page validates and saves bindings, backs up the Flow, regenerates the native bridge, and deploys it. Ordinary Deploy alone does not apply bindings. Check targets and numbering before using real hardware.</p>
357
+ <p>Save and Deploy the panel, then use Open binding editor. Apply in that page validates and saves bindings, backs up the Flow, regenerates the native bridge, and deploys it. Ordinary Deploy alone does not apply bindings. Check targets and numbering before using real hardware.</p>
354
358
  </script>
355
359
 
356
360
  <script type="text/html" data-template-name="ui-control-panel">
@@ -428,10 +432,10 @@
428
432
  <div style="height:250px; min-height:100px" class="node-text-editor" id="node-input-format-editor" ></div>
429
433
  </div>
430
434
  <div class="form-row">
431
- <label>Page binding</label>
435
+ <label>Page</label>
432
436
  <input type="hidden" id="node-input-visualBindings">
433
- <button type="button" id="control-visual-open" class="red-ui-button">Open page binding editor</button>
434
- <span class="control-binding-hint">Use ordinary HTML/Vue controls. Binding is configured from the page.</span>
437
+ <button type="button" id="control-page-open" class="red-ui-button">Open page</button>
438
+ <button type="button" id="control-visual-open" class="red-ui-button">Open binding editor</button>
435
439
  </div>
436
440
  <div class="form-row" style="display:none">
437
441
  <input type="hidden" id="node-input-bridgeRevisionApplied">
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "node-red-contrib-room-tools",
3
- "version": "1.8.8",
3
+ "version": "1.8.9",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "node-red-contrib-room-tools",
9
- "version": "1.8.8",
9
+ "version": "1.8.9",
10
10
  "license": "UNLICENSED",
11
11
  "dependencies": {
12
12
  "@vue/compiler-sfc": "3.5.42",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-red-contrib-room-tools",
3
- "version": "1.8.8",
3
+ "version": "1.8.9",
4
4
  "description": "Authenticated visual control panel binding for Node-RED and MUSE Automator",
5
5
  "license": "UNLICENSED",
6
6
  "engines": { "node": ">=18.16.0" },