Skip to content

armgit / core

Public Imported from GitHub
0

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

Several small (hot)fixes for reported issues (#1194)

Martin Peetersd07cc3005380
diff --git a/manager/src/web/shared/locales/en/or.json b/manager/src/web/shared/locales/en/or.json
index aa7625600..56488aa44 100644
--- a/manager/src/web/shared/locales/en/or.json
+++ b/manager/src/web/shared/locales/en/or.json
@@ -676,7 +676,10 @@
"configuration": {
"" : "Appearance",
"main": "Main",
- "realmStyling": "REALM STYLING",
+ "realmStyling": "Realm styling",
+ "managerConfigNotFound": "Manager configuration file could not be found.",
+ "mapSettingsNotFound": "Map configuration file could not be found.",
+ "tryAgain": "Try again",
"addRealmCustomization" : "Add Realm Style",
"realmTitle": "Manager app title",
"defaultLanguage": "Default language",
diff --git a/manager/src/web/shared/locales/nl/or.json b/manager/src/web/shared/locales/nl/or.json
index 79ce0512a..bb9935fa2 100644
--- a/manager/src/web/shared/locales/nl/or.json
+++ b/manager/src/web/shared/locales/nl/or.json
@@ -676,7 +676,10 @@
"configuration": {
"" : "Weergave",
"main": "Algemeen",
- "realmStyling": "REALM STIJL",
+ "realmStyling": "Realm stijl",
+ "managerConfigNotFound": "Kon bestand met manager configuratie niet vinden.",
+ "mapSettingsNotFound": "Kon bestand met kaart configuratie niet vinden.",
+ "tryAgain": "Probeer opnieuw",
"addRealmCustomization" : "Voeg realm stijl toe",
"realmTitle": "Manager app titel",
"defaultLanguage": "Standaard taal",
diff --git a/ui/app/insights/src/pages/page-view.ts b/ui/app/insights/src/pages/page-view.ts
index 1a09e6185..c881774ac 100644
--- a/ui/app/insights/src/pages/page-view.ts
+++ b/ui/app/insights/src/pages/page-view.ts
@@ -14,8 +14,6 @@ import {i18next} from "@openremote/or-translate";
import {style} from "../style";
import {isAxiosError} from "@openremote/rest";
import "../components/dashboard-menu";
-import "@openremote/or-chart";
-import "@openremote/or-attribute-card";
export function pageViewProvider(store: EnhancedStore<AppStateKeyed>, realmConfigs: {[p: string]: RealmAppConfig}): PageProvider<AppStateKeyed> {
return {
diff --git a/ui/app/manager/src/pages/page-assets.ts b/ui/app/manager/src/pages/page-assets.ts
index 0336f6227..ef561098a 100644
--- a/ui/app/manager/src/pages/page-assets.ts
+++ b/ui/app/manager/src/pages/page-assets.ts
@@ -149,7 +149,7 @@ export class PageAssets extends Page<AssetsStateKeyed> {
@property()
protected _editMode: boolean = false;
- @property()
+ @property() // selected asset ids
protected _assetIds?: string[];
@state()
@@ -201,8 +201,15 @@ export class PageAssets extends Page<AssetsStateKeyed> {
protected render(): TemplateResult | void {
return html`
- <or-asset-tree id="tree" .config="${this.config && this.config.tree ? this.config.tree : PAGE_ASSETS_CONFIG_DEFAULT.tree}" class="${this._assetIds && this._assetIds.length === 1 ? "hideMobile" : ""}" .selectedIds="${this._assetIds}" .expandedIds="${this._expandedIds}"></or-asset-tree>
- <or-asset-viewer id="viewer" .config="${this.config && this.config.viewer ? this.config.viewer : undefined}" class="${!this._assetIds || this._assetIds.length !== 1 ? "hideMobile" : ""}" .editMode="${this._editMode}"></or-asset-viewer>
+ <or-asset-tree id="tree" .config="${this.config && this.config.tree ? this.config.tree : PAGE_ASSETS_CONFIG_DEFAULT.tree}"
+ class="${this._assetIds && this._assetIds.length === 1 ? "hideMobile" : ""}"
+ .selectedIds="${this._assetIds}"
+ .expandedIds="${this._expandedIds}"
+ ></or-asset-tree>
+ <or-asset-viewer id="viewer" .config="${this.config && this.config.viewer ? this.config.viewer : undefined}"
+ class="${!this._assetIds || this._assetIds.length !== 1 ? "hideMobile" : ""}"
+ .editMode="${this._editMode}"
+ ></or-asset-viewer>
`;
}
@@ -211,7 +218,7 @@ export class PageAssets extends Page<AssetsStateKeyed> {
stateChanged(state: AppStateKeyed) {
this.getRealmState(state); // Order is important here!
this._editMode = !!(state.app.params && state.app.params.editMode === "true");
- if(!this._assetIds || (this._assetIds.length === 0 && this._assetIds[0] === state.app.params.id)) {
+ if(!this._assetIds || this._assetIds.length === 0) {
this._assetIds = state.app.params && state.app.params.id ? [state.app.params.id as string] : undefined;
}
}
diff --git a/ui/app/manager/src/pages/page-configuration.ts b/ui/app/manager/src/pages/page-configuration.ts
index c2b0956e5..90087dde2 100644
--- a/ui/app/manager/src/pages/page-configuration.ts
+++ b/ui/app/manager/src/pages/page-configuration.ts
@@ -34,6 +34,8 @@ import {i18next} from "@openremote/or-translate";
import "@openremote/or-components/or-loading-indicator";
import {OrConfRealmCard} from "../components/configuration/or-conf-realm/or-conf-realm-card";
import {OrConfPanel} from "../components/configuration/or-conf-panel";
+import {Input} from "@openremote/or-rules/lib/flow-viewer/services/input";
+import { InputType } from "@openremote/or-mwc-components/or-mwc-input";
declare const CONFIG_URL_PREFIX: string;
@@ -115,12 +117,18 @@ export class PageConfiguration extends Page<AppStateKeyed> {
}
or-icon {
- vertical-align: middle;
+ vertical-align: middle;
--or-icon-width: 20px;
--or-icon-height: 20px;
margin-right: 2px;
margin-left: -5px;
}
+
+ .notFound-container {
+ display: flex;
+ flex-direction: column;
+ gap: 24px;
+ }
@media screen and (max-width: 768px) {
or-panel {
@@ -178,18 +186,24 @@ export class PageConfiguration extends Page<AppStateKeyed> {
if(this.managerConfiguration === undefined) {
managerConfigPromise = this.getManagerConfig().then((value) => {
this.managerConfiguration = value;
+ }).catch(() => {
+ this.managerConfiguration = null;
});
}
let mapConfigPromise;
if(this.mapConfig === undefined) {
mapConfigPromise = this.getMapConfig().then((value) => {
this.mapConfig = value;
+ }).catch(() => {
+ this.mapConfig = null;
});
}
let realmsPromise;
if(this.realms === undefined) {
realmsPromise = this.getAccessibleRealms().then((value) => {
this.realms = value;
+ }).catch(() => {
+ this.realms = null;
});
}
@@ -216,16 +230,16 @@ export class PageConfiguration extends Page<AppStateKeyed> {
`, () => {
const realmHeading = html`
<div id="heading" style="justify-content: space-between;">
- <span style="margin: 0;">${i18next.t("configuration.realmStyling")}</span>
- <or-conf-json .managerConfig="${this.managerConfiguration}" class="hide-mobile"
- @saveLocalManagerConfig="${(ev: CustomEvent) => {
- this.managerConfiguration = ev.detail.value as ManagerAppConfig;
- this.managerConfigurationChanged = true;
- }}"
- ></or-conf-json>
+ <span style="margin: 0;">${i18next.t("configuration.realmStyling").toUpperCase()}</span>
+ <or-conf-json .managerConfig="${this.managerConfiguration}" class="hide-mobile"
+ @saveLocalManagerConfig="${(ev: CustomEvent) => {
+ this.managerConfiguration = ev.detail.value as ManagerAppConfig;
+ this.managerConfigurationChanged = true;
+ }}"
+ ></or-conf-json>
</div>
`;
- const realmOptions = this.realms?.map((r) => ({ name: r.name, displayName: r.displayName, canDelete: true }));
+ const realmOptions = this.realms?.map((r) => ({name: r.name, displayName: r.displayName, canDelete: true}));
realmOptions.push({name: 'default', displayName: 'Default', canDelete: false});
return html`
<div id="wrapper">
@@ -241,14 +255,36 @@ export class PageConfiguration extends Page<AppStateKeyed> {
</div>
</div>
<or-panel .heading="${realmHeading}">
- <or-conf-panel id="managerConfig-panel" .config="${this.managerConfiguration}" .realmOptions="${realmOptions}"
- @change="${() => { this.managerConfigurationChanged = true; }}"
- ></or-conf-panel>
+ ${when(this.managerConfiguration, () => html`
+ <or-conf-panel id="managerConfig-panel" .config="${this.managerConfiguration}" .realmOptions="${realmOptions}"
+ @change="${() => { this.managerConfigurationChanged = true; }}"
+ ></or-conf-panel>
+ `, () => html`
+ <div class="notFound-container">
+ <span>${i18next.t('configuration.managerConfigNotFound')}</span>
+ <or-mwc-input type="${InputType.BUTTON}" label="${i18next.t('configuration.tryAgain')}"
+ @or-mwc-input-changed="${() => this.getManagerConfig().then(val => {
+ this.managerConfiguration = val;
+ }).catch(e => console.error(e))}"
+ ></or-mwc-input>
+ </div>
+ `)}
</or-panel>
<or-panel .heading="${i18next.t("configuration.mapSettings").toUpperCase()}">
- <or-conf-panel id="mapConfig-panel" .config="${this.mapConfig}" .realmOptions="${realmOptions}"
- @change="${() => { this.mapConfigChanged = true; }}"
- ></or-conf-panel>
+ ${when(this.mapConfig, () => html`
+ <or-conf-panel id="mapConfig-panel" .config="${this.mapConfig}" .realmOptions="${realmOptions}"
+ @change="${() => { this.mapConfigChanged = true; }}"
+ ></or-conf-panel>
+ `, () => html`
+ <div class="notFound-container">
+ <span>${i18next.t('configuration.mapSettingsNotFound')}</span>
+ <or-mwc-input type="${InputType.BUTTON}" label="${i18next.t('configuration.tryAgain')}"
+ @or-mwc-input-changed="${() => this.getMapConfig().then(val => {
+ this.mapConfig = val;
+ }).catch(e => console.error(e))}"
+ ></or-mwc-input>
+ </div>
+ `)}
</or-panel>
</div>
`
diff --git a/ui/component/or-dashboard-builder/src/settings/gauge-settings.ts b/ui/component/or-dashboard-builder/src/settings/gauge-settings.ts
index 4a29787b0..9487871b9 100644
--- a/ui/component/or-dashboard-builder/src/settings/gauge-settings.ts
+++ b/ui/component/or-dashboard-builder/src/settings/gauge-settings.ts
@@ -4,7 +4,7 @@ import {WidgetSettings} from "../util/widget-settings";
import {i18next} from "@openremote/or-translate";
import {GaugeWidgetConfig} from "../widgets/gauge-widget";
import {AttributesSelectEvent} from "../panels/attributes-panel";
-import {Attribute, AttributeRef} from "@openremote/model";
+import {Attribute} from "@openremote/model";
import { InputType, OrInputChangedEvent } from "@openremote/or-mwc-components/or-mwc-input";
import {ThresholdChangeEvent} from "../panels/thresholds-panel";
import "../panels/thresholds-panel";
@@ -23,7 +23,7 @@ export class GaugeSettings extends WidgetSettings {
<div>
<!-- Attribute selection -->
<settings-panel displayName="${i18next.t('attributes')}" expanded="${true}">
- <attributes-panel .attributeRefs="${this.widgetConfig.attributeRefs}" onlyDataAttrs="${false}" .attributeFilter="${attributeFilter}" style="padding-bottom: 12px;"
+ <attributes-panel .attributeRefs="${this.widgetConfig.attributeRefs}" .attributeFilter="${attributeFilter}" style="padding-bottom: 12px;"
@attribute-select="${(ev: AttributesSelectEvent) => this.onAttributesSelect(ev)}"
></attributes-panel>
</settings-panel>
@@ -32,15 +32,15 @@ export class GaugeSettings extends WidgetSettings {
<settings-panel displayName="${i18next.t('values')}" expanded="${true}">
<div style="padding-bottom: 12px; display: flex; flex-direction: column; gap: 12px;">
<div style="display: flex; gap: 8px;">
- <or-mwc-input type="${InputType.NUMBER}" label="${i18next.t('min')}" .max="${this.widgetConfig.max}" .value="${this.widgetConfig.min}"
+ <or-mwc-input .type="${InputType.NUMBER}" label="${i18next.t('min')}" .max="${this.widgetConfig.max}" .value="${this.widgetConfig.min}"
@or-mwc-input-changed="${(ev: OrInputChangedEvent) => this.onMinMaxValueChange('min', ev)}"
></or-mwc-input>
- <or-mwc-input type="${InputType.NUMBER}" label="${i18next.t('max')}" .min="${this.widgetConfig.min}" .value="${this.widgetConfig.max}"
+ <or-mwc-input .type="${InputType.NUMBER}" label="${i18next.t('max')}" .min="${this.widgetConfig.min}" .value="${this.widgetConfig.max}"
@or-mwc-input-changed="${(ev: OrInputChangedEvent) => this.onMinMaxValueChange('max', ev)}"
></or-mwc-input>
</div>
<div>
- <or-mwc-input type="${InputType.NUMBER}" style="width: 100%;" .value="${this.widgetConfig.decimals}" label="${i18next.t('decimals')}" .min="${0}"
+ <or-mwc-input .type="${InputType.NUMBER}" style="width: 100%;" .value="${this.widgetConfig.decimals}" label="${i18next.t('decimals')}" .min="${0}"
@or-mwc-input-changed="${(ev: OrInputChangedEvent) => this.onDecimalsChange(ev)}"
></or-mwc-input>
</div>
diff --git a/ui/component/or-dashboard-builder/src/widgets/attribute-input-widget.ts b/ui/component/or-dashboard-builder/src/widgets/attribute-input-widget.ts
index cb24665ca..5afa7dde2 100644
--- a/ui/component/or-dashboard-builder/src/widgets/attribute-input-widget.ts
+++ b/ui/component/or-dashboard-builder/src/widgets/attribute-input-widget.ts
@@ -8,9 +8,9 @@ import { customElement, query, queryAll } from "lit/decorators.js";
import {AttributeInputSettings} from "../settings/attribute-input-settings";
import { when } from "lit/directives/when.js";
import {i18next} from "@openremote/or-translate";
-import {OrAttributeInput, OrAttributeInputChangedEvent} from "@openremote/or-attribute-input";
import {throttle} from "lodash";
import {Util} from "@openremote/core";
+import "@openremote/or-attribute-input";
export interface AttributeInputWidgetConfig extends WidgetConfig {
attributeRefs: AttributeRef[];
diff --git a/ui/component/or-dashboard-builder/src/widgets/chart-widget.ts b/ui/component/or-dashboard-builder/src/widgets/chart-widget.ts
index 595f289f7..906af1b8e 100644
--- a/ui/component/or-dashboard-builder/src/widgets/chart-widget.ts
+++ b/ui/component/or-dashboard-builder/src/widgets/chart-widget.ts
@@ -10,6 +10,7 @@ import {WidgetConfig} from "../util/widget-config";
import {OrWidget, WidgetManifest} from "../util/or-widget";
import {ChartSettings} from "../settings/chart-settings";
import {WidgetSettings} from "../util/widget-settings";
+import "@openremote/or-chart";
export interface ChartWidgetConfig extends WidgetConfig {
attributeRefs: AttributeRef[];
diff --git a/ui/component/or-dashboard-builder/src/widgets/kpi-widget.ts b/ui/component/or-dashboard-builder/src/widgets/kpi-widget.ts
index 3907017ce..c3c5b4625 100644
--- a/ui/component/or-dashboard-builder/src/widgets/kpi-widget.ts
+++ b/ui/component/or-dashboard-builder/src/widgets/kpi-widget.ts
@@ -6,6 +6,7 @@ import {WidgetConfig} from "../util/widget-config";
import {Attribute, AttributeRef} from "@openremote/model";
import {html, TemplateResult } from "lit";
import {KpiSettings} from "../settings/kpi-settings";
+import "@openremote/or-attribute-card";
export interface KpiWidgetConfig extends WidgetConfig {
attributeRefs: AttributeRef[];
diff --git a/ui/component/or-dashboard-builder/src/widgets/table-widget.ts b/ui/component/or-dashboard-builder/src/widgets/table-widget.ts
index 5aaa11e74..585104d72 100644
--- a/ui/component/or-dashboard-builder/src/widgets/table-widget.ts
+++ b/ui/component/or-dashboard-builder/src/widgets/table-widget.ts
@@ -9,6 +9,7 @@ import {OrMwcTableRowClickEvent, TableColumn, TableRow, TableConfig} from "@open
import {i18next} from "@openremote/or-translate";
import {Util} from "@openremote/core";
import {Asset, AssetModelUtil} from "@openremote/model";
+import "@openremote/or-mwc-components/or-mwc-table";
export interface TableWidgetConfig extends WidgetConfig {
assetType?: string