100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
or-dashboard-builder small bugfixes/enhancements (#864)
Martin Peeters51511a79ff9d
diff --git a/ui/component/or-dashboard-builder/src/or-dashboard-preview.ts b/ui/component/or-dashboard-builder/src/or-dashboard-preview.tsindex 07034664e..cff87e1bc 100644--- a/ui/component/or-dashboard-builder/src/or-dashboard-preview.ts+++ b/ui/component/or-dashboard-builder/src/or-dashboard-preview.ts@@ -77,12 +77,12 @@ const editorStyling = css`.grid-stack-item-content {background: white;box-sizing: border-box;- border: 1px solid ${unsafeCSS(DefaultColor5)};+ border: 1px solid var(--or-app-color5, ${unsafeCSS(DefaultColor5)});border-radius: 4px;overflow: hidden !important;}.grid-stack-item-content__active {- border: 2px solid ${unsafeCSS(DefaultColor4)};+ border: 2px solid var(--or-app-color4, ${unsafeCSS(DefaultColor4)});margin: -1px !important; /* to compromise with the extra pixel of border. */}diff --git a/ui/component/or-dashboard-builder/src/or-dashboard-settingspanel.ts b/ui/component/or-dashboard-builder/src/or-dashboard-settingspanel.tsindex 5255557d8..9fb9defd3 100644--- a/ui/component/or-dashboard-builder/src/or-dashboard-settingspanel.ts+++ b/ui/component/or-dashboard-builder/src/or-dashboard-settingspanel.ts@@ -67,8 +67,8 @@ export const widgetSettingsStyling = css`.button-clear {background: none;visibility: hidden;- color: ${unsafeCSS(DefaultColor5)};- --or-icon-fill: ${unsafeCSS(DefaultColor5)};+ color: var(--or-app-color5, ${unsafeCSS(DefaultColor5)});+ --or-icon-fill: var(--or-app-color5, ${unsafeCSS(DefaultColor5)});display: inline-block;border: none;padding: 0;diff --git a/ui/component/or-dashboard-builder/src/or-dashboard-widgetsettings.ts b/ui/component/or-dashboard-builder/src/or-dashboard-widgetsettings.tsindex dfd7d04dc..c4b398172 100644--- a/ui/component/or-dashboard-builder/src/or-dashboard-widgetsettings.ts+++ b/ui/component/or-dashboard-builder/src/or-dashboard-widgetsettings.ts@@ -63,8 +63,8 @@ const widgetSettingsStyling = css`.button-clear {background: none;visibility: hidden;- color: ${unsafeCSS(DefaultColor5)};- --or-icon-fill: ${unsafeCSS(DefaultColor5)};+ color: var(--or-app-color5, ${unsafeCSS(DefaultColor5)});+ --or-icon-fill: var(--or-app-color5, ${unsafeCSS(DefaultColor5)});display: inline-block;border: none;padding: 0;diff --git a/ui/component/or-dashboard-builder/src/style.ts b/ui/component/or-dashboard-builder/src/style.tsindex 0db76d66b..f2fb9f4ca 100644--- a/ui/component/or-dashboard-builder/src/style.ts+++ b/ui/component/or-dashboard-builder/src/style.ts@@ -53,7 +53,7 @@ export const style = css`align-items: center;width: 100%;height: var(--internal-or-asset-tree-header-height);- border-bottom: 1px solid ${unsafeCSS(DefaultColor5)};+ border-bottom: 1px solid var(--or-app-color5, ${unsafeCSS(DefaultColor5)});z-index: 3;line-height: var(--internal-or-asset-tree-header-height);color: var(--internal-or-asset-tree-header-text-color);@@ -80,7 +80,7 @@ export const style = css`align-items: center;padding: 12px;background: none;- border-top: 1px solid ${unsafeCSS(DefaultColor5)};+ border-top: 1px solid var(--or-app-color5, ${unsafeCSS(DefaultColor5)});border-right: none;border-bottom: none;border-left: none;diff --git a/ui/component/or-dashboard-builder/src/widgets/or-gauge-widget.ts b/ui/component/or-dashboard-builder/src/widgets/or-gauge-widget.tsindex 48c973aac..0b9a70973 100644--- a/ui/component/or-dashboard-builder/src/widgets/or-gauge-widget.ts+++ b/ui/component/or-dashboard-builder/src/widgets/or-gauge-widget.ts@@ -15,7 +15,7 @@ export interface GaugeWidgetConfig extends OrWidgetConfig {displayName: string;attributeRefs: AttributeRef[];thresholds: [number, string][];- deltaFormat: "absolute" | "percentage";+ decimals: number;min: number,max: number}@@ -33,7 +33,7 @@ export class OrGaugeWidget implements OrWidgetEntity {displayName: widget.displayName,attributeRefs: [],thresholds: [[0, "#4caf50"],[75, "#ff9800"],[90, "#ef5350"]], // colors from https://mui.com/material-ui/customization/palette/ as reference (since material has no official colors)- deltaFormat: "absolute",+ decimals: 0,min: 0,max: 100} as GaugeWidgetConfig;@@ -72,7 +72,7 @@ export class OrGaugeWidgetContent extends LitElement {${when(this.assets && this.assetAttributes && this.assets.length > 0 && this.assetAttributes.length > 0, () => {return html`<or-gauge .asset="${this.assets[0]}" .assetAttribute="${this.assetAttributes[0]}" .thresholds="${this.widget?.widgetConfig.thresholds}"- .min="${this.widget?.widgetConfig.min}" .max="${this.widget?.widgetConfig.max}"+ .decimals="${this.widget?.widgetConfig.decimals}" .min="${this.widget?.widgetConfig.min}" .max="${this.widget?.widgetConfig.max}"style="height: 100%;"></or-gauge>`;}, () => {@@ -180,6 +180,14 @@ export class OrGaugeWidgetSettings extends LitElement {}}"></or-mwc-input></div>+ <div>+ <or-mwc-input .type="${InputType.NUMBER}" style="width: 100%;" .value="${config.decimals}" label="${i18next.t('decimals')}"+ @or-mwc-input-changed="${(event: CustomEvent) => {+ config.decimals = event.detail.value;+ this.updateConfig(this.widget!, config);+ }}"+ ></or-mwc-input>+ </div></div>` : null}</div>diff --git a/ui/component/or-gauge/src/index.ts b/ui/component/or-gauge/src/index.tsindex f77782278..460a760f6 100644--- a/ui/component/or-gauge/src/index.ts+++ b/ui/component/or-gauge/src/index.ts@@ -96,6 +96,9 @@ export class OrGauge extends LitElement {@property()public value?: number;+ @property()+ public decimals: number = 0;+@property()public unit?: string;@@ -226,6 +229,7 @@ export class OrGauge extends LitElement {}render() {+ const formattedVal = (this.value ? +this.value.toFixed(this.decimals) : NaN); // + operator prevents str returnreturn html`<div style="position: relative; height: 100%; width: 100%;"><div class="chart-wrapper" style="display: ${this.loading ? 'none' : 'flex'}; flex-direction: column; justify-content: center; height: 100%;">@@ -235,7 +239,7 @@ export class OrGauge extends LitElement {<div><div class="mainvalue-wrapper"><span class="main-number-icon">${this.asset ? getAssetDescriptorIconTemplate(AssetModelUtil.getAssetDescriptor(this.asset.type)) : ""}</span>- <span class="main-number ${this.mainValueSize}">${this.value ? this.value : NaN}</span>+ <span class="main-number ${this.mainValueSize}">${formattedVal}</span><span class="main-number-unit ${this.mainValueSize}">${this.unit ? this.unit : ""}</span></div></div>diff --git a/ui/component/or-mwc-components/src/or-mwc-tabs.ts b/ui/component/or-mwc-components/src/or-mwc-tabs.tsindex 3705575c1..bf317981e 100644--- a/ui/component/or-mwc-components/src/or-mwc-tabs.ts+++ b/ui/component/or-mwc-components/src/or-mwc-tabs.ts@@ -19,16 +19,16 @@ export interface OrMwcTabItem {//language=cssconst tabStyling = css`.mdc-tab {- background: ${unsafeCSS(DefaultColor4)};+ background: var(--or-app-color4, ${unsafeCSS(DefaultColor4)});}.mdc-tab .mdc-tab__text-label {- color: ${unsafeCSS(DefaultColor8)};+ color: var(--or-app-color8, ${unsafeCSS(DefaultColor8)});}.mdc-tab .mdc-tab__icon {- color: ${unsafeCSS(DefaultColor8)};+ color: var(--or-app-color8, ${unsafeCSS(DefaultColor8)})}.mdc-tab-indicator .mdc-tab-indicator__content--underline {- border-color: ${unsafeCSS(DefaultColor8)};+ border-color: var(--or-app-color8, ${unsafeCSS(DefaultColor8)})}.mdc-tab__ripple::before, .mdc-tab__ripple::after {background-color: var(--ripplecolor, ${unsafeCSS(DefaultColor8)});