From 53c4a3b6a107868d077c644331813a6e05f9c080 Mon Sep 17 00:00:00 2001 From: Joe Pavitt Date: Wed, 17 Jan 2024 09:34:53 +0000 Subject: [PATCH] Fix 494 & set default page path --- nodes/config/ui_page.html | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/nodes/config/ui_page.html b/nodes/config/ui_page.html index 5f236fa26..47a834527 100644 --- a/nodes/config/ui_page.html +++ b/nodes/config/ui_page.html @@ -12,7 +12,7 @@ required: true }, path: { - value: '/', + value: -1, required: false }, icon: { @@ -32,10 +32,21 @@ value: -1 }, className: { value: '' }, - visible: { value: true }, - disabled: { value: false } + visible: { value: 'true' }, + disabled: { value: 'false' } }, oneditprepare: function () { + if (this.path === -1) { + // we have no path set yet + let pageCount = 0 + RED.nodes.eachConfig((cNode) => { + pageCount += cNode.type === 'ui-page' ? 1 : 0 + }) + this.path = '/page' + (pageCount + 1) + $('#node-config-input-path').val(this.path) + console.log('setting path to', this.path) + } + $('#node-config-input-layout').typedInput({ type: 'layout', types: [{