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
UI updates: various bug fixes and enhancements
Rich Turneref1692fc362a
diff --git a/deployment/manager/shared/locales/en/or.json b/deployment/manager/shared/locales/en/or.jsonindex 95ac0a8b2..86a936435 100644--- a/deployment/manager/shared/locales/en/or.json+++ b/deployment/manager/shared/locales/en/or.json@@ -107,5 +107,7 @@"history": "History","attributes": "Attributes","info": "Info",- "notSupported": "Not supported"+ "notSupported": "Not supported",+ "area": "Area",+ "timestamp": "Timestamp"}diff --git a/model/src/main/java/org/openremote/model/asset/AssetType.java b/model/src/main/java/org/openremote/model/asset/AssetType.javaindex e8c5ec081..021f9f0c3 100644--- a/model/src/main/java/org/openremote/model/asset/AssetType.java+++ b/model/src/main/java/org/openremote/model/asset/AssetType.java@@ -124,7 +124,7 @@ public enum AssetType implements AssetDescriptor {@Overridepublic String getColor() {- return null;+ return color;}@Overridediff --git a/ui/component/or-asset-viewer/src/style.ts b/ui/component/or-asset-viewer/src/style.tsindex c7c6c3397..01b04160d 100644--- a/ui/component/or-asset-viewer/src/style.ts+++ b/ui/component/or-asset-viewer/src/style.ts@@ -103,6 +103,7 @@ export const style = css`background-color: var(--internal-or-asset-viewer-panel-color);border: 1px solid #e5e5e5;border-radius: 5px;+ max-width: 100%;}.panel-content-wrapper {@@ -113,6 +114,10 @@ export const style = css`height: 100%;}+ #history-panel .panel-content {+ position: relative;+ }+.panel-content {display: flex;flex-wrap: wrap;@@ -193,7 +198,7 @@ export const style = css`}#container {- grid-template-columns: 1fr!important;+ grid-template-columns: 100% !important;padding: 20px 0;}diff --git a/ui/component/or-attribute-history/src/index.ts b/ui/component/or-attribute-history/src/index.tsindex 172dbfd6b..d01f18986 100644--- a/ui/component/or-attribute-history/src/index.ts+++ b/ui/component/or-attribute-history/src/index.ts@@ -153,23 +153,31 @@ const style = css`#controls {flex: 0;+ display: flex;+ flex-wrap: wrap;justify-content: space-between;- padding-bottom: 10px;margin: var(--internal-or-attribute-history-controls-margin);}+ #controls > * {+ margin: 0 auto 20px auto;+ }+#ending-controls {float: right;- padding-right: 10px;- display: table;+ max-width: 100%;+ display: flex;+ align-items: center;}#ending-controls > * {- display: table-cell;- vertical-align: middle;padding: 0 5px;}+ #ending-date {+ min-width: 0;+ }+#chart-container {position: relative;}@@ -299,7 +307,7 @@ export class OrAttributeHistory extends translate(i18next)(LitElement) {<or-input .type="${InputType.SELECT}" ?disabled="${disabled}" .label="${i18next.t("period")}" @or-input-changed="${(evt: OrInputChangedEvent) => this.interval = evt.detail.value}" .value="${this.interval}" .options="${this._getIntervalOptions()}"></or-input><div id="ending-controls"><or-input class="button" .type="${InputType.BUTTON}" ?disabled="${disabled}" icon="chevron-left" @click="${() => this._updateTimestamp(this.timestamp!, false)}"></or-input>- <or-input .type="${InputType.DATETIME}" ?disabled="${disabled}" label="${i18next.t("ending")}" .value="${this.timestamp}" @or-input-changed="${(evt: OrInputChangedEvent) => this._updateTimestamp(moment(evt.detail.value as string).toDate())}"></or-input>+ <or-input id="ending-date" .type="${InputType.DATETIME}" ?disabled="${disabled}" label="${i18next.t("ending")}" .value="${this.timestamp}" @or-input-changed="${(evt: OrInputChangedEvent) => this._updateTimestamp(moment(evt.detail.value as string).toDate())}"></or-input><or-input class="button" .type="${InputType.BUTTON}" ?disabled="${disabled}" icon="chevron-right" @click="${() => this._updateTimestamp(this.timestamp!, true)}"></or-input></div></div>@@ -314,9 +322,9 @@ export class OrAttributeHistory extends translate(i18next)(LitElement) {<canvas id="chart"></canvas></div>` : html`- <or-panel id="table-container">+ <div id="table-container">${this._tableTemplate || ``}- </or-panel>+ </div>`}</div>`;@@ -325,7 +333,7 @@ export class OrAttributeHistory extends translate(i18next)(LitElement) {updated(changedProperties: PropertyValues) {super.updated(changedProperties);- if (!this._type) {+ if (!this._type || !this._data) {return;}@@ -422,8 +430,10 @@ export class OrAttributeHistory extends translate(i18next)(LitElement) {this._chart.update();}}- } else if (!this._tableTemplate) {- this._tableTemplate = this._getTableTemplate();+ } else {+ if (!this._tableTemplate || changedProperties.has("_data")) {+ this._tableTemplate = this._getTableTemplate();+ }}this.onCompleted().then(() => {@@ -437,6 +447,8 @@ export class OrAttributeHistory extends translate(i18next)(LitElement) {}protected _cleanup() {+ this._tableTemplate = undefined;+if (this._chart) {this._chart.destroy();this._chart = undefined;diff --git a/ui/component/or-input/src/index.ts b/ui/component/or-input/src/index.tsindex 5590dfee3..4589951d5 100644--- a/ui/component/or-input/src/index.ts+++ b/ui/component/or-input/src/index.ts@@ -101,6 +101,10 @@ const style = css`#wrapper > label {margin-left: 10px;}++ #component {+ max-width: 100%;+ }.or-input--rounded {border-radius: 50% !important;diff --git a/ui/component/or-rules/src/index.ts b/ui/component/or-rules/src/index.tsindex 3bc1ce759..069ae54e0 100644--- a/ui/component/or-rules/src/index.ts+++ b/ui/component/or-rules/src/index.ts@@ -122,8 +122,11 @@ export interface RulesConfig {export interface RulesDescriptorSection {includeAssets?: string[];excludeAssets?: string[];- assets?: { [assetType: string]: RulesConfigAsset };attributeDescriptors?: {[attributeName: string]: RulesConfigAttribute };+ /**+ * Asset type specific config; '*' key will be used as a default fallback if no asset type specific entry exists+ */+ assets?: { [assetType: string]: RulesConfigAsset };}export interface RulesConfigAsset {@@ -131,6 +134,7 @@ export interface RulesConfigAsset {excludeAttributes?: string[];name?: string;icon?: string;+ color?: string;attributeDescriptors?: {[attributeName: string]: RulesConfigAttribute };}@@ -167,7 +171,7 @@ export interface RuleView {config?: RulesConfig;}-function getAssetDescriptorFromSection(assetTpe: string, config: RulesConfig | undefined, useActionConfig: boolean) {+function getAssetDescriptorFromSection(assetType: string, config: RulesConfig | undefined, useActionConfig: boolean) {if (!config || !config.descriptors) {return;}@@ -175,12 +179,12 @@ function getAssetDescriptorFromSection(assetTpe: string, config: RulesConfig | uconst section = useActionConfig ? config.descriptors.action : config.descriptors.when;const allSection = config.descriptors.all;- const descriptor = section && section.assets ? section.assets[assetTpe] : undefined;+ const descriptor = section && section.assets ? section.assets[assetType] ? section.assets[assetType] : section.assets["*"] : undefined;if (descriptor) {return descriptor;}- return allSection && allSection.assets ? allSection.assets[assetTpe] : undefined;+ return allSection && allSection.assets ? allSection.assets[assetType] ? allSection.assets[assetType] : allSection.assets["*"] : undefined;}export function getDescriptorValueType(descriptor?: AttributeDescriptor) {@@ -253,6 +257,7 @@ export function getAssetDescriptors(config: RulesConfig | undefined, useActionConame: ad.name,type: ad.type,icon: ad.icon,+ color: ad.color,attributeDescriptors: ad.attributeDescriptors ? [...ad.attributeDescriptors] : undefined};@@ -262,6 +267,9 @@ export function getAssetDescriptors(config: RulesConfig | undefined, useActionCoif (configDescriptor.name) {modifiedDescriptor.name = configDescriptor.name;}+ if (configDescriptor.color) {+ modifiedDescriptor.color = configDescriptor.color;+ }// Remove any excluded attributesif (modifiedDescriptor.attributeDescriptors) {diff --git a/ui/component/or-rules/src/json-viewer/or-rule-asset-query.ts b/ui/component/or-rules/src/json-viewer/or-rule-asset-query.tsindex 708718ed1..677aa345a 100644--- a/ui/component/or-rules/src/json-viewer/or-rule-asset-query.ts+++ b/ui/component/or-rules/src/json-viewer/or-rule-asset-query.ts@@ -165,6 +165,7 @@ export class OrRuleAssetQuery extends translate(i18next)(LitElement) {if (asset) {attribute = attributeName ? Util.getAssetAttribute(asset, attributeName) : undefined;attributes = Util.getAssetAttributes(asset)+ .filter((attr) => Util.hasMetaItem(attr, MetaItemType.RULE_STATE.urn!)).map((attr) => {const attrDescriptor = AssetModelUtil.getAssetAttributeDescriptor(assetDescriptor, attr.name);return [attr.name!, Util.getAttributeLabel(attr, attrDescriptor)];@@ -466,7 +467,7 @@ export class OrRuleAssetQuery extends translate(i18next)(LitElement) {case "value-empty":return AssetQueryOperator.VALUE_EMPTY;case "value-not-empty":- return AssetQueryOperator.VALUE_NOT_EMPTY;+ return this.condition.reset ? AssetQueryOperator.VALUE_CHANGES : AssetQueryOperator.VALUE_NOT_EMPTY;}}@@ -743,7 +744,6 @@ export class OrRuleAssetQuery extends translate(i18next)(LitElement) {}],select: {- excludeAttributeMeta: true,excludeAttributeTimestamp: true,excludeAttributeValue: true,excludeParentInfo: true,