From 97cb8b4432ed20503232bd02045728d903f859ed Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Sun, 3 Apr 2022 02:53:41 +0100 Subject: [PATCH] UIGauge: Add error message when things go pear shaped We really need to fix the width of these panels though, the width (and hence height) is all wrong --- src/static/js/ui/UIGauge.mjs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/static/js/ui/UIGauge.mjs b/src/static/js/ui/UIGauge.mjs index e3d3505..6fb3e50 100644 --- a/src/static/js/ui/UIGauge.mjs +++ b/src/static/js/ui/UIGauge.mjs @@ -1,6 +1,7 @@ "use strict"; import Emel from 'emel'; +import forkawesome_emel from './forkawesome_emel.mjs'; import ApexCharts from 'apexcharts'; import AbstractUIItem from './AbstractUIItem.mjs'; @@ -98,6 +99,9 @@ class UIGauge extends AbstractUIItem { break; default: console.warn(`Warning: Unknown UIGauge content type '${typeof this.def.content}' for def with name '${this.def.name}'.`); + this.el.querySelector(".container-gauge").replaceChildren( + this.emel(`div[class="message-error"]>${forkawesome_emel("exclamation-circle")}+{Oops! An error occurred while rendering this chart. Check the developer tools for more information.}`) + ) return false; }