Skip to content

armgit / core

Public Imported from GitHub
0

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

Add logs to demo, fix realm change map

Robin Dekkers5e378966ed96
diff --git a/ui/app/main/src/components/my-app.ts b/ui/app/main/src/components/my-app.ts
index 6fa0d689c..0e72b24ce 100644
--- a/ui/app/main/src/components/my-app.ts
+++ b/ui/app/main/src/components/my-app.ts
@@ -9,6 +9,7 @@ import "../components/pages/page-map";
import "../components/pages/page-assets";
import "../components/pages/page-rules";
import "../components/pages/page-insights";
+import "../components/pages/page-logs";
import i18next from "i18next";
import {connect} from "pwa-helpers/connect-mixin";
@@ -87,6 +88,7 @@ class MyApp extends connect(store)(LitElement) {
${this.page === "assets" ? html`<page-assets class="page"></page-assets>` : ``}
${this.page === "rules" ? html`<page-rules class="page"></page-rules>` : ``}
${this.page === "insights" ? html`<page-insights class="page"></page-insights>` : ``}
+ ${this.page === "logs" ? html`<page-logs class="page"></page-logs>` : ``}
</main>
`;
}
diff --git a/ui/app/main/src/components/pages/page-logs.ts b/ui/app/main/src/components/pages/page-logs.ts
new file mode 100644
index 000000000..f8b0f479a
--- /dev/null
+++ b/ui/app/main/src/components/pages/page-logs.ts
@@ -0,0 +1,32 @@
+import {css, customElement, html, LitElement} from "lit-element";
+import {store} from "../../store";
+import {connect} from "pwa-helpers/connect-mixin";
+import "@openremote/or-log-viewer";
+import {ViewerConfig} from "@openremote/or-log-viewer";
+import {SyslogCategory} from "@openremote/model";
+
+@customElement("page-logs")
+class PageLogs extends connect(store)(LitElement) {
+
+ static get styles() {
+ return css`
+ :host {
+ flex: 1;
+ width: 100%;
+ }
+
+ or-log-viewer {
+ width: 100%;
+ }
+ `;
+ }
+
+ protected config: ViewerConfig = {
+ };
+
+ protected render() {
+ return html`
+ <or-log-viewer .config="${this.config}"></or-log-viewer>
+ `;
+ }
+}
diff --git a/ui/app/main/src/components/pages/page-rules.ts b/ui/app/main/src/components/pages/page-rules.ts
index 5f8b1a5b1..72725513b 100644
--- a/ui/app/main/src/components/pages/page-rules.ts
+++ b/ui/app/main/src/components/pages/page-rules.ts
@@ -16,16 +16,8 @@ const rulesConfig: RulesConfig = {
AssetType.CITY.type,
AssetType.AREA.type,
AssetType.FLOOR.type,
- AssetType.AGENT.type,
- AssetType.CONSOLE.type
- ],
- assets: {
- "*": {
- excludeAttributes: [
- AttributeType.LOCATION.attributeName
- ]
- }
- }
+ AssetType.AGENT.type
+ ]
}
},
json: {
diff --git a/ui/app/main/tsconfig.json b/ui/app/main/tsconfig.json
index a39c00bcb..47da40701 100644
--- a/ui/app/main/tsconfig.json
+++ b/ui/app/main/tsconfig.json
@@ -16,6 +16,7 @@
{ "path": "../../component/or-map" },
{ "path": "../../component/or-asset-tree" },
{ "path": "../../component/or-data-viewer" },
+ { "path": "../../component/or-log-viewer" },
{ "path": "../../component/or-attribute-input" },
{ "path": "../../component/or-chart" },
{ "path": "../../component/or-asset-viewer" },
diff --git a/ui/component/or-header/src/index.ts b/ui/component/or-header/src/index.ts
index e6afc5d04..9b39e8717 100644
--- a/ui/component/or-header/src/index.ts
+++ b/ui/component/or-header/src/index.ts
@@ -64,7 +64,8 @@ const secondaryItems: menuOption[] = [
icon: "file-document-box-search-outline",
value: "logs",
href: "#!logs",
- text: "logs"
+ text: "logs",
+ hideMobile: true
},
// {
// icon: "account-cog",
diff --git a/ui/component/or-map/src/mapwidget.ts b/ui/component/or-map/src/mapwidget.ts
index ec301aa18..6c7228311 100644
--- a/ui/component/or-map/src/mapwidget.ts
+++ b/ui/component/or-map/src/mapwidget.ts
@@ -113,7 +113,12 @@ export class MapWidget {
}
public async loadViewSettings() {
- const settingsResponse = await manager.rest.api.MapResource.getSettingsJs();
+ let settingsResponse;
+ if (this._type === Type.RASTER) {
+ settingsResponse = await manager.rest.api.MapResource.getSettingsJs();
+ } else {
+ settingsResponse = await manager.rest.api.MapResource.getSettings();
+ }
const settings = settingsResponse.data as any;
// Load options for current realm or fallback to default if exist
@@ -183,11 +188,8 @@ export class MapWidget {
this._styleParent.appendChild(style);
const map: typeof import("mapbox-gl") = await import(/* webpackChunkName: "mapbox-gl" */ "mapbox-gl");
- const settingsResponse = await manager.rest.api.MapResource.getSettings();
- const settings = settingsResponse.data as any;
-
- // Load options for current realm or fallback to default if exist
- this._viewSettings = settings.options ? settings.options[manager.getRealm() || "default"] ? settings.options[manager.getRealm() || "default"] : settings.options.default : null;
+ const settings = await this.loadViewSettings();
+
const options: OptionsGL = {
attributionControl: true,
container: this._mapContainer,