Releases: TotallyInformation/node-red-contrib-uibuilder
Feature release: Scripts tab, custom server public folder, bug fixes and more
Code commits since last release.
NOTE: If using the uibRouter SPA client library, please note that the startup processing has changed slightly. You may now get an error if you have specified a route container element but it doesn't exist. Unfortunately, some of the examples shared have this error and so will now break unless that container element id is changed. Sorry about that. The built-in router/SPA example has been updated to reflect this change.
📌 Highlights
-
New "Quick Start" guides added to the documentation. Two main approaches: no-code/low-code and low-code/custom code. Each approach has a step-by-step guide to get you started quickly. In addition, several documentation pages now have rotating "tips" selected randomly from a list, they change every 15 seconds.
-
A new browser overlay notification message feature available. Using
showOverlayallows messages of different types (info, success, warning, and error) to be displayed to users in the browser. This can be triggered from Node-RED or from front-end code. Messages can be auto-dismissed after a few seconds (the default), or retained until manually dismissed. -
The
uibuildernode now has an extra tab "scripts" which lets you run npm scripts defined in your instance root's package.json file.These can be any script that can be run on the host OS. They run in the OS's default shell. Output from the script is captured and returned to Node-RED in the panel beneath the list of scripts. When a script is running, a "Kill Script" button is visible, clicking this wil abort the script immediately.
-
The 🌐 emoji is now in use consistently across UIBUILDER. You will find it in announcements on the forum, log messages, on the web page open buttons in the Editor and elsewhere. I am using this because emoji's are single-characters and usable anywhere that UTF-8 text is usable.
-
uibuilder installation will now ERROR and stop if the Node-RED userDir folder is not writable. This is to prevent the uibuilder node from being misconfigured and not working correctly. The error message will show the userDir folder that is not writable.
-
When using uibuilder's custom web server option, you now have the option to create a
<uibRoot>/.publicfolder. It is served as the root URL. This is where you can place static files that you want to serve from the custom web server. The folder will be created automatically if it does not exist. You can also use this folder to serve static files such as images, CSS, and JavaScript files. Create anindex.htmlfile in the folder to serve a custom root home page. The folder is not served if you are using the default Node-RED web server (Use Node-RED's public folder for that). -
The documentation now has a "Tips" page that rotates through a selection of tips. I will be adding more tips over time. If you have any tips that you think would be useful, please let me know.
Example flows
- NEW
uib-basicAn inject node to a uibuilder node with debug nodes on each output. Inputs and outputs minimised. Outputs show full msg and show msg count. - UPDATED Client-side code > FE Router Test. A complete front-end router example flow including html, js and route partials.
- UPDATE "Remote Commands" renamed to "Control UI from Node-RED" and refreshed. New showOverlay notifications included.
uibuilder node
-
NEW Two new Editor actions have been added. This enables you to run these actions from keyboard shortcuts.
open-uibuilder-site- opens the selected uibuilder instances web site in a new browser tab.edit-uibuilder-site- opens the selected uibuilder instances source folder in your full IDE. THe configuration for this comes from the "Code Editor URL" in the node's advanced properties tab (defaulting to VS Code).
-
Updated the buttons on the Editor config panel's top button bar to use icons instead of text. Note that the wireframe globe is now used consistently across uibuilder.
-
NEW An extra tab "scripts" has been added. This lets you run npm scripts defined in your instance root's package.json file.
These can be any script that can be run on the host OS. They run in the OS's default shell. Output from the script is captured and returned to Node-RED in the panel beneath the list of scripts. When a script is running, a "Kill Script" button is visible, clicking this wil abort the script immediately.
In addition to scripts that you define, the default npm
outdated,update, andinstallscripts are also available to run. -
FIX for issue #564. VSCode edit link would not work if the uibuilder root folder did not start with a
/. Also, the VSCode edit link could not be amended. -
FIX for duplicate url error when node is used in a subflow. Ref.
-
FIX for issue #556. The library list in the Editor config panel would not work correctly if a library name contained special characters. Thanks to Paul Reed for reporting this issue.
Ui class
-
Fixed a hidden issue with
replaceSlot(). The safe method of creating a DocumentFragment does not work if the parent element is a<template>. For that, you can only useinnerHTML. -
NEW showOverlay function. This function creates and displays an overlay window with customizable content and behavior. See the uibuilder client documentation for more details.
uib-sender node
- BUG FIX It was not returning messages from the front-end. This was a regression bug from a previous update. Many thanks to @Robert0 for reporting.
uib-brand.css front-end styles
- Improved colour contrast for default text/background.
- Improved background contrast for forms. Forms now stand out if emmbedded in an
<article>element. - Corrected the foreground/background colour for inputs and textareas. Now works better in light mode.
- Improved appearance of inputs and select elements outside of forms.
- Updated the table header styles to make them sticky. This means that the table headers will remain visible when scrolling down a long table. This is particularly useful for large tables with many rows.
- Changed
accent-colorto use the--primaryvariable rather than the--brandvariable.accent-coloris used by browsers to set the colour of form elements such as checkboxes and radio buttons. This means that the colour will now match the primary colour used in the rest of the uibuilder styles. - Added
cursor: pointer;to the<summary>element. This makes it clearer that the element is clickable and can be expanded or collapsed. - Improved
.status-side-panelstyles. Allowing background color to be overridden with--status-color.
For forms, the following CSS variables (show with their defaults) can be used to more easily change the appearance of the forms:
/* The main background color for form elements */
--form-bg: var(--surface1);
/* The main text color for form elements */
--form-fg: var(--text2);
/* The border color for form elements */
--form-border: 1px solid var(--text3);For the updated navigation menus, the following CSS variables (show with their defaults) can be used to more easily change the appearance of the menus:
/* The main background color for the menu */
--nav-bg: var(--surface3);
/* The main text color for the menu */
--nav-fg: var(--text2);
/* Secondary background color - used when hovering over other menu items */
--nav-2nd-bg: var(--primary-bg);
/* More contrasting text color - used for selected menu items */
--nav-2nd-fg: var(--text1);
/* More contrasting background color - Used for menu pop-up background */
--nav-3rd-bg: var(--surface2);uibuilder client library
-
NEW function
uibuilder.reactive(srcvar)This function allows you to create a reactive variable. It outputs a custom event when the variable changes (including deep object changes). It returns the reactive version of the variable. This also has several new methods:
onChange(property, callback): Adds a listener that triggers the callback when the specified property of the reactive variable changes. If'*'is specified, it listens for any change to the variable. It returns a reference to the callback that can be used to remove the listener later. The reference also has acancel()methodcancelChange(callbackRef): Removes a listener using a saved callback reference.
[!WARNING]
If the reactive variable is a primative type (string, number, boolean), then the you MUST use themyvar.value = 42syntax to change the value. If you usemyvar = 42, then the reactive variable will overwritten. Thevalueproperty will also let you change a primative even if it has been created withconst. -
NEW
showOverlayfunction. This function creates and displays an overlay window with customizable content and behavior. This is an easy way to display some temporary information to the user.Also available as an external (from Node-RED) command. In that case,
msg.payloadis used as the content of the overlay unlessoptions.contentis specified. Controlling options can be passed in themsg._uib.optionsproperty -
Updated the client library type description files. They are available in the
typesfolder of theblanktemplate. There is atsconfig.jsonfile in the root of that template that includes the type definitions. This means that you can now get better code completion, descriptions and type checking when using the client library in your own code. Feel free to copy the file and the folder to your own projects.[!WARNING]
The type definitions are not automatically...
Bug Fix
Bug fix for Issue #557 - Building ui.js with ESBUILD was causing the require to fail in the uib-html node. Needed to adjust the code from require('./libs/ui.js') to require('./libs/ui.js').default.
Bug fixes and improvements to showDialog
Code commits since last release.
- Dependabot updates to dependencies.
- Merge PR #553 from mutec: Fixes an issue with the glob function in
libs/fs.cjs. Only impacts Windows users. - Fix issue #546. Issues with the client ui library's showDialog function.
- Update the ui showDialog function - improving layout and updating the CSS styles in the
uib-brand.cssfile.
Some fixes and minor new features
v7.4.1
Code commits since last release.
📌 Highlights
uibuilder client library
-
New variable
uibuilder.get('currentTransport')Will either be
websocketorpolling. This is set when the connection is established and may change if the connection is lost and re-established. Should generally bewebsocketafter a few ms. If still set topolling, then either there are network issues or there is a poorly configured proxy server in the way. If you are using a proxy server, it should be configured to allow WebSocket connections. Even withpolling, the connection should still work but it will be slower and less efficient.A console error message will be logged if the transport is not
websocketafter a few seconds. -
When using the custom HTML attribute
uib-topic:msg.datasetis now processed along withmsg.attributesandmsg.payload.msg.datasetmust be an object, each key becomes adata-*attribute on the element.
uib-cache node
- FIXED Setting the "# messages" to zero should have retained unlimited messages for each "Cache by" property. It wasn't working correctly. Now fixed. Many thanks to Manjunath Satyamurthy in the Node-RED Forum for reporting this issue.
uib-brand.css front-end styles
- Amended
.status-gridclass to use 3 variables:--status-grid-min,--status-grid-max, and--status-grid-gap. This allows the grid to be more flexible and responsive. The default values have not changed but you can now override them in your own CSS.
Documentation
- Creating UIs:
- Grid Layouts - Now a more complete article on how to create responsive, content-heavy grid layouts.
- CSS Best Practice - Some simple guidelines and good practices for creating flexible layouts using CSS.
- Charts - A new article on how to create charts using the uibuilder client library. This is a work in progress and will be updated as more information becomes available.
- Form Handling - A new article on how to handle user input using forms and other input elements. This is a work in progress and will be updated as more information becomes available.
- Creating Web Apps - How to create data-driven web applications using UIBUILDER. Article updated.
- Several other articles are still awaiting content. Lists, Maps, Tables, Dashboard Layouts, Cards, Articles.
Node-RED Admin endpoints
<nrAdminURL>/uibuilder/uibindex?type=diagnosticsis a new variation on theuibindexendpoint. It returns diagnostics information in JSON format that shows uibuilder detailed diagnostic information. You must have an active Node-RED Editor session to be able to access this endpoint.
Warning
Please take care with the use of this endpoint as it contains sensitive information about your uibuilder instances.
Server library: admin-api-v2.js
- FIX
/uibindexroute incorrectly assumed the presence ofreq.headers.referer. - NEW
/uibindex?type=diagnosticsadded. Returns diagnostics information in JSON format that shows uibuilder detailed diagnostic information. You must have an active Node-RED Editor session to be able to access this endpoint. - Switched from passing the uib master variable to use the
uibGlobalConfigmodule. This is a step towards a more modular codebase.
Devlopment processes
- Rebuilt the gump build process for the front end client library. Now simplified and more robust.
Bug fix
Bug fix only. Missing originator on messages from clients.
Bug fix
Bug fix only. Issue for new UIBUILDER installations that would get the error [node-red-contrib-uibuilder/uibuilder] TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Array (line:393).
Bug Fix: nanoId
v7.0.2 Fix bug in uiblib nanoId. Bump to v7.0.2
Bug fix
New hooks feature was failing if not present in settings.js.
MAJOR RELEASE - now node.js 18+
This major upgrade of UIBUILDER has been some 9 months in preparation. 325 commits, 244 files changed. UIBUILDER is now some 12,598 total lines of code (22,400 including comments).
You should read through the potentially breaking changes. They are very unlikely to really impact anyone but it is hard to know for sure. As always, it is best to test before going into production.
The last major release, v6, really felt like a big maturity step for UIBUILDER (which is now around 10 years old) and this v7 release really builds on that. Focus has very much been on UIBUILDER as a mature tool for anyone using Node-RED to build data-driven web apps. It retains all of its flexibility but continues to make working with HTML/CSS and occasional JavaScript a breeze.
I really hope you find some amazing things in this release. If you do, please let me know in the Node-RED forum. And if you don't, let me know as well!
There is much more to come from UIBUILDER. Check out the roadmap in the docs, this shows you the vast number of ideas and improvements that I have in mind for the future. But, as always, I'm open to suggestions so please do reach out.
Regards, Julian.
⚠️ Potentially Breaking Changes
Note that potentially breaking changes are only introduced in major version releases such as this one. It has been a couple of years now since the last, v6, major version.
Most of these changes will not impact most people but you should check through them just in case.
-
If using UIBUILDER's custom ExpressJS server feature (instead of the Node-RED built-in one), URL's are now case sensitive
This brings them into line not only with W3C guidance but also with the Socket.IO library. It can be turned off in
settings.jsusing propertyuibuilder.serverOptions['case sensitive routing']set to false.Note that when using Node-RED's internal ExpressJS web engine (the default), URLs are still case-insensitive because that's how core Node-RED has been configured.
-
Minimum node.js now v18 - in line with the release of Node-RED v4, the minimum node.js version has moved from v14 to v18.
If you need to update your own servers, please remember to do an
npm rebuildof all node.js packages afterwards. -
Rewrite of the
uibuilder.eventSend(event)function in the client library.This might have an impact only if you were relying on some of the auto-naming features of form elements since the formula for that has been significantly improved.
That function has been extensively re-written and should provide significantly better results now.
-
Removal of the uibuilderfe library
If you are still using this old library in your HTML code, please move to the module based library as it is far more feature rich and has many bugs removed.
-
Removal of the
uib-listnodeThe
uib-elementnode does everything that it did and more. -
Moved socket.io-client from dependencies to dev-dependencies
If using the module based client library, you should not be loading the Socket.IO client yourself since it is already built into the client library. If you are still using the old
uibuilderfeclient, you should replace that and remove the socket.io client library from your html files. -
Removed the css auto-load from the client library
This automatically loads the
uib-brand.cssif no css is provided at all. Since all of the standard templates include some CSS and have for a long time, this should not impact anyone.At least 1 person hit a race condition. ref. So this is best removed.
-
jsdom(using in theuib-htmlnode) now tracks the latest releases againShouldn't be breaking at all but you might still want to review things since the new versions of
jsdomare likely to have better available features. We were restricted to jsdom v21 previously as newer versions required node.js v18+. -
ejspackage removedThis should not impact anyone.
ejsis an ExpressJS server-side templating library and what instructions exist (minimal) say that you need to install it manually. A new How-to: Server-side Rendered Views has been created to help understand how to use server-side templating. It is far from complete however. -
Removed Pollyfills from uibuilder editor code - shouldn't impact anyone using a browser from the last 5 years or so.
-
A
uibuildernode cannot be given a URL name ofcommonas this would clash with the built-in folder of the same name that holds resources that can be shared with all instances. This was an oversight in previous releases I'm afraid, now fixed. -
The
uibuildernode, no longer has the "Show web view of source files (deploy before you can use it)" option. The supporting external library was also removed. It never looked that good anyway. Please use the newuib-file-listnode to produce a custom folder/file list and send to your own custom page. -
Not really a breaking change but worth noting - if you use the Svelte template, that has been updated to use the latest versions of Svelte and Rollup. Those are both at least 2 major versions newer. In doing so, I had to replace a dev dependency and make changes to the config and npm scripts.
📌 Highlights
-
Some tweaks to the documentation should make it a little easier to get started with. The menu and UX has also been tweeked. There are new pages covering easy UI updates, common design patterns, creating well-structured HTML pages, and troubleshooting.
-
The new node
uib-file-listwill produce a list of files from a uibuilder instance. It automatically adjusts to the currently served sub-folder and allows filtering. Use this for producing indexes and menus. -
Markdown improvements.
Both the main uibuilder node (via the
ui.jslibrary) and theuibrouterlibrary both accept markdown content (via the external Markdown-IT library) and now they both support Markdown-IT plugins so that you can add features such as checkbox lists, GitHub style callouts, Mermaid diagrams and much more.There is also a new documentation page dedicated to using Markdown.
And, the no-code example flow has been extended to demonstrate how to dynamically load all of the libraries, plugins and even how to set up responses back to Node-RED - for example when a checkbox is clicked.
-
Wherever you can use no-/low-code features that accept HTML, you can now include
<script>tags that will be executed on load. -
Handling of forms and inputs continue to improve.
- Programmatic changes to input values or checked properties now trigger both the
inputandchangedevents - something that HTML normally doesn't do but can be important for data-driven web apps. For example, if using an<output>tag to show a combined or calculated input, changes via Node-RED will still update the values. - When using the
eventSend(event)function on inputs whether inside or outside of a form, the returned values have been improved, especially for checkboxes and radio buttons.
- Programmatic changes to input values or checked properties now trigger both the
-
File uploads from client browser to Node-RED are now enabled.
When using a form on a page and using
<input type="file">, if a file is selected by the client and the file is less than the size of the maximum message size, the file will be automatically uploaded to Node-RED when the form is submitted (assuming you useuibuilder.eventSend(event)to submit the form). The upload is a message with file details and the file itself as a buffer inmsg.payload. -
Security of the UIBUILDER repository on GitHub has been improved.
-
On the
uibuildernode's "Core" tab, the info buttons bar has changed slightly.The "Docs" button has gone (it is still on the top of panel bar anyway) and been replaced by a new "Apps" button which shows a page listing ALL uibuilder node instances along with their descriptions where provided.
Most of the UIBUILDER nodes have be given a bit of a refresh of their Editor configuration panels. This work is ongoing but should give a more consistent look and feel and make the panels rather more responsive. The layouts are starting to use more modern CSS features. The work isn't complete yet so there are still a few inconsistencies - for example, when you make the panel wider - but we are getting there.
-
UIBUILDER now has its own "hooks" feature. For now, these can be used for allowing/blocking or debugging messages. More hooks may be added.
By adding
uibuilder.hooks(...)to Node-RED'ssettings.jsand adding either of the functionsmsgReceivedormsgSending, those functions will run when msgs are received from the client or about to be sent to the client respectively. Both functions need a return value of eithertrueorfalse.trueallows the msg through,falseblocks the msg. You can also use the functions to alter the msg and, of course, to report on it to the Node-RED log. The functions receivemsgandnodeas the arguments. So you can filter on the node's URL, socket id, client id, page name, etc.As well as debugging or msg altering, you can use these to help with message filtering, especially useful as part of authentication and authorisation processes. And somewhat simpler to use than Socket.IO middleware (which is still available).
-
Connection headers have been added to the client details that are shown on control messages and on standard messages if the uibuilder "Include msg._uib in standard msg output." advanced flag is turned on. These may be particularly useful if using 3rd-party identity (authentication and authorisation) tooling which may put validated data into custom headings. Note however that these are "connection" headers, ongoing communications between the clients and the server do not update the headers (not possibl...
Important Bug Fix Release
Please update to this release as soon as possible, especially if using the new uibrouter or the uib-save node.
uibrouter library
- FIXED Default route was always being set on load. Now correctly takes the current URL hash into account first.
- FIXED Routes loaded via script, if pre-selected on page load (e.g. in URL hash), were crashing. Now will automatically revert to the default route and just print an error to the console.
- FIXED On start, hash change event could be fired twice. Now does the initial route before setting up the hash change listener.
uib-save node
- FIXED After import/paste, impossible to set a selected uibuilder node reference. Due to a timing issue in how Node-RED reports on nodes added to the flows on Editor page load. Now pre-populate the list of in-editor uibuilder nodes with deployed uibuilder nodes.
- FIXED Correctly change saved URL if a uibuilder node changes it. In this case, the save node knows the id of its linked uibuilder node but not the name so we change the name and mark the save node as needing re-deployment.
- FIXED In the Editor, the list of available uibuilder nodes to choose from was not sorted. Now sorted for ease of access.
- FIXED After a paste/import, when the url changes, reset the
addTypeflag to stop chkUrl re-blanking it by addingif (node.addType === 'paste/import') node.addType = 'load'(inoneditchange)
ti-common.js Editor support library
- IMPROVED Due to a timing issue in how Node-RED reports on nodes added to the flows on Editor page load, the in-editor list of uibuilder node was not built soon enough for use. Now pre-populates the list of in-editor uibuilder nodes with deployed uibuilder nodes. (Only if the in-editor list has zero entries).