Skip to content

armgit / core

Public Imported from GitHub
0

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

Updated or-data-viewer DEFAULT_CONFIG (fixes #193)

Rich Turner91b678582f71
diff --git a/ui/app/or-app/src/pages/page-insights.ts b/ui/app/or-app/src/pages/page-insights.ts
index 9b25bd29e..d29ed7c63 100644
--- a/ui/app/or-app/src/pages/page-insights.ts
+++ b/ui/app/or-app/src/pages/page-insights.ts
@@ -19,23 +19,6 @@ export function pageInsightsProvider<S extends AppStateKeyed>(store: EnhancedSto
};
}
-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<S extends AppStateKeyed> extends Page<S> {
@@ -87,7 +70,7 @@ class PageInsights<S extends AppStateKeyed> extends Page<S> {
protected render(): TemplateResult | void {
return html`
- <or-data-viewer .config="${this.config ? this.config : viewerConfig}"></or-data-viewer>
+ <or-data-viewer></or-data-viewer>
`;
}
diff --git a/ui/component/or-data-viewer/src/index.ts b/ui/component/or-data-viewer/src/index.ts
index 804ce9aa6..06a98f454 100644
--- a/ui/component/or-data-viewer/src/index.ts
+++ b/ui/component/or-data-viewer/src/index.ts
@@ -82,8 +82,53 @@ export class OrDataViewer extends translate(i18next)(LitElement) {
type: "chart",
hideOnMobile: true,
panelStyles: {
- gridColumn: "1 / -1",
- gridRowStart: "1"
+ gridColumn: "1 / -1"
+ }
+ },
+ kpi1: {
+ type: "kpi",
+ hideOnMobile: false
+ },
+ kpi2: {
+ type: "kpi",
+ hideOnMobile: false
+ },
+ kpi3: {
+ type: "kpi",
+ hideOnMobile: false
+ },
+ kpi4: {
+ type: "kpi",
+ hideOnMobile: false
+ },
+ kpi5: {
+ type: "kpi",
+ hideOnMobile: false
+ },
+ kpi6: {
+ type: "kpi",
+ hideOnMobile: false
+ },
+ kpi7: {
+ type: "kpi",
+ hideOnMobile: false
+ },
+ kpi8: {
+ type: "kpi",
+ hideOnMobile: false
+ },
+ chart2: {
+ type: "chart",
+ hideOnMobile: true,
+ panelStyles: {
+ gridColumn: "1 / -1"
+ }
+ },
+ chart3: {
+ type: "chart",
+ hideOnMobile: true,
+ panelStyles: {
+ gridColumn: "1 / -1"
}
}
}
@@ -109,7 +154,7 @@ export class OrDataViewer extends translate(i18next)(LitElement) {
}
}
- public config?: DataViewerConfig;
+ public config?: DataViewerConfig = {...OrDataViewer.DEFAULT_CONFIG};
@property({type: Array, attribute: false})
protected _assets?: Asset[];