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
Map styling changes: mobile map-card, order of rendering markers, position of geocode control, highlight attr in card if label is set false in config (#618)
DonWillemsac09fff10aa6
diff --git a/setup/src/main/java/org/openremote/setup/demo/ManagerDemoSetup.java b/setup/src/main/java/org/openremote/setup/demo/ManagerDemoSetup.javaindex 2849a805a..90efcdc03 100644--- a/setup/src/main/java/org/openremote/setup/demo/ManagerDemoSetup.java+++ b/setup/src/main/java/org/openremote/setup/demo/ManagerDemoSetup.java@@ -813,27 +813,27 @@ public class ManagerDemoSetup extends ManagerSetup {new SimulatorAgentLink(smartcitySimulatorAgentId).setReplayData(new SimulatorReplayDatapoint[] {new SimulatorReplayDatapoint(midnight.get(SECOND_OF_DAY), getRandomNumberInRange(80,90)),- new SimulatorReplayDatapoint(midnight.plusHours(1).get(SECOND_OF_DAY), getRandomNumberInRange(80,90)),- new SimulatorReplayDatapoint(midnight.plusHours(2).get(SECOND_OF_DAY), getRandomNumberInRange(80,90)),- new SimulatorReplayDatapoint(midnight.plusHours(3).get(SECOND_OF_DAY), getRandomNumberInRange(80,90)),- new SimulatorReplayDatapoint(midnight.plusHours(4).get(SECOND_OF_DAY), getRandomNumberInRange(80,90)),- new SimulatorReplayDatapoint(midnight.plusHours(5).get(SECOND_OF_DAY), getRandomNumberInRange(80,90)),- new SimulatorReplayDatapoint(midnight.plusHours(6).get(SECOND_OF_DAY), getRandomNumberInRange(80,90)),- new SimulatorReplayDatapoint(midnight.plusHours(7).get(SECOND_OF_DAY), getRandomNumberInRange(80,90)),- new SimulatorReplayDatapoint(midnight.plusHours(8).get(SECOND_OF_DAY), getRandomNumberInRange(80,90)),- new SimulatorReplayDatapoint(midnight.plusHours(9).get(SECOND_OF_DAY), getRandomNumberInRange(80,90)),- new SimulatorReplayDatapoint(midnight.plusHours(10).get(SECOND_OF_DAY), getRandomNumberInRange(90,110)),- new SimulatorReplayDatapoint(midnight.plusHours(11).get(SECOND_OF_DAY), getRandomNumberInRange(90,110)),- new SimulatorReplayDatapoint(midnight.plusHours(12).get(SECOND_OF_DAY), getRandomNumberInRange(90,110)),- new SimulatorReplayDatapoint(midnight.plusHours(13).get(SECOND_OF_DAY), getRandomNumberInRange(90,110)),- new SimulatorReplayDatapoint(midnight.plusHours(14).get(SECOND_OF_DAY), getRandomNumberInRange(110,120)),- new SimulatorReplayDatapoint(midnight.plusHours(15).get(SECOND_OF_DAY), getRandomNumberInRange(115,125)),- new SimulatorReplayDatapoint(midnight.plusHours(16).get(SECOND_OF_DAY), getRandomNumberInRange(115,125)),- new SimulatorReplayDatapoint(midnight.plusHours(17).get(SECOND_OF_DAY), getRandomNumberInRange(110,120)),- new SimulatorReplayDatapoint(midnight.plusHours(18).get(SECOND_OF_DAY), getRandomNumberInRange(90,110)),+ new SimulatorReplayDatapoint(midnight.plusHours(1).get(SECOND_OF_DAY), getRandomNumberInRange(75,90)),+ new SimulatorReplayDatapoint(midnight.plusHours(2).get(SECOND_OF_DAY), getRandomNumberInRange(75,90)),+ new SimulatorReplayDatapoint(midnight.plusHours(3).get(SECOND_OF_DAY), getRandomNumberInRange(75,90)),+ new SimulatorReplayDatapoint(midnight.plusHours(4).get(SECOND_OF_DAY), getRandomNumberInRange(75,95)),+ new SimulatorReplayDatapoint(midnight.plusHours(5).get(SECOND_OF_DAY), getRandomNumberInRange(75,95)),+ new SimulatorReplayDatapoint(midnight.plusHours(6).get(SECOND_OF_DAY), getRandomNumberInRange(75,95)),+ new SimulatorReplayDatapoint(midnight.plusHours(7).get(SECOND_OF_DAY), getRandomNumberInRange(80,95)),+ new SimulatorReplayDatapoint(midnight.plusHours(8).get(SECOND_OF_DAY), getRandomNumberInRange(80,95)),+ new SimulatorReplayDatapoint(midnight.plusHours(9).get(SECOND_OF_DAY), getRandomNumberInRange(80,110)),+ new SimulatorReplayDatapoint(midnight.plusHours(10).get(SECOND_OF_DAY), getRandomNumberInRange(85,110)),+ new SimulatorReplayDatapoint(midnight.plusHours(11).get(SECOND_OF_DAY), getRandomNumberInRange(85,115)),+ new SimulatorReplayDatapoint(midnight.plusHours(12).get(SECOND_OF_DAY), getRandomNumberInRange(85,115)),+ new SimulatorReplayDatapoint(midnight.plusHours(13).get(SECOND_OF_DAY), getRandomNumberInRange(85,115)),+ new SimulatorReplayDatapoint(midnight.plusHours(14).get(SECOND_OF_DAY), getRandomNumberInRange(105,120)),+ new SimulatorReplayDatapoint(midnight.plusHours(15).get(SECOND_OF_DAY), getRandomNumberInRange(105,125)),+ new SimulatorReplayDatapoint(midnight.plusHours(16).get(SECOND_OF_DAY), getRandomNumberInRange(110,125)),+ new SimulatorReplayDatapoint(midnight.plusHours(17).get(SECOND_OF_DAY), getRandomNumberInRange(90,120)),+ new SimulatorReplayDatapoint(midnight.plusHours(18).get(SECOND_OF_DAY), getRandomNumberInRange(90,115)),new SimulatorReplayDatapoint(midnight.plusHours(19).get(SECOND_OF_DAY), getRandomNumberInRange(90,110)),- new SimulatorReplayDatapoint(midnight.plusHours(20).get(SECOND_OF_DAY), getRandomNumberInRange(80,90)),- new SimulatorReplayDatapoint(midnight.plusHours(21).get(SECOND_OF_DAY), getRandomNumberInRange(80,90)),+ new SimulatorReplayDatapoint(midnight.plusHours(20).get(SECOND_OF_DAY), getRandomNumberInRange(80,95)),+ new SimulatorReplayDatapoint(midnight.plusHours(21).get(SECOND_OF_DAY), getRandomNumberInRange(80,95)),new SimulatorReplayDatapoint(midnight.plusHours(22).get(SECOND_OF_DAY), getRandomNumberInRange(80,90)),new SimulatorReplayDatapoint(midnight.plusHours(23).get(SECOND_OF_DAY), getRandomNumberInRange(80,90))}diff --git a/ui/app/manager/src/pages/page-map.ts b/ui/app/manager/src/pages/page-map.tsindex 55efbc071..cef34d0ce 100644--- a/ui/app/manager/src/pages/page-map.ts+++ b/ui/app/manager/src/pages/page-map.ts@@ -133,13 +133,12 @@ export class PageMap extends Page<MapStateKeyed> {// language=CSSreturn css`or-map-asset-card {- height: 166px;+ height: 35vh;position: absolute;bottom: 0;right: 0;- width: calc(100vw - 10px);- margin: 5px;- z-index: 99;+ width: 100vw;+ z-index: 3;}or-map {@@ -354,7 +353,15 @@ export class PageMap extends Page<MapStateKeyed> {}const attr = asset.attributes[WellknownAttributes.LOCATION] as Attribute<GeoJSONPoint>;return !attr.meta || !attr.meta.hasOwnProperty(WellknownMetaItems.SHOWONDASHBOARD) || !!Util.getMetaValue(WellknownMetaItems.SHOWONDASHBOARD, attr);- }).map(asset => {+ })+ .sort((a,b) => {+ if (a.attributes[WellknownAttributes.LOCATION].value && b.attributes[WellknownAttributes.LOCATION].value){+ return b.attributes[WellknownAttributes.LOCATION].value.coordinates[1] - a.attributes[WellknownAttributes.LOCATION].value.coordinates[1];+ } else {+ return;+ }+ })+ .map(asset => {return html`<or-map-marker-asset ?active="${this._currentAsset && this._currentAsset.id === asset.id}" .asset="${asset}" .config="${this.config.markers}"></or-map-marker-asset>`;diff --git a/ui/component/or-map/src/index.ts b/ui/component/or-map/src/index.tsindex 2be87a193..99e0a0366 100644--- a/ui/component/or-map/src/index.ts+++ b/ui/component/or-map/src/index.ts@@ -282,7 +282,7 @@ export const geoJsonPointInputTemplateProvider: ValueInputProviderGenerator = (a}};- const controls = [[centerControl, "bottom-left"], [coordinatesControl, "top-left"]]+ const controls = [[centerControl, "bottom-left"], [coordinatesControl, "top-right"]]if (!readonly) {diff --git a/ui/component/or-map/src/mapwidget.ts b/ui/component/or-map/src/mapwidget.tsindex 9df1c141e..b1062639b 100644--- a/ui/component/or-map/src/mapwidget.ts+++ b/ui/component/or-map/src/mapwidget.ts@@ -348,7 +348,7 @@ export class MapWidget {this._geocoder._geocode(value);}}, 300);- this._mapGl!.addControl(this._geocoder);+ this._mapGl!.addControl(this._geocoder, 'top-left');// There's no callback parameter in the options of the MaplibreGeocoder,// so this is how we get the selected result.diff --git a/ui/component/or-map/src/markers/or-map-marker-asset.ts b/ui/component/or-map/src/markers/or-map-marker-asset.tsindex c0fbd1eb0..cf22d5b6e 100644--- a/ui/component/or-map/src/markers/or-map-marker-asset.ts+++ b/ui/component/or-map/src/markers/or-map-marker-asset.ts@@ -51,14 +51,14 @@ export function getMarkerConfigForAssetType(config: MapMarkerAssetConfig | undefreturn config[assetType];}-export function getMarkerConfigLabelAttributeName(config: MapMarkerAssetConfig | undefined, assetType: string | undefined): string | undefined {+export function getMarkerConfigAttributeName(config: MapMarkerAssetConfig | undefined, assetType: string | undefined): string | undefined {const assetTypeConfig = getMarkerConfigForAssetType(config, assetType);if (!assetTypeConfig) {return;}- return assetTypeConfig.showLabel ? assetTypeConfig.attributeName : undefined;+ return assetTypeConfig.attributeName;}@customElement("or-map-marker-asset")diff --git a/ui/component/or-map/src/markers/or-map-marker.ts b/ui/component/or-map/src/markers/or-map-marker.tsindex 94b44842e..78c2f750f 100644--- a/ui/component/or-map/src/markers/or-map-marker.ts+++ b/ui/component/or-map/src/markers/or-map-marker.ts@@ -1,7 +1,7 @@import {css, CSSResultGroup, html, LitElement, PropertyValues, unsafeCSS} from "lit";import {customElement, property, query} from "lit/decorators.js";import {markerActiveColorVar, markerColorVar} from "../style";-import {DefaultBoxShadowBottom} from "@openremote/core";+import {DefaultBoxShadow} from "@openremote/core";export class OrMapMarkerChangedEvent extends CustomEvent<OrMapMarkerChangedEventDetail> {@@ -69,15 +69,15 @@ export class OrMapMarker extends LitElement {width: auto;height: 20px;position: absolute;- top: -20px;+ top: -14px;left: 50%;padding: 0 3px;transform: translate(-50%, -50%);text-align: center;border-radius: 3px;- -webkit-box-shadow: ${unsafeCSS(DefaultBoxShadowBottom)};- -moz-box-shadow: ${unsafeCSS(DefaultBoxShadowBottom)};- box-shadow: ${unsafeCSS(DefaultBoxShadowBottom)};+ -webkit-box-shadow: ${unsafeCSS(DefaultBoxShadow)};+ -moz-box-shadow: ${unsafeCSS(DefaultBoxShadow)};+ box-shadow: ${unsafeCSS(DefaultBoxShadow)};}.label > span {white-space: nowrap;diff --git a/ui/component/or-map/src/or-map-asset-card.ts b/ui/component/or-map/src/or-map-asset-card.tsindex 141250db8..fb6b88773 100644--- a/ui/component/or-map/src/or-map-asset-card.ts+++ b/ui/component/or-map/src/or-map-asset-card.ts@@ -23,7 +23,7 @@ import {mapAssetCardStyle} from "./style";import { InputType } from "@openremote/or-mwc-components/or-mwc-input";import { i18next } from "@openremote/or-translate";import { getMarkerIconAndColorFromAssetType } from "./util";-import {MapMarkerConfig, getMarkerConfigLabelAttributeName, MapMarkerAssetConfig} from "./markers/or-map-marker-asset";+import {getMarkerConfigAttributeName, MapMarkerAssetConfig} from "./markers/or-map-marker-asset";export interface MapAssetCardTypeConfig {include?: string[];@@ -154,7 +154,7 @@ export class OrMapAssetCard extends subscribe(manager)(LitElement) {&& (!attr.meta || !attr.meta.hasOwnProperty(WellknownMetaItems.SHOWONDASHBOARD) || !!Util.getMetaValue(WellknownMetaItems.SHOWONDASHBOARD, attr))).sort(Util.sortByString((listItem) => listItem.name!));- const highlightedAttr = getMarkerConfigLabelAttributeName(this.markerconfig, this.asset.type);+ const highlightedAttr = getMarkerConfigAttributeName(this.markerconfig, this.asset.type);return html`<div id="card-container" style="${styleStr}">