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
create insights page and link it to the router
Vincenta9cc7b263987
diff --git a/ui/app/main/src/components/my-app.ts b/ui/app/main/src/components/my-app.tsindex 168f4e95c..ca1dc394a 100644--- a/ui/app/main/src/components/my-app.ts+++ b/ui/app/main/src/components/my-app.ts@@ -8,6 +8,7 @@ import {RootState, store} from "../store";import "../components/pages/page-map";import "../components/pages/page-assets";import "../components/pages/page-rules";+import "../components/pages/page-insights";import i18next from "i18next";import {connect} from "pwa-helpers/connect-mixin";@@ -85,6 +86,7 @@ class MyApp extends connect(store)(LitElement) {${this.page === "map" ? html`<page-map class="page"></page-map>` : ``}${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>` : ``}</main>`;}diff --git a/ui/app/main/src/components/pages/page-insights.ts b/ui/app/main/src/components/pages/page-insights.tsnew file mode 100644index 000000000..d9673c4f0--- /dev/null+++ b/ui/app/main/src/components/pages/page-insights.ts@@ -0,0 +1,79 @@+import {customElement, html, LitElement, property, TemplateResult, css, unsafeCSS} from "lit-element";+import {store} from "../../store";+import {connect} from "pwa-helpers/connect-mixin";+import "@openremote/or-data-viewer";+import {DataViewerConfig} from "@openremote/or-data-viewer";+import {DefaultBoxShadow} from "@openremote/core";++// language=CSS+const style = css`++ or-asset-tree {+ align-items: stretch;+ z-index: 1;+ }++ .hideMobile {+ display: none;+ }++ or-asset-viewer {+ align-items: stretch;+ z-index: 0;+ }++ @media only screen and (min-width: 768px){+ or-asset-tree {+ width: 300px;+ min-width: 300px;+ box-shadow: ${unsafeCSS(DefaultBoxShadow)}+ }++ .hideMobile {+ display: flex;+ }++ or-asset-viewer,+ or-asset-viewer.hideMobile {+ display: initial;+ }++++ }+`;++const viewerConfig: DataViewerConfig = {+ panels: {+ "chart": {+ type: "chart",+ hideOnMobile: true,+ panelStyles: {+ gridColumn: "1 / -1",+ gridRowStart: "1"+ },+ defaults: [{+ assetId:"5442Ite2XVp3Ky9X2y647a",+ attributes: ["UVIndex"]+ }]+ }+ }+};++@customElement("page-insights")+class PageInsights extends connect(store)(LitElement) {++ static get styles() {+ return style;+ }++ @property()+ protected _assetId;++ protected render(): TemplateResult | void {+ return html`+ <or-data-viewer .config="${viewerConfig}"></or-data-viewer>+ `;+ }++}\ No newline at end of filediff --git a/ui/app/main/src/index.ts b/ui/app/main/src/index.tsindex 887327c25..f28a78f25 100644--- a/ui/app/main/src/index.ts+++ b/ui/app/main/src/index.ts@@ -34,6 +34,9 @@ router.on({store.dispatch(updateRule(params.id));store.dispatch(updatePage("rules"));},+ "insights": (params, query) => {+ store.dispatch(updatePage("insights"));+ },"*": (params, query) => {store.dispatch(updatePage("map"));}