Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

Gauge min/max are correctly set when 0, show role name on roles page (#1009)

DonWillemsd640ab636141
diff --git a/ui/app/manager/src/pages/page-roles.ts b/ui/app/manager/src/pages/page-roles.ts
index 0b19a3ab9..3fd9d6b25 100644
--- a/ui/app/manager/src/pages/page-roles.ts
+++ b/ui/app/manager/src/pages/page-roles.ts
@@ -381,14 +381,14 @@ export class PageRoles extends Page<AppStateKeyed> {
<div class="column">
<strong class="column-title">${i18next.t("readPermissions")}</strong> ${readRoles.map(r => {
return html`
- <or-mwc-input ?readonly="${readonly}" .label="${r.description}" .type="${InputType.CHECKBOX}" .value="${role.compositeRoleIds && role.compositeRoleIds.find(id => id === r.id)}" @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.addRemoveRole(e, r, index)}"></or-mwc-input>
+ <or-mwc-input ?readonly="${readonly}" .label="${r.name.split(":")[1]}: ${r.description}" .type="${InputType.CHECKBOX}" .value="${role.compositeRoleIds && role.compositeRoleIds.find(id => id === r.id)}" @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.addRemoveRole(e, r, index)}"></or-mwc-input>
` })}
</div>
<div class="column">
<strong class="column-title">${i18next.t("writePermissions")}</strong> ${writeRoles.map(r => {
return html`
- <or-mwc-input ?readonly="${readonly}" .label="${r.description}" .type="${InputType.CHECKBOX}" .value="${role.compositeRoleIds && role.compositeRoleIds.find(id => id === r.id)}" @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.addRemoveRole(e, r, index)}"></or-mwc-input>
+ <or-mwc-input ?readonly="${readonly}" .label="${r.name.split(":")[1]}: ${r.description}" .type="${InputType.CHECKBOX}" .value="${role.compositeRoleIds && role.compositeRoleIds.find(id => id === r.id)}" @or-mwc-input-changed="${(e: OrInputChangedEvent) => this.addRemoveRole(e, r, index)}"></or-mwc-input>
` })}
</div>
</div>
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.ts
index 11388cdfd..3a2f37020 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
@@ -190,7 +190,7 @@ 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 type="${InputType.NUMBER}" style="width: 100%;" .value="${config.decimals}" label="${i18next.t('decimals')}" .min="${0}"
@or-mwc-input-changed="${(event: CustomEvent) => {
config.decimals = event.detail.value;
this.updateConfig(this.widget!, config);
diff --git a/ui/component/or-gauge/src/index.ts b/ui/component/or-gauge/src/index.ts
index b59cb546f..81d0c755c 100644
--- a/ui/component/or-gauge/src/index.ts
+++ b/ui/component/or-gauge/src/index.ts
@@ -168,13 +168,13 @@ export class OrGauge extends LitElement {
}
// Render gauge again if..
- if(changedProperties.has('min') && this.min) {
- this.gauge?.setMinValue(this.min);
- this.gauge?.set(this.value != null ? this.value : NaN);
+ if(changedProperties.has('min') && this.min != null && this.gauge) {
+ this.gauge.setMinValue(this.min);
+ this.gauge.set(this.value != null ? this.value : NaN);
}
- if(changedProperties.has('max') && this.max && this.gauge) {
+ if(changedProperties.has('max') && this.max != null && this.gauge) {
this.gauge.maxValue = this.max;
- this.gauge?.set(this.value != null ? this.value : NaN);
+ this.gauge.set(this.value != null ? this.value : NaN);
}
if(changedProperties.has('thresholds') && this.thresholds) {