Skip to content

Releases: TotallyInformation/node-red-contrib-uibuilder

Feature release: Scripts tab, custom server public folder, bug fixes and more

24 Sep 17:09
v7.5.0
aadca78

Choose a tag to compare

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 showOverlay allows 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 uibuilder node 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>/.public folder. 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 an index.html file 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-basic An 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, and install scripts 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 use innerHTML.

  • 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-color to use the --primary variable rather than the --brand variable. accent-color is 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-panel styles. 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 a cancel() method
    • cancelChange(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 the myvar.value = 42 syntax to change the value. If you use myvar = 42, then the reactive variable will overwritten. The value property will also let you change a primative even if it has been created with const.

  • NEW showOverlay function. 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.payload is used as the content of the overlay unless options.content is specified. Controlling options can be passed in the msg._uib.options property

  • Updated the client library type description files. They are available in the types folder of the blank template. There is a tsconfig.json file 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...

Read more

Bug Fix

22 Jul 14:19

Choose a tag to compare

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

10 Jul 10:30

Choose a tag to compare

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.css file.

Some fixes and minor new features

13 Jun 16:23

Choose a tag to compare

v7.4.1

Code commits since last release.

📌 Highlights

uibuilder client library

  • New variable uibuilder.get('currentTransport')

    Will either be websocket or polling. This is set when the connection is established and may change if the connection is lost and re-established. Should generally be websocket after a few ms. If still set to polling, 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 with polling, 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 websocket after a few seconds.

  • When using the custom HTML attribute uib-topic: msg.dataset is now processed along with msg.attributes and msg.payload. msg.dataset must be an object, each key becomes a data-* 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-grid class 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=diagnostics is a new variation on the uibindex endpoint. 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 /uibindex route incorrectly assumed the presence of req.headers.referer.
  • NEW /uibindex?type=diagnostics added. 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 uibGlobalConfig module. 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

06 Sep 13:02

Choose a tag to compare

Bug fix only. Missing originator on messages from clients.

Bug fix

02 Sep 16:06

Choose a tag to compare

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

01 Sep 17:02

Choose a tag to compare

v7.0.2

Fix bug in uiblib nanoId. Bump to v7.0.2

Bug fix

01 Sep 15:54

Choose a tag to compare

New hooks feature was failing if not present in settings.js.

MAJOR RELEASE - now node.js 18+

01 Sep 15:31
657390b

Choose a tag to compare

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.js using property uibuilder.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 rebuild of 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-list node

    The uib-element node 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 uibuilderfe client, 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.css if 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 the uib-html node) now tracks the latest releases again

    Shouldn't be breaking at all but you might still want to review things since the new versions of jsdom are likely to have better available features. We were restricted to jsdom v21 previously as newer versions required node.js v18+.

  • ejs package removed

    This should not impact anyone. ejs is 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 uibuilder node cannot be given a URL name of common as 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 uibuilder node, 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 new uib-file-list node 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-list will 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.js library) and the uibrouter library 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 input and changed events - 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.
  • 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 use uibuilder.eventSend(event) to submit the form). The upload is a message with file details and the file itself as a buffer in msg.payload.

  • Security of the UIBUILDER repository on GitHub has been improved.

  • On the uibuilder node'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's settings.js and adding either of the functions msgReceived or msgSending, 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 either true or false. true allows the msg through, false blocks 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 receive msg and node as 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...

Read more

Important Bug Fix Release

04 Jan 11:13

Choose a tag to compare

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 addType flag to stop chkUrl re-blanking it by adding if (node.addType === 'paste/import') node.addType = 'load' (in oneditchange)

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).