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
Fix build
Robin Dekkers63d6e9a7e3b9
diff --git a/ui/app/main/src/components/my-app.ts b/ui/app/main/src/components/my-app.tsindex 37618bf67..168f4e95c 100644--- a/ui/app/main/src/components/my-app.ts+++ b/ui/app/main/src/components/my-app.ts@@ -2,7 +2,6 @@ import {css, customElement, html, LitElement, property, PropertyValues, unsafeCSimport {updateMetadata} from "pwa-helpers/metadata";import "@openremote/or-header";import "@openremote/or-icon";-import "@openremote/or-translate";import manager, {DefaultColor2, DefaultColor3, DefaultHeaderHeight} from "@openremote/core";import {router} from "../index";import {RootState, store} from "../store";diff --git a/ui/app/main/src/components/or-asset-summary-card.ts b/ui/app/main/src/components/or-asset-summary-card.tsdeleted file mode 100644index fa344dcbe..000000000--- a/ui/app/main/src/components/or-asset-summary-card.ts+++ /dev/null@@ -1,266 +0,0 @@-import {- css,- CSSResult,- CSSResultArray,- customElement,- html,- LitElement,- property,- PropertyValues,- TemplateResult,- unsafeCSS-} from "lit-element";-import {Asset, AssetEvent, AssetEventCause, AttributeEvent, AttributeType, AttributeValueType, MetaItemType, AttributeDescriptor} from "@openremote/model";-import manager, {- AssetModelUtil,- DefaultColor1,- DefaultColor3,- DefaultColor4,- DefaultColor5,- DefaultHeaderHeight,- subscribe,- Util-} from "@openremote/core";-import "@openremote/or-icon";-import {router} from "../index";-import "./or-attribute-field/src";-import {orAttributeTemplateProvider} from "./or-attribute-field/src";-import { i18next } from "@openremote/or-translate";--orAttributeTemplateProvider.setTemplate((attribute) => {- let template;- switch (attribute.type) {-- case AttributeValueType.BOOLEAN.name:- template = html`<or-translate value="${attribute.value}"></or-translate>`;- break;- case AttributeValueType.SWITCH_TOGGLE.name:- template = html`<or-translate value="${attribute.value ? "On" : "Off"}"></or-translate>`;- break;- case AttributeValueType.NUMBER.name:- case AttributeValueType.SOUND.name:- template = attribute.value ? new Intl.NumberFormat().format(attribute.value) : "-";- break;- case AttributeValueType.STRING.name:- template = html`<or-translate value="${attribute.value}"></or-translate>`;- break;- case AttributeValueType.OBJECT.name:- case AttributeValueType.ARRAY.name:- if(attribute.name === "status") {- template = html`<or-translate value="${attribute.value.result}"></or-translate>`;- }- else if(attribute.value && attribute.value.content.time) {- template = new Intl.DateTimeFormat('default', {- year: 'numeric',- month: 'numeric',- day: 'numeric',- hour: 'numeric',- minute: 'numeric'- }).format(new Date(attribute.value.content.time));- }- break;- default:- template = attribute.value ? attribute.value : "-";- break;- }- return template;-});--@customElement("or-asset-summary-card")-export class OrAssetSummaryCard extends subscribe(manager)(LitElement) {-- @property({type: String, reflect: true, attribute: true})- public assetId?: string;-- @property({type: Object, attribute: true})- public asset?: Asset;-- @property({type: Boolean, attribute: true})- public useAssetColor: boolean = true;-- static get styles(): CSSResultArray | CSSResult {- return css`- :host {- --internal-or-asset-summary-card-header-color: var(--or-asset-summary-card-header-color, var(--or-app-color4, ${unsafeCSS(DefaultColor4)}));- --internal-or-asset-summary-card-header-text-color: var(--or-asset-summary-card-header-text-color, var(--or-app-color1, ${unsafeCSS(DefaultColor1)}));- --internal-or-asset-summary-card-header-height: var(--or-asset-summary-card-header-height, calc(${unsafeCSS(DefaultHeaderHeight)} - 10px));- --internal-or-asset-summary-card-background-color: var(--or-asset-summary-card-background-color, var(--or-app-color1, ${unsafeCSS(DefaultColor1)}));- --internal-or-asset-summary-card-background-text-color: var(--or-asset-summary-card-background-text-color, var(--or-app-color3, ${unsafeCSS(DefaultColor3)}));- --internal-or-asset-summary-card-separator-color: var(--or-asset-summary-card-separator-color, var(--or-app-color5, ${unsafeCSS(DefaultColor5)}));-- display: block;- }-- #card-container {- display: flex;- flex-direction: column;- height: 100%;- background-color: var(--internal-or-asset-summary-card-background-color);- -webkit-box-shadow: 1px 1px 2px 0px rgba(0,0,0,0.28);- -moz-box-shadow: 1px 1px 2px 0px rgba(0,0,0,0.28);- box-shadow: 1px 1px 2px 0px rgba(0,0,0,0.28);- }-- #header {- height: var(--internal-or-asset-summary-card-header-height);- background-color: var(--internal-or-asset-summary-card-header-color);- line-height: var(--internal-or-asset-summary-card-header-height);- border-bottom: 1px solid ${unsafeCSS(DefaultColor5)};- text-align: center;- color: var(--internal-or-asset-summary-card-header-text-color);- --or-icon-fill: var(--internal-or-asset-summary-card-header-text-color);- --or-icon-width: 20px;- --or-icon-height: 20px;- z-index: 99999;- }-- #header > or-icon {- margin-right: 5px;- }-- #title {- font-weight: 500;- }-- #attribute-list {- flex: 1;- color: var(--internal-or-asset-summary-card-background-text-color);- padding: 10px 20px;- overflow: auto;- font-size: 14px;- }-- ul {- list-style-type: none;- margin: 0;- padding: 0;- }-- li {- display: flex;- line-height: 30px;- height: 32px;- }-- .attribute-name {- flex: 1;- }-- .attribute-value {- overflow: hidden;- padding-left: 20px;- text-align: right;- }-- #footer {- height: var(--internal-or-asset-summary-card-header-height);- border-top: 1px solid var(--internal-or-asset-summary-card-separator-color);- text-align: right;- }-- #footer > span {- line-height: var(--internal-or-asset-summary-card-header-height);- font-weight: 500;- font-size: 14px;- margin-right: 20px;- cursor: pointer;- }-- @media only screen and (min-width: 415px){- #card-container {- height: 400px; /* fallback for IE */- height: max-content;- max-height: calc(100vh - 150px);- min-height: 134px;- }- }- `;- }-- protected shouldUpdate(_changedProperties: PropertyValues): boolean {-- if (_changedProperties.has("assetId")) {- this.title = undefined;- this.assetIds = this.assetId && this.assetId.length > 0 ? [this.assetId] : undefined;-- if (Object.keys(_changedProperties).length === 1) {- return false;- }- }-- return super.shouldUpdate(_changedProperties);- }-- public onAttributeEvent(event: AttributeEvent) {-- if (this.asset) {- this.asset = Util.updateAsset(this.asset, event);- this.requestUpdate();- }- }-- public onAssetEvent(event: AssetEvent) {- switch (event.cause) {- case AssetEventCause.READ:- case AssetEventCause.CREATE:- case AssetEventCause.UPDATE:- this.asset = event.asset;- break;- case AssetEventCause.DELETE:- this.asset = null;- break;- }- }-- protected render(): TemplateResult | undefined {-- if (!this.asset) {- return html``;- }-- const icon = this.getIcon();- const color = this.getColor();- const styleStr = color ? "--internal-or-asset-summary-card-header-color: #" + color + ";" : "";---- return html`- <div id="card-container" style="${styleStr}">- <div id="header">- ${icon ? html`<or-icon icon="${icon}"></or-icon>` : ``}- <span id="title">${this.asset.name}</span>- </div>- <div id="attribute-list">- <ul>- ${Util.getAssetAttributes(this.asset).filter((attr) => attr.name !== AttributeType.LOCATION.attributeName).map((attr) => {- let attributeDescriptor: AttributeDescriptor | undefined = AssetModelUtil.getAttributeDescriptorFromAsset(attr.name!);- let label = Util.getAttributeLabel(attr, attributeDescriptor);- const unit = Util.getMetaValue(MetaItemType.UNIT_TYPE, attr, attributeDescriptor);-- if(unit)- label = label + " ("+i18next.t(unit)+")";- return html`<li>${label}<span class="attribute-value"><or-attribute-field .attribute="${attr}"></or-attribute-field></span></li>`;- })}- </ul>- </div>- <div id="footer">- <span @click="${() => router.navigate('assets/'+this.asset.id)}">Asset details</span>- </div>- </div>- `;- }-- protected getIcon(): string | undefined {- if (this.asset) {- const descriptor = AssetModelUtil.getAssetDescriptor(this.asset.type);- return descriptor.icon;- }- }-- protected getColor(): string | undefined {- if (this.asset) {- const descriptor = AssetModelUtil.getAssetDescriptor(this.asset.type);- return descriptor.color;- }- }-}diff --git a/ui/app/main/src/components/or-language/src/index.ts b/ui/app/main/src/components/or-language/src/index.tsdeleted file mode 100644index 57a1152cb..000000000--- a/ui/app/main/src/components/or-language/src/index.ts+++ /dev/null@@ -1,43 +0,0 @@-import {customElement, html, LitElement, property} from "lit-element";-import "@openremote/or-icon";-import manager from "@openremote/core";-import {style} from "./style";--@customElement("or-language")-export class OrLanguage extends LitElement {--- @property({type: Boolean})- isVisible?: boolean = false;-- static styles = style;-- protected render() {- return html`- <or-icon icon="web" @click="${this.toggleMenu}"></or-icon>- <div class="background-close ${this.isVisible ? "active" : ""}" @click="${this.closeMenu}"></div>- ${this.isVisible ? html`- <div class="dropdown-menu">- <span @click="${() => this.changeLanguage("en")}"><or-translate value="english"></or-translate></span>- <span @click="${() => this.changeLanguage("nl")}"><or-translate value="dutch"></or-translate></span>- <span @click="${() => this.changeLanguage("fr")}"><or-translate value="french"></or-translate></span>- <span @click="${() => this.changeLanguage("de")}"><or-translate value="german"></or-translate></span>- <span @click="${() => this.changeLanguage("es")}"><or-translate value="spanish"></or-translate></span>- </div>- ` : ``}- `;- }-- changeLanguage(language) {- manager.language = language;- this.isVisible = false;- }-- closeMenu() {- this.isVisible = false;- }-- toggleMenu() {- this.isVisible = !this.isVisible;- }-}diff --git a/ui/app/main/src/components/or-language/src/style.ts b/ui/app/main/src/components/or-language/src/style.tsdeleted file mode 100644index 28c8e330b..000000000--- a/ui/app/main/src/components/or-language/src/style.ts+++ /dev/null@@ -1,37 +0,0 @@-import {css} from "lit-element";--// language=CSS-export const style = css`- :host {- position: relative;- }-- .dropdown-menu {- position: absolute;- top: 100%;- box-shadow: rgba(0, 0, 0, 0.3) 0 5px 5px -2px;- width: 120px;- background-color: white;- right: 0;- }-- span {- display: block;- height: 40px;- line-height: 40px;- }-- .background-close {- display: none;- position: fixed;- width: 100vw;- height: 100vh;- top: 0;- left: 0;- z-index: 0;- }-- .background-close.active {- display: block;- }-`;\ No newline at end of filediff --git a/ui/component/or-map/package.json b/ui/component/or-map/package.jsonindex 99f790bb4..15d3e36c5 100644--- a/ui/component/or-map/package.json+++ b/ui/component/or-map/package.json@@ -15,6 +15,10 @@"dependencies": {"@openremote/core": "^1.1.0","@openremote/rest": "^1.1.0",+ "@openremote/model": "^1.1.0",+ "@openremote/or-input" :"^1.1.0",+ "@openremote/or-icon" :"^1.1.0",+ "@openremote/or-translate" :"^1.1.0","mapbox-gl": "1.2.1","mapbox.js": "^3.2.0","lit-element": "^2.1.0",diff --git a/ui/component/or-map/tsconfig.json b/ui/component/or-map/tsconfig.jsonindex 4d7b60c8a..45f8e6848 100644--- a/ui/component/or-map/tsconfig.json+++ b/ui/component/or-map/tsconfig.json@@ -11,6 +11,10 @@],"references": [{ "path": "../core" },- { "path": "../rest" }+ { "path": "../rest" },+ { "path": "../model" },+ { "path": "../or-translate" },+ { "path": "../or-icon" },+ { "path": "../or-input" }]}\ No newline at end of file