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
Work on web components and styling, smart home app and master examples
Christian Bauer47eced7d7299
diff --git a/client/src/main/java/org/openremote/app/client/admin/syslog/SyslogItem.java b/client/src/main/java/org/openremote/app/client/admin/syslog/SyslogItem.javaindex 2b3c3e959..b473b8e78 100644--- a/client/src/main/java/org/openremote/app/client/admin/syslog/SyslogItem.java+++ b/client/src/main/java/org/openremote/app/client/admin/syslog/SyslogItem.java@@ -41,8 +41,8 @@ public class SyslogItem {public interface Templates extends SafeHtmlTemplates {@Template("<div class=\"layout horizontal center\" style=\"font-weight: 600; margin-bottom: 0.2em;\">" +- "<span class=\"or-IconLabel or-MessagesIcon fa fa-{0} {1}\"></span>" +- "<span style=\"font-size:smaller; margin-left: 1em;\">{2}</span>" ++ "<span class=\"or-Icon fa fa-{0} {1}\"></span>" ++ "<span style=\"font-size:smaller;\">{2}</span>" +"<span class=\"flex layout horizontal end-justified\" style=\"font-size:smaller; margin-left: 1em;\">{3}</span>" +"</div>" +"<div style=\"font-size:smaller;white-space:pre-line;\">{4}</div>"diff --git a/client/src/main/java/org/openremote/app/client/admin/users/notifications/AdminUserNotificationEditorImpl.java b/client/src/main/java/org/openremote/app/client/admin/users/notifications/AdminUserNotificationEditorImpl.javaindex 19ec03ab9..ac5f81f85 100644--- a/client/src/main/java/org/openremote/app/client/admin/users/notifications/AdminUserNotificationEditorImpl.java+++ b/client/src/main/java/org/openremote/app/client/admin/users/notifications/AdminUserNotificationEditorImpl.java@@ -168,10 +168,7 @@ public class AdminUserNotificationEditorImpl implements AdminUserNotificationEdiif (isNullOrEmpty(notificationTitle)|| isNullOrEmpty(notificationMessage)|| isNullOrEmpty(notificationAppUrl)) {- IconLabel warningLabel = new IconLabel();- warningLabel.setIcon("warning");- warningLabel.addStyleName(widgetStyle.MessagesIcon());- errorPanel.add(warningLabel);+ errorPanel.add(new IconLabel("warning"));InlineLabel errorMessage = new InlineLabel(managerMessages.enterTitleMessageAppurlForNotification());errorPanel.add(errorMessage);errorPanel.setVisible(true);diff --git a/client/src/main/java/org/openremote/app/client/app/FooterViewImpl.ui.xml b/client/src/main/java/org/openremote/app/client/app/FooterViewImpl.ui.xmlindex efec9cd39..fcb37ba01 100644--- a/client/src/main/java/org/openremote/app/client/app/FooterViewImpl.ui.xml+++ b/client/src/main/java/org/openremote/app/client/app/FooterViewImpl.ui.xml@@ -5,7 +5,7 @@<ui:style>.footer {font-size: small;- padding: 0.4em;+ padding: 1em 2em;}.navItem {@@ -21,7 +21,11 @@}.brand {- font-size: x-small;+ font-size: smaller;+ }++ .brandAnchor {+ padding: 0 !important;}</ui:style>@@ -41,7 +45,7 @@<g:HTMLPanel styleName="{style.logoItem}"><g:HTMLPanel styleName="layout horizontal center {style.logo}"><div class="{widgetStyle.Hyperlink} {style.brand}">- <g:Anchor href="https://openremote.com/">OpenRemote Inc.</g:Anchor>+ <g:Anchor href="https://openremote.com/" styleName="{style.brandAnchor}">OpenRemote Inc.</g:Anchor></div></g:HTMLPanel></g:HTMLPanel>diff --git a/client/src/main/java/org/openremote/app/client/app/dialog/JsonEditorImpl.java b/client/src/main/java/org/openremote/app/client/app/dialog/JsonEditorImpl.javaindex c744ddb61..67ec8a978 100644--- a/client/src/main/java/org/openremote/app/client/app/dialog/JsonEditorImpl.java+++ b/client/src/main/java/org/openremote/app/client/app/dialog/JsonEditorImpl.java@@ -161,10 +161,7 @@ public class JsonEditorImpl implements JsonEditor {error = ex.getMessage();}if (error != null) {- IconLabel warningLabel = new IconLabel();- warningLabel.setIcon("warning");- warningLabel.addStyleName(widgetStyle.MessagesIcon());- errorPanel.add(warningLabel);+ errorPanel.add(new IconLabel("warning"));InlineLabel errorMessage = new InlineLabel(error);errorPanel.add(errorMessage);errorPanel.setVisible(true);diff --git a/client/src/main/java/org/openremote/app/client/assets/browser/AssetBrowserImpl.ui.xml b/client/src/main/java/org/openremote/app/client/assets/browser/AssetBrowserImpl.ui.xmlindex 91466a9a2..d984d4f72 100644--- a/client/src/main/java/org/openremote/app/client/assets/browser/AssetBrowserImpl.ui.xml+++ b/client/src/main/java/org/openremote/app/client/assets/browser/AssetBrowserImpl.ui.xml@@ -12,7 +12,7 @@}.navItem {- margin-right: 0.8em;+ margin: 0;}.navItemFirst {diff --git a/client/src/main/java/org/openremote/app/client/assets/browser/AssetTreeCell.java b/client/src/main/java/org/openremote/app/client/assets/browser/AssetTreeCell.javaindex 76b999a9e..b2335285d 100644--- a/client/src/main/java/org/openremote/app/client/assets/browser/AssetTreeCell.java+++ b/client/src/main/java/org/openremote/app/client/assets/browser/AssetTreeCell.java@@ -37,7 +37,7 @@ class AssetTreeCell extends AbstractSafeHtmlCell<BrowserTreeNode> {}public interface AssetTemplates extends SafeHtmlTemplates {- @Template("<div id=\"" + CELL_ID_PREFIX + "-{0}\" class=\"or-{3}\"><span class=\"or-FormTreeIcon fa fa-{2}\"></span>{1}</div>")+ @Template("<div id=\"" + CELL_ID_PREFIX + "-{0}\" class=\"or-{3}\"><span class=\"or-Icon fa fa-{2}\"></span>{1}</div>")SafeHtml treeNode(String id, String label, String icon, String type);}diff --git a/client/src/main/java/org/openremote/app/client/polymer/ViewComponent.java b/client/src/main/java/org/openremote/app/client/polymer/ViewComponent.javaindex 677249d4a..9b6a59658 100644--- a/client/src/main/java/org/openremote/app/client/polymer/ViewComponent.java+++ b/client/src/main/java/org/openremote/app/client/polymer/ViewComponent.java@@ -24,7 +24,7 @@ import jsinterop.annotations.JsPackage;import jsinterop.annotations.JsType;import jsinterop.base.Any;-@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "OpenRemoteViewComponent")+@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "OpenRemoteComponent")public abstract class ViewComponent extends HTMLElement {public native void showComponent();diff --git a/client/src/main/java/org/openremote/app/client/style/WidgetStyle.java b/client/src/main/java/org/openremote/app/client/style/WidgetStyle.javaindex d76c7ad7d..0bdd7f4b4 100644--- a/client/src/main/java/org/openremote/app/client/style/WidgetStyle.java+++ b/client/src/main/java/org/openremote/app/client/style/WidgetStyle.java@@ -35,14 +35,12 @@ public class WidgetStyle {public String MainContent = "or-MainContent";public String PushButton = "or-PushButton";public String Hyperlink = "or-Hyperlink";- public String HyperlinkIcon = "or-HyperlinkIcon";public String UnorderedList = "or-UnorderedList";public String Divider = "or-Divider";public String Toast = "or-Toast";public String ToastInfo = "or-ToastInfo";public String ToastSuccess = "or-ToastSuccess";public String ToastFailure = "or-ToastFailure";- public String MessagesIcon = "or-MessagesIcon";public String PopupPanel = "or-PopupPanel";public String PopupPanelHeader = "or-PopupPanelHeader";public String PopupPanelContent = "or-PopupPanelContent";@@ -176,11 +174,6 @@ public class WidgetStyle {return Hyperlink;}- @JsIgnore- public String HyperlinkIcon() {- return HyperlinkIcon;- }-@JsIgnorepublic String UnorderedList() {return UnorderedList;@@ -211,11 +204,6 @@ public class WidgetStyle {return ToastFailure;}- @JsIgnore- public String MessagesIcon() {- return MessagesIcon;- }-@JsIgnorepublic String PopupPanel() {return PopupPanel;diff --git a/client/src/main/java/org/openremote/app/client/toast/PopupToastDisplay.java b/client/src/main/java/org/openremote/app/client/toast/PopupToastDisplay.javaindex 5732b0ea5..2deb961bb 100644--- a/client/src/main/java/org/openremote/app/client/toast/PopupToastDisplay.java+++ b/client/src/main/java/org/openremote/app/client/toast/PopupToastDisplay.java@@ -24,7 +24,7 @@ import com.google.gwt.user.client.ui.FlowPanel;import com.google.gwt.user.client.ui.Label;import jsinterop.annotations.JsType;import org.openremote.app.client.style.WidgetStyle;-import org.openremote.app.client.widget.MessagesIcon;+import org.openremote.app.client.widget.IconLabel;import org.openremote.app.client.widget.PopupPanel;import javax.inject.Inject;@@ -235,15 +235,15 @@ public class PopupToastDisplay implements ToastDisplay {switch (toast.getType()) {case INFO:content.addStyleName(widgetStyle.ToastInfo());- content.add(new MessagesIcon("info-circle"));+ content.add(new IconLabel("info-circle"));break;case SUCCESS:content.addStyleName(widgetStyle.ToastSuccess());- content.add(new MessagesIcon("check"));+ content.add(new IconLabel("check"));break;default:content.addStyleName(widgetStyle.ToastFailure());- content.add(new MessagesIcon("warning"));+ content.add(new IconLabel("warning"));break;}diff --git a/client/src/main/java/org/openremote/app/client/widget/FormInlineLabel.java b/client/src/main/java/org/openremote/app/client/widget/FormInlineLabel.javaindex ac5dfb5e1..df16610ad 100644--- a/client/src/main/java/org/openremote/app/client/widget/FormInlineLabel.java+++ b/client/src/main/java/org/openremote/app/client/widget/FormInlineLabel.java@@ -21,7 +21,6 @@ package org.openremote.app.client.widget;import com.google.gwt.dom.client.Document;import com.google.gwt.dom.client.SpanElement;-import com.google.gwt.dom.client.Style;import com.google.gwt.user.client.ui.ComplexPanel;public class FormInlineLabel extends ComplexPanel {@@ -42,8 +41,6 @@ public class FormInlineLabel extends ComplexPanel {getElement().appendChild(textElement);iconElement = (SpanElement) Document.get().createElement(SpanElement.TAG);- iconElement.addClassName("or-FormInlineLabelIcon");- iconElement.getStyle().setTextAlign(Style.TextAlign.RIGHT);setText(text);}@@ -62,6 +59,7 @@ public class FormInlineLabel extends ComplexPanel {public void setIcon(String icon) {if (this.icon != null) {+ iconElement.removeClassName("or-Icon");iconElement.removeClassName("fa");iconElement.removeClassName("fa-" + this.icon);} else {@@ -69,6 +67,7 @@ public class FormInlineLabel extends ComplexPanel {}this.icon = icon;if (icon != null) {+ iconElement.addClassName("or-Icon");iconElement.addClassName("fa");iconElement.addClassName("fa-" + icon);}diff --git a/client/src/main/java/org/openremote/app/client/widget/FormLabel.java b/client/src/main/java/org/openremote/app/client/widget/FormLabel.javaindex 440b04c86..bc27c83e6 100644--- a/client/src/main/java/org/openremote/app/client/widget/FormLabel.java+++ b/client/src/main/java/org/openremote/app/client/widget/FormLabel.java@@ -19,7 +19,10 @@*/package org.openremote.app.client.widget;-import com.google.gwt.dom.client.*;+import com.google.gwt.dom.client.DivElement;+import com.google.gwt.dom.client.Document;+import com.google.gwt.dom.client.LabelElement;+import com.google.gwt.dom.client.SpanElement;import com.google.gwt.user.client.ui.ComplexPanel;public class FormLabel extends ComplexPanel {@@ -38,8 +41,6 @@ public class FormLabel extends ComplexPanel {getElement().addClassName("or-FormLabel layout horizontal center");iconElement = (SpanElement) Document.get().createElement(SpanElement.TAG);- iconElement.addClassName("or-FormLabelIcon");- iconElement.getStyle().setTextAlign(Style.TextAlign.RIGHT);labelElement = (LabelElement) Document.get().createElement(LabelElement.TAG);labelElement.setHtmlFor(Document.get().createUniqueId());@@ -78,6 +79,7 @@ public class FormLabel extends ComplexPanel {public void setIcon(String icon) {if (this.icon != null) {+ iconElement.removeClassName("or-Icon");iconElement.removeClassName("fa");iconElement.removeClassName("fa-" + icon);} else {@@ -85,6 +87,7 @@ public class FormLabel extends ComplexPanel {}this.icon = icon;if (icon != null) {+ iconElement.addClassName("or-Icon");iconElement.addClassName("fa");iconElement.addClassName("fa-" + icon);}diff --git a/client/src/main/java/org/openremote/app/client/widget/FormMessages.java b/client/src/main/java/org/openremote/app/client/widget/FormMessages.javaindex d7f4897c4..87b785eeb 100644--- a/client/src/main/java/org/openremote/app/client/widget/FormMessages.java+++ b/client/src/main/java/org/openremote/app/client/widget/FormMessages.java@@ -33,10 +33,7 @@ public class FormMessages extends FlowPanel {addStyleName(widgetStyle.FormMessages());addStyleName(success ? "success" : "error");- IconLabel iconLabel = new IconLabel();- add(iconLabel);- iconLabel.addStyleName(widgetStyle.MessagesIcon());- iconLabel.setIcon(success ? "check" : "warning");+ add(new IconLabel(success ? "check" : "warning"));add(panel);diff --git a/client/src/main/java/org/openremote/app/client/widget/Headline.java b/client/src/main/java/org/openremote/app/client/widget/Headline.javaindex c23f0d24f..08a65fb88 100644--- a/client/src/main/java/org/openremote/app/client/widget/Headline.java+++ b/client/src/main/java/org/openremote/app/client/widget/Headline.java@@ -29,7 +29,7 @@ public class Headline extends FlowPanel {private static final Logger LOG = Logger.getLogger(Headline.class.getName());- protected InlineLabel iconLabel;+ protected InlineLabel iconLabel =new InlineLabel();protected String icon;protected InlineLabel headlineLabel;protected Label headlineSubLabel;@@ -41,10 +41,8 @@ public class Headline extends FlowPanel {public Headline(String text) {setStyleName("or-Headline");- iconLabel = new InlineLabel();- iconLabel.setStyleName("or-HeadlineIcon fa");add(iconLabel);-+headlineLabel = new InlineLabel();headlineLabel.setStyleName("or-HeadlineText");add(headlineLabel);@@ -78,12 +76,11 @@ public class Headline extends FlowPanel {}public void setIcon(String icon) {- if (this.icon != null && this.icon.length() > 0) {- iconLabel.removeStyleName("fa-" + this.icon);- }+ iconLabel.getElement().removeClassName("or-Icon fa");+ iconLabel.getElement().removeClassName("fa-" + this.icon);this.icon = icon;- if (icon != null && icon.length() > 0) {- iconLabel.addStyleName("fa-" + icon);+ if (icon != null) {+ iconLabel.getElement().addClassName("or-Icon fa fa-" + icon);}}}diff --git a/client/src/main/java/org/openremote/app/client/widget/Hyperlink.java b/client/src/main/java/org/openremote/app/client/widget/Hyperlink.javaindex 849275a0d..300331dda 100644--- a/client/src/main/java/org/openremote/app/client/widget/Hyperlink.java+++ b/client/src/main/java/org/openremote/app/client/widget/Hyperlink.java@@ -55,10 +55,11 @@ public class Hyperlink extends com.google.gwt.user.client.ui.Hyperlink {}public void setIcon(String icon) {+ iconLabel.getElement().removeClassName("or-Icon fa");+ iconLabel.getElement().removeClassName("fa-" + this.icon);this.icon = icon;- iconLabel.getElement().removeClassName("or-HyperlinkIcon");if (icon != null) {- iconLabel.getElement().addClassName("or-HyperlinkIcon fa fa-" + icon);+ iconLabel.getElement().addClassName("or-Icon fa fa-" + icon);}}diff --git a/client/src/main/java/org/openremote/app/client/widget/IconLabel.java b/client/src/main/java/org/openremote/app/client/widget/IconLabel.javaindex 381713fd0..404d7dd09 100644--- a/client/src/main/java/org/openremote/app/client/widget/IconLabel.java+++ b/client/src/main/java/org/openremote/app/client/widget/IconLabel.java@@ -26,7 +26,7 @@ public class IconLabel extends InlineLabel {protected String icon;public IconLabel(String icon) {- setStyleName("or-IconLabel");+ setStyleName("or-Icon");setIcon(icon);}diff --git a/client/src/main/java/org/openremote/app/client/widget/MessagesIcon.java b/client/src/main/java/org/openremote/app/client/widget/MessagesIcon.javadeleted file mode 100644index 3e2117a2b..000000000--- a/client/src/main/java/org/openremote/app/client/widget/MessagesIcon.java+++ /dev/null@@ -1,30 +0,0 @@-/*- * Copyright 2016, OpenRemote Inc.- *- * See the CONTRIBUTORS.txt file in the distribution for a- * full listing of individual contributors.- *- * This program is free software: you can redistribute it and/or modify- * it under the terms of the GNU Affero General Public License as- * published by the Free Software Foundation, either version 3 of the- * License, or (at your option) any later version.- *- * This program is distributed in the hope that it will be useful,- * but WITHOUT ANY WARRANTY; without even the implied warranty of- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the- * GNU Affero General Public License for more details.- *- * You should have received a copy of the GNU Affero General Public License- * along with this program. If not, see <http://www.gnu.org/licenses/>.- */-package org.openremote.app.client.widget;--import com.google.gwt.user.client.ui.InlineLabel;--public class MessagesIcon extends InlineLabel {-- public MessagesIcon(String icon) {- setStyleName("fa fa-" + icon);- addStyleName("or-MessagesIcon");- }-}diff --git a/client/src/main/java/org/openremote/app/client/widget/PushButton.java b/client/src/main/java/org/openremote/app/client/widget/PushButton.javaindex 4135350ce..ae71828ae 100644--- a/client/src/main/java/org/openremote/app/client/widget/PushButton.java+++ b/client/src/main/java/org/openremote/app/client/widget/PushButton.java@@ -37,11 +37,11 @@ public class PushButton extends com.google.gwt.user.client.ui.PushButton {}public void setIcon(String icon) {- iconLabel.getElement().removeClassName("or-PushButtonIcon fa");+ iconLabel.getElement().removeClassName("or-Icon fa");iconLabel.getElement().removeClassName("fa-" + this.icon);this.icon = icon;if (icon != null) {- iconLabel.getElement().addClassName("or-PushButtonIcon fa fa-" + icon);+ iconLabel.getElement().addClassName("or-Icon fa fa-" + icon);}}diff --git a/client/src/main/webapp/bower.json b/client/src/main/webapp/bower.jsonindex 4c7857d55..f641e5820 100644--- a/client/src/main/webapp/bower.json+++ b/client/src/main/webapp/bower.json@@ -19,6 +19,8 @@"polymer": "Polymer/polymer#^2.5.0","iron-flex-layout": "^2.0.3","app-localize-behavior": "PolymerElements/app-localize-behavior#^2.0.1",+ "app-route": "PolymerElements/app-route#^2.0.3",+ "moment": "moment#^2.20.1","intl": "intl#^1.2.5","chart.js": "^2.7.0"}diff --git a/client/src/main/webapp/js/auth.js b/client/src/main/webapp/js/auth.jsindex 677c4d187..d1aa2c75b 100644--- a/client/src/main/webapp/js/auth.js+++ b/client/src/main/webapp/js/auth.js@@ -104,7 +104,7 @@ window.renderBasicAuthForm = function () {'<div class="or-HeadlineSub" style="margin-left: 0.2em;">OpenRemote Login</div></div>' +'</div>' +'<div class="basicAuthMessage layout horizontal center or-FormMessages error" style="display: none;">' +- '<div class="or-MessagesIcon fa fa-warning"></div>' ++ '<div class="or-Icon fa fa-warning"></div>' +'<span class="basicAuthMessageText"></span>' +'</div>' +'<form class="layout vertical or-Form">' +diff --git a/client/src/main/webapp/src/manager/or-manager-console-apps/or-manager-console-apps-view.html b/client/src/main/webapp/src/manager/or-manager-console-apps/or-manager-console-apps-view.htmlindex 6abeb24db..3ef87fce9 100644--- a/client/src/main/webapp/src/manager/or-manager-console-apps/or-manager-console-apps-view.html+++ b/client/src/main/webapp/src/manager/or-manager-console-apps/or-manager-console-apps-view.html@@ -27,7 +27,7 @@<template is="dom-repeat" id="appsList" items="[[apps]]"><div class$="navItem [[widgetStyle.SecondaryNavItem]] [[widgetStyle.Hyperlink]] [[item.active]]">- <div class$="[[widgetStyle.HyperlinkIcon]] [[icon('connectdevelop')]]"></div>+ <div class$="[[icon('connectdevelop')]]"></div><a on-click="onAppSelected">[[item.tenant.displayName]]</a></div></template>@@ -59,7 +59,7 @@</template><script>- class OpenRemoteManagerConsoleAppsView extends OpenRemoteViewComponent {+ class OpenRemoteManagerConsoleAppsView extends OpenRemoteComponent {static get is() {return "or-manager-console-apps-view";diff --git a/client/src/main/webapp/src/or-app/or-app-security.html b/client/src/main/webapp/src/or-app/or-app-security.htmlindex e760e230c..b40b42aef 100644--- a/client/src/main/webapp/src/or-app/or-app-security.html+++ b/client/src/main/webapp/src/or-app/or-app-security.html@@ -51,7 +51,7 @@<div id="basicAuthMessage"class="layout horizontal center or-FormMessages error"style="display: none;">- <div class="or-MessagesIcon fa fa-warning"></div>+ <div class="or-Icon fa fa-warning"></div><span id="basicAuthMessageText"></span></div>diff --git a/client/src/main/webapp/src/or-app/or-app.html b/client/src/main/webapp/src/or-app/or-app.htmlindex 0c8dead7d..34e99560e 100644--- a/client/src/main/webapp/src/or-app/or-app.html+++ b/client/src/main/webapp/src/or-app/or-app.html@@ -5,7 +5,7 @@<link rel="import" href="or-shell-native.html"><link rel="import" href="or-app-security.html"><link rel="import" href="or-app-events.html">-<link rel="import" href="or-view-component.html">+<link rel="import" href="or-component.html"><!-- Promise API polyfill on IE 11 --><script src="/static/3rdparty/es6-promise.js"></script>diff --git a/client/src/main/webapp/src/or-app/or-component.html b/client/src/main/webapp/src/or-app/or-component.htmlnew file mode 100644index 000000000..2cced393a--- /dev/null+++ b/client/src/main/webapp/src/or-app/or-component.html@@ -0,0 +1,178 @@+<!-- sprintf for formatting asset attribute values -->+<script src="/static/3rdparty/sprintf/1.0.3/sprintf.min.js"></script>++<!-- Moment.js because we need a proper time/date API -->+<script src="/static/bower_components/moment/moment.js"></script>++<!-- URL/page routing -->+<link rel="import" href="/static/bower_components/app-route/app-location.html">++<!-- Intl polyfill -->+<script src="/static/bower_components/intl/dist/Intl.js"></script>++<!-- Intl langage TODO How can we do this dynamically? -->+<script src="/static/bower_components/intl/locale-data/jsonp/en.js"></script>++<!-- Provides Polymer.AppLocalizeBehavior -->+<link rel="import" href="/static/bower_components/app-localize-behavior/app-localize-behavior.html">++<dom-module id="or-component">+ <script>+ class OpenRemoteComponent extends Polymer.mixinBehaviors([Polymer.AppLocalizeBehavior], Polymer.Element) {+ static get properties() {+ return {+ appLocation: {+ type: Object,+ observer: "onAppLocationChange"+ },+ /**+ * The name of the active view (#view hash in window location).+ */+ view: {+ type: String+ },+ /**+ * The name of the active sub-view (#view:subView hash in window location).+ */+ subView: {+ type: String+ },+ /**+ * The default view if no view hash is in window location URL. Override in subclass.+ */+ defaultView: {+ type: String+ },+ widgetStyle: {+ type: openremote.style.WidgetStyle,+ value: () => {+ return openremote.WIDGET_STYLE+ }+ },+ // Default language for localize()+ language: {+ type: String,+ value: () => {+ let defaultLang = "en";+ let metas = document.getElementsByTagName('meta');+ if (metas) {+ for (let i = 0; i < metas.length; i++) {+ let meta = metas[i];+ if (meta.attributes.name &&+ meta.attributes.name.value === "or-language" &&+ meta.attributes.content &&+ meta.attributes.content.value) {+ return meta.attributes.content.value;+ }+ }+ }+ return defaultLang;+ }+ },+ // Yes, we want the key returned if localize(key) can't find an alternative...+ useKeyIfMissing: {+ type: Boolean,+ value: true+ },+ // URL of locales.json to load+ localesResource: {+ type: String+ }+ }+ }++ ready() {+ super.ready();++ // Load locales resources for localize() function+ if (this.loadResources) {+ if (this.localesResource) {+ this.loadResources(this.resolveUrl(this.localesResource));+ }+ } else {+ console.error("Missing Polymer.AppLocalizeBehavior, did you load the component?");+ }++ // View component is hidden until connected to DOM+ this.hideComponent();+ }++ connectedCallback() {+ super.connectedCallback();++ // Show component after next render, this prevents flickering+ Polymer.RenderStatus.afterNextRender(this, function() {+ this.showComponent();+ });+ }++ onAppLocationChange(appLocation) {+ // TODO The "state" case is a bug in Keycloak 2.x with Firefox that's difficult to track down+ if ((!appLocation.path || appLocation.path.startsWith('state')) && this.defaultView) {+ window.location.hash = "#" + this.defaultView+ } else {+ let views = appLocation.path.split(":");+ this.set("view", views.length >= 1 ? views[0] : undefined);+ this.set("subView", views.length >= 2 ? views[1] : undefined);+ }+ }++ isActiveView(activeView, view) {+ return activeView === view;+ }++ showComponent() {+ this.shadowRoot.host.style.visibility = "visible";+ }++ hideComponent() {+ this.shadowRoot.host.style.visibility = "hidden";+ }++ // GWT i18n resources, not the same as app-localize-behavior and localize()+ i18n(presenter, key) {+ return presenter ? presenter.messages()[key]() : "";+ }++ icon(name) {+ return "or-Icon fa fa-" + name;+ }++ setError(e) {+ openremote.INSTANCE.set("error", e);+ }++ getUserId() {+ return openremote.INSTANCE.getSecurity().getUserId();+ }++ logout() {+ openremote.INSTANCE.logout();+ }++ requests() {+ return openremote.INSTANCE.requests;+ }++ subscribeAttributeEvents(subscribedAssetIds) {+ openremote.INSTANCE.getServiceEvents().subscribeAttributeEvents(subscribedAssetIds);+ }++ addAttributeEventListener(listener) {+ openremote.INSTANCE.getServiceEvents().addEventListener("attribute", listener);+ }++ sendAttributeEvent(assetId, attributeName, value) {+ openremote.INSTANCE.getServiceEvents().sendAttributeEvent(+ assetId, attributeName, value+ );+ }++ formatAttributeValue(formatString, value, defaultLabel) {+ return value ? sprintf(formatString, value) : (defaultLabel ? defaultLabel : "-");+ }++ }+ </script>++</dom-module>\ No newline at end of filediff --git a/client/src/main/webapp/src/or-app/or-style.html b/client/src/main/webapp/src/or-app/or-style.htmlindex 21168dbc1..d8c60c3f5 100644--- a/client/src/main/webapp/src/or-app/or-style.html+++ b/client/src/main/webapp/src/or-app/or-style.html@@ -39,8 +39,9 @@}.or-NavItem {- margin: 0.4em 1.2em 0 1.2em;- font-size: 1.1em;+ margin: 0.4em 1.2em 0 1.2em !important;+ padding: 0.4em !important;+ font-size: 1.1em !important;border-radius: 0 !important;border-bottom: 0.4em solid transparent;border-top: 0.2em solid transparent;@@ -126,8 +127,9 @@-ms-user-select: none; /* IE/Edge */-webkit-touch-callout: none; /* iOS Safari */cursor: pointer;- padding: 0.4em;+ padding: 0 0.4em;border-radius: 0.15em;+ font-size: inherit;font-weight: 600;display: inline-block;white-space: nowrap;@@ -158,10 +160,6 @@opacity: inherit;}- .or-PushButtonIcon + .html-face:not(:empty) {- margin-left: 0.6em;- }-.or-PushButton.or-PushButton-up-disabled {cursor: not-allowed;opacity: .44;@@ -173,6 +171,14 @@filter: inherit;}+ .or-PushButton .or-Icon {+ margin: 0;+ }++ .or-PushButton .or-Icon + .html-face:not(:empty) {+ margin-left: 0.4em;+ }+.or-Divider {min-height: 0.1em;margin: 1em 0;@@ -184,10 +190,6 @@white-space: nowrap;}- .or-HyperlinkIcon {- width: 0.8em;- }-.or-Hyperlink a,.or-Hyperlink a:visited,.or-FormAnchor,@@ -196,7 +198,7 @@font-weight: 600;text-decoration: none;display: inline-block;- padding: 0.4em 0.8em;+ padding: 0.4em 0;border-radius: 0.2em;}@@ -228,7 +230,7 @@margin: 0 0 0.8em 0;}- .or-HeadlineIcon,+ .or-Headline .or-Icon,.or-HeadlineText {font-size: x-large !important;}@@ -237,10 +239,6 @@font-weight: 600;}- .or-HeadlineIcon {- margin-right: 0.4em;- }-.or-HeadlineSub {font-size: smaller;font-weight: 600;@@ -254,10 +252,6 @@white-space: nowrap;}- .or-MessagesIcon {- font-size: larger;- }-.or-Form {transition: opacity 0.1s linear;-moz-transition: opacity 0.1s linear;@@ -279,8 +273,8 @@margin: 1em;}- .or-Toast .or-MessagesIcon,- .or-FormMessages .or-MessagesIcon {+ .or-Toast .or-Icon,+ .or-FormMessages .or-Icon {margin: 0em 0.4em 0 0;}@@ -331,17 +325,6 @@overflow: hidden;}- .or-FormLabelIcon {- margin-right: 0.4em;- font-size: 1.2em;- opacity: 0.4;- align-self: flex-end;- }-- .or-FormInlineLabelIcon {- margin-right: 0.4em;- }-.or-FormLabel.inline {width: inherit;}@@ -562,11 +545,6 @@font-weight: 600;}- .or-FormTreeIcon {- margin-left: 0.4em;- width: 1.6em;- }-.or-FormList {overflow: auto;}@@ -667,7 +645,7 @@line-height: 1;outline: 0;border: 0;- border-radius: 0;+ border-radius: 0.15em;appearance: none;-webkit-appearance: none;-moz-appearance: none;@@ -677,8 +655,8 @@-webkit-tap-highlight-color: transparent;}- .or-Select select::-ms-expand {- display: none;+ .or-Select select option {+ padding-top: 0.4em;}.or-Select select:disabled {@@ -722,6 +700,7 @@content: '';vertical-align: text-top;pointer-events: none;+ border-radius: 0.15em;}.or-CheckBox:checked + label:after {@@ -737,23 +716,23 @@.or-Icon {display: inline-block;- margin: 0 0.3em;+ margin-right: 0.4em;}.or-Input {font-family: 'Open Sans', 'Roboto', Helvetica, Arial, Lucida, sans-serif;}- .or-InputTime {+ .or-InputTime,+ .or-InputDate {font-weight: 600;font-size: 1em;cursor: pointer;white-space: nowrap;min-height: 1.5em;- max-width: 5.5em;padding: 0 0.4em;border: 0;- border-radius: 0;+ border-radius: 0.15em;appearance: none;-webkit-appearance: none;-moz-appearance: none;@@ -762,9 +741,11 @@-webkit-box-sizing: content-box;;}- .or-InputTime::-webkit-clear-button,- .or-InputTime::-webkit-inner-spin-button {- display: none;+ .or-InputTime::-webkit-datetime-edit,+ .or-InputDate::-webkit-datetime-edit {+ margin: 0;+ padding: 0;+ max-width: 5.8em;}.or-InputTime::-webkit-datetime-edit-text,@@ -778,7 +759,45 @@.or-InputTime::-webkit-datetime-edit-month-field,.or-InputTime::-webkit-datetime-edit-second-field,.or-InputTime::-webkit-datetime-edit-week-field,- .or-InputTime::-webkit-datetime-edit-year-field{+ .or-InputTime::-webkit-datetime-edit-year-field,+ .or-InputDate::-webkit-datetime-edit-text,+ .or-InputDate::-webkit-datetime-edit-fields-wrapper,+ .or-InputDate::-webkit-date-and-time-value,+ .or-InputDate::-webkit-datetime-edit-ampm-field,+ .or-InputDate::-webkit-datetime-edit-day-field,+ .or-InputDate::-webkit-datetime-edit-hour-field,+ .or-InputDate::-webkit-datetime-edit-millisecond-field,+ .or-InputDate::-webkit-datetime-edit-minute-field,+ .or-InputDate::-webkit-datetime-edit-month-field,+ .or-InputDate::-webkit-datetime-edit-second-field,+ .or-InputDate::-webkit-datetime-edit-week-field,+ .or-InputDate::-webkit-datetime-edit-year-field {+ margin: 0;+ padding: 0;+ }++ .or-InputTime::-webkit-clear-button,+ .or-InputDate::-webkit-clear-button {+ margin: 0 0.4em 0 0;+ }++ .or-InputTime[required]::-webkit-clear-button,+ .or-InputDate[required]::-webkit-clear-button,+ .or-InputTime::-webkit-inner-spin-button,+ .or-InputDate::-webkit-inner-spin-button {+ display: none;+ }++ .or-InputTime {+ max-width: 5.5em;+ }++ .or-InputDate {+ min-width: 0.7em;+ max-width: 8em;+ }++ .or-InputDate::-webkit-calendar-picker-indicator {margin: 0;padding: 0;}diff --git a/client/src/main/webapp/src/or-app/or-theme.html b/client/src/main/webapp/src/or-app/or-theme.htmlindex d82509400..46c54976c 100644--- a/client/src/main/webapp/src/or-app/or-theme.html+++ b/client/src/main/webapp/src/or-app/or-theme.html@@ -182,6 +182,10 @@color: var(--theme-darkgrey);}+ .or-FormLabel .or-Icon {+ color: var(--theme-lightgrey);+ }+.or-FormField {}@@ -298,7 +302,7 @@background-color: var(--theme-mediumgrey);}- .or-FormTreeKeyboardSelectedItem .or-FormTreeIcon {+ .or-FormTreeKeyboardSelectedItem .or-Icon {color: var(--theme-white);}@@ -318,7 +322,7 @@color: var(--theme-lightgreen);}- .or-FormTreeIcon {+ .or-FormTreeItem .or-Icon {color: var(--theme-mediumgrey);}@@ -468,11 +472,29 @@background-color: var(--theme-mediumgrey);}- .or-InputTime {+ .or-InputTime,+ .or-InputDate {+ background-color: var(--theme-black);+ color: var(--theme-lightgreen);+ }++ .or-InputTime[required],+ .or-InputDate[required] {background-color: var(--theme-lightgreen);color: var(--theme-black);}+ .or-InputTime[empty],+ .or-InputDate[empty] {+ background-color: var(--theme-lightergrey);+ color: var(--theme-mediumgrey);+ }++ .or-InputDate::-webkit-calendar-picker-indicator {+ background: transparent;+ color: var(--theme-mediumgrey);+ }+</style></template></dom-module>\ No newline at end of filediff --git a/client/src/main/webapp/src/or-app/or-view-component.html b/client/src/main/webapp/src/or-app/or-view-component.htmldeleted file mode 100644index bca908090..000000000--- a/client/src/main/webapp/src/or-app/or-view-component.html+++ /dev/null@@ -1,90 +0,0 @@-<!-- Intl polyfill -->-<script src="/static/bower_components/intl/dist/Intl.js"></script>--<!-- Intl langage TODO How can we do this dynamically? -->-<script src="/static/bower_components/intl/locale-data/jsonp/en.js"></script>--<!-- Provides Polymer.AppLocalizeBehavior -->-<link rel="import" href="/static/bower_components/app-localize-behavior/app-localize-behavior.html">--<dom-module id="or-view-component">- <script>- class OpenRemoteViewComponent extends Polymer.mixinBehaviors([Polymer.AppLocalizeBehavior], Polymer.Element) {- static get properties() {- return {- widgetStyle: {- type: openremote.style.WidgetStyle,- value: () => {- return openremote.WIDGET_STYLE- }- },- // Default language for localize()- language: {- type: String,- value: () => {- let defaultLang = "en";- let metas = document.getElementsByTagName('meta');- if (metas) {- for (let i = 0; i < metas.length; i++) {- let meta = metas[i];- if (meta.attributes.name &&- meta.attributes.name.value === "or-language" &&- meta.attributes.content &&- meta.attributes.content.value) {- return meta.attributes.content.value;- }- }- }- return defaultLang;- }- },- // Yes, we want the key returned if localize(key) can't find an alternative...- useKeyIfMissing: {- type: Boolean,- value: true- },- // URL of locales.json to load- localesResource: {- type: String- }- }- }-- ready() {- super.ready();-- // Load locales resources for localize() function- if (this.loadResources) {- if (this.localesResource) {- this.loadResources(this.resolveUrl(this.localesResource));- }- } else {- console.error("Missing Polymer.AppLocalizeBehavior, did you load the component?");- }-- // View component is hidden by default, subclass decides when it's ready- this.hideComponent();- }-- // Subclass MUST call this at some point, usually in overriding connectedCallback()- showComponent() {- this.shadowRoot.host.style.visibility = "visible";- }-- hideComponent() {- this.shadowRoot.host.style.visibility = "hidden";- }-- // GWT i18n resources, not the same as app-localize-behavior and localize()- i18n(presenter, key) {- return presenter ? presenter.messages()[key]() : "";- }-- icon(name) {- return "fa fa-" + name;- }-- }- </script>--</dom-module>\ No newline at end of filediff --git a/client/src/main/webapp/src/or-asset-list/or-asset-list.html b/client/src/main/webapp/src/or-asset-list/or-asset-list.htmlindex 7ae64dd61..500fd2e15 100644--- a/client/src/main/webapp/src/or-asset-list/or-asset-list.html+++ b/client/src/main/webapp/src/or-asset-list/or-asset-list.html@@ -10,7 +10,7 @@</template><script>- class OpenRemoteAssetList extends OpenRemoteViewComponent {+ class OpenRemoteAssetList extends OpenRemoteComponent {static get is() {return "or-asset-list";diff --git a/deployment/manager/consoles/customerA/.bowerrc b/deployment/manager/consoles/customerA/.bowerrcindex 4f776c251..2ce13e005 100644--- a/deployment/manager/consoles/customerA/.bowerrc+++ b/deployment/manager/consoles/customerA/.bowerrc@@ -3,6 +3,8 @@"polymer","iron-flex-layout","app-localize-behavior",+ "app-route",+ "moment","intl","chart.js"]diff --git a/deployment/manager/consoles/customerA/bower.json b/deployment/manager/consoles/customerA/bower.jsonindex d446f1796..91fcc18ad 100644--- a/deployment/manager/consoles/customerA/bower.json+++ b/deployment/manager/consoles/customerA/bower.json@@ -16,7 +16,5 @@"tests"],"dependencies": {- "app-route": "PolymerElements/app-route#^2.0.3",- "moment": "moment#^2.20.1"}}\ No newline at end of filediff --git a/deployment/manager/consoles/customerA/smart-home/locales.json b/deployment/manager/consoles/customerA/smart-home/locales.jsonindex 8badc0f4c..c8f1b4443 100644--- a/deployment/manager/consoles/customerA/smart-home/locales.json+++ b/deployment/manager/consoles/customerA/smart-home/locales.json@@ -13,9 +13,9 @@"Away": "Weg","Evening": "Avond","Night": "Nacht",- "Smart Switch A": "Afwas",- "Smart Switch B": "Was",- "Smart Switch C": "Droger",+ "Switch A": "Afwas",+ "Switch B": "Was",+ "Switch C": "Droger","Now on": "Nu aan","On at": "Aan om","Ready at": "Klaar om",@@ -40,6 +40,6 @@"Auto": "Auto","Low": "Laag","Medium": "Medium",- "High": "Hoge"+ "High": "Hoog"}}diff --git a/deployment/manager/consoles/customerA/smart-home/smart-home-app.html b/deployment/manager/consoles/customerA/smart-home/smart-home-app.htmlindex 32681b234..92f92c1b0 100644--- a/deployment/manager/consoles/customerA/smart-home/smart-home-app.html+++ b/deployment/manager/consoles/customerA/smart-home/smart-home-app.html@@ -1,11 +1,7 @@<!-- The OpenRemote web components --><link rel="import" href="/static/src/or-app/or-app.html">-<!-- Dependencies of this app -->-<script src="/static/3rdparty/sprintf/1.0.3/sprintf.min.js"></script>-<script src="../bower_components/moment/moment.js"></script>--<link rel="import" href="../bower_components/app-route/app-location.html">+<!-- You can add other dependencies in bower.json and then load them here --><link rel="import" href="smart-home-component.html"><link rel="import" href="smart-home-style.html">@@ -29,7 +25,7 @@<template is="dom-if" if="[[!isActiveView(view, 'settings')]]"><slot slot="leftItem"name="logo">- <a href="https://www.openremote.com/"+ <a href="http://www.openremote.com/"class="layout horizontal center"style=" text-decoration: none;"><svg style="pointer-events: none; display: block; width: 2em; height:2em; margin-right: 0.4em;"@@ -45,14 +41,14 @@</a></slot><a slot="rightItem"- href="#settings"><span class="or-Icon fa fa-cog"></span></a>+ href="#settings"><span class$="[[icon('cog')]]"></span></a></template><template is="dom-if" if="[[isActiveView(view, 'settings')]]"><a slot="leftItem"- href="#scenes"><span class="or-Icon fa fa-arrow-left"></span>[[localize('Settings')]]</a>+ href="#scenes"><span class$="[[icon('arrow-left')]]"></span>[[localize('Settings')]]</a><div slot="rightItem"- on-click="logout"><span class="or-Icon fa fa-sign-out"></span>[[localize('Log out')]]+ on-click="logout"><span class$="[[icon('sign-out')]]"></span>[[localize('Log out')]]</div></template>@@ -89,21 +85,12 @@static get properties() {return {- appLocation: {- type: Object,- observer: "onAppLocationChange"- },- /**- * The name of the active view (#view hash in window location).- */- view: {- type: String- },/**- * The name of the active sub-view (#view:subView hash in window location).+ * The default start page.*/- subView: {- type: String+ defaultView: {+ type: String,+ value: "scenes"},/*** The residence asset of the current user.@@ -124,21 +111,19 @@ready() {super.ready();- this.shadowRoot.host.classList.add("flex", "layout", "vertical");-console.log("Ready, initialising application state");- openremote.INSTANCE.requests.sendAndReturn(+ this.requests().sendAndReturn((requestParams) => {let query = {select: {include: "ALL"},- userId: openremote.INSTANCE.getSecurity().getUserId()+ userId: this.getUserId()}openremote.REST.AssetResource.queryAssets(requestParams, query);},200,(response) => {if (!response) {- openremote.INSTANCE.set("error", "No assets assigned to user.");+ this.setError("error", "No assets assigned to user.");return;}response.forEach(asset => {@@ -153,42 +138,22 @@}})if (!this.residence) {- openremote.INSTANCE.set("error", "No residence asset found for user.");+ this.setError("No residence asset found for user.");}// Subscribe to attribute events on residence and all rooms- openremote.INSTANCE.getServiceEvents().addEventListener("attribute", e => {+ this.addAttributeEventListener(e => {this.onServiceAttributeEvent(e.detail);});let subscribedAssetIds = [this.residence.id];this.rooms.forEach(room => {subscribedAssetIds.push(room.id);})- openremote.INSTANCE.getServiceEvents().subscribeAttributeEvents(subscribedAssetIds);+ this.subscribeAttributeEvents(subscribedAssetIds);});}- connectedCallback() {- super.connectedCallback();- this.showComponent();- }-- onAppLocationChange(appLocation) {- // TODO The "state" case is a bug in Keycloak 2.x with Firefox that's difficult to track down- if (!appLocation.path || appLocation.path.startsWith('state')) {- window.location.hash = "#scenes" // Default page- } else {- let views = appLocation.path.split(":");- this.set("view", views.length >= 1 ? views[0] : undefined);- this.set("subView", views.length >= 2 ? views[1] : undefined);- }- }-- isActiveView(activeView, view) {- return activeView === view;- }-onServiceAttributeEvent(e) {// Use attribute event to update residence or room asset attribute value/valueTimestampif (!e.attributeState)@@ -210,10 +175,6 @@}});}-- logout() {- openremote.INSTANCE.logout();- }}defineAppElement(SmartHomeApp, SmartHomeApp.is, "SmartHomeApp");diff --git a/deployment/manager/consoles/customerA/smart-home/smart-home-body.html b/deployment/manager/consoles/customerA/smart-home/smart-home-body.htmlindex b870a4e99..43b5f86d2 100644--- a/deployment/manager/consoles/customerA/smart-home/smart-home-body.html+++ b/deployment/manager/consoles/customerA/smart-home/smart-home-body.html@@ -21,12 +21,7 @@ready() {super.ready();- this.shadowRoot.host.classList.add("flex", "layout", "vertical", "scroll");- }-- connectedCallback() {- super.connectedCallback();- this.showComponent();+ this.shadowRoot.host.classList.add("scroll");}}diff --git a/deployment/manager/consoles/customerA/smart-home/smart-home-climate.html b/deployment/manager/consoles/customerA/smart-home/smart-home-climate.htmlindex db3115990..ca8be1a98 100644--- a/deployment/manager/consoles/customerA/smart-home/smart-home-climate.html+++ b/deployment/manager/consoles/customerA/smart-home/smart-home-climate.html@@ -39,7 +39,7 @@<div class="flex layout horizontal center roomLabel">[[localize(item.roomName)]]</div>- <template is="dom-if" if="[[item.targetTemperature]]">+ <template is="dom-if" if="[[item.roomHasTargetTemperature]]"><div class="targetTemperature"><div class="or-Select"><select value="{{item.targetTemperature::change}}"@@ -132,9 +132,11 @@</div></div></template>- <div class="attributeValue">- [[formatAttributeValue(item.currentTemperatureFormat, item.currentTemperature)]]- </div>+ <template is="dom-if" if="[[item.roomHasCurrentTemperature]]">+ <div class="attributeValue">+ [[formatAttributeValue(item.currentTemperatureFormat, item.currentTemperature)]]+ </div>+ </template></div></template></smart-home-section>@@ -230,17 +232,7 @@]}- ready() {- super.ready();- this.shadowRoot.host.classList.add("flex", "layout", "vertical");- }-- connectedCallback() {- super.connectedCallback();- this.showComponent();- }-- computeRoomsTemperature(targetTemperateOptions) {+ computeRoomsTemperature() {let roomsTemperature = [];if (!this.rooms)return roomsTemperature;@@ -249,10 +241,20 @@roomsTemperature.push({roomId: room.id,roomName: room.name,- currentTemperature: room.attributes.currentTemperature ? room.attributes.currentTemperature.value : null,- currentTemperatureFormat: room.attributes.currentTemperature.meta.filter(m => m.name === "urn:openremote:asset:meta:format").map(m => m.value)[0],- targetTemperature: room.attributes.targetTemperature ? room.attributes.targetTemperature.value : null,- targetTemperatureFormat: room.attributes.targetTemperature ? room.attributes.targetTemperature.meta.filter(m => m.name === "urn:openremote:asset:meta:format").map(m => m.value)[0] : null,+ roomHasCurrentTemperature: "currentTemperature" in room.attributes,+ currentTemperature: room.attributes.currentTemperature+ ? room.attributes.currentTemperature.value+ : null,+ currentTemperatureFormat: room.attributes.currentTemperature+ ? room.attributes.currentTemperature.meta.filter(m => m.name === "urn:openremote:asset:meta:format").map(m => m.value)[0]+ : null,+ roomHasTargetTemperature: "targetTemperature" in room.attributes,+ targetTemperature: room.attributes.targetTemperature+ ? room.attributes.targetTemperature.value+ : null,+ targetTemperatureFormat: room.attributes.targetTemperature+ ? room.attributes.targetTemperature.meta.filter(m => m.name === "urn:openremote:asset:meta:format").map(m => m.value)[0]+ : null,});}})@@ -293,11 +295,7 @@return roomsHumidity;}- formatAttributeValue(formatString, value) {- return value ? sprintf(formatString, value) : "-";- }-- onResidenceChange(changeRecord) {+ onResidenceChange() {let ventilationMode = null;if ("ventilationAuto" in this.residence.attributes && this.residence.attributes.ventilationAuto.value) {ventilationMode = "AUTO";@@ -316,19 +314,15 @@}onTargetTemperatureChange(e) {- // Must use async operation as roomTemperature.targetTemperature will only be set after this listener returns- setTimeout(() => {- let roomTemperature = e.model.item;- openremote.INSTANCE.getServiceEvents().sendAttributeEvent(- roomTemperature.roomId, "targetTemperature", parseInt(roomTemperature.targetTemperature)- );- }, 1);+ this.sendAttributeEvent(+ e.model.item.roomId, "targetTemperature", parseInt(e.target.value)+ );}onVentilationModeChange() {if (this.ventilationMode === "AUTO") {if (!this.residence.attributes.ventilationAuto.value) {- openremote.INSTANCE.getServiceEvents().sendAttributeEvent(+ this.sendAttributeEvent(this.residence.id, "ventilationAuto", true);}@@ -344,13 +338,13 @@}if (this.residence.attributes.ventilationAuto.value) {- openremote.INSTANCE.getServiceEvents().sendAttributeEvent(+ this.sendAttributeEvent(this.residence.id, "ventilationAuto", false);}if (this.residence.attributes.ventilationLevel.value !== ventilationLevel) {- openremote.INSTANCE.getServiceEvents().sendAttributeEvent(+ this.sendAttributeEvent(this.residence.id, "ventilationLevel", ventilationLevel);}diff --git a/deployment/manager/consoles/customerA/smart-home/smart-home-component.html b/deployment/manager/consoles/customerA/smart-home/smart-home-component.htmlindex de255ce35..50ba7910e 100644--- a/deployment/manager/consoles/customerA/smart-home/smart-home-component.html+++ b/deployment/manager/consoles/customerA/smart-home/smart-home-component.html@@ -1,6 +1,7 @@<dom-module id="smart-home-component"><script>- class SmartHomeComponent extends OpenRemoteViewComponent {+ class SmartHomeComponent extends OpenRemoteComponent {+static get properties() {return {localesResource: {@@ -9,6 +10,11 @@}}}++ ready() {+ super.ready();+ this.shadowRoot.host.classList.add("layout", "vertical");+ }}</script></dom-module>diff --git a/deployment/manager/consoles/customerA/smart-home/smart-home-energy.html b/deployment/manager/consoles/customerA/smart-home/smart-home-energy.htmlindex 46557595b..c1b5cd7e4 100644--- a/deployment/manager/consoles/customerA/smart-home/smart-home-energy.html+++ b/deployment/manager/consoles/customerA/smart-home/smart-home-energy.html@@ -121,34 +121,24 @@}}- ready() {- super.ready();- this.shadowRoot.host.classList.add("flex", "layout", "vertical");- }-- connectedCallback() {- super.connectedCallback();- this.showComponent();- }-- computeSmartSwitches(rooms) {+ computeSmartSwitches() {let smartSwitches = [];if (!this.rooms)return smartSwitches;this.rooms.forEach(room => {if ("smartSwitchModeA" in room.attributes && "smartSwitchBeginEndA" in room.attributes) {smartSwitches.push(- this.computeSmartSwitch(room.id, this.localize("Smart Switch A"), "A", room.attributes.smartSwitchModeA.value, room.attributes.smartSwitchBeginEndA.value)+ this.computeSmartSwitch(room.id, this.localize("Switch A"), "A", room.attributes.smartSwitchModeA.value, room.attributes.smartSwitchBeginEndA.value));}if ("smartSwitchModeB" in room.attributes && "smartSwitchBeginEndB" in room.attributes) {smartSwitches.push(- this.computeSmartSwitch(room.id, this.localize("Smart Switch B"), "B", room.attributes.smartSwitchModeB.value, room.attributes.smartSwitchBeginEndB.value)+ this.computeSmartSwitch(room.id, this.localize("Switch B"), "B", room.attributes.smartSwitchModeB.value, room.attributes.smartSwitchBeginEndB.value));}if ("smartSwitchModeC" in room.attributes && "smartSwitchBeginEndC" in room.attributes) {smartSwitches.push(- this.computeSmartSwitch(room.id, this.localize("Smart Switch C"), "C", room.attributes.smartSwitchModeC.value, room.attributes.smartSwitchBeginEndC.value)+ this.computeSmartSwitch(room.id, this.localize("Switch C"), "C", room.attributes.smartSwitchModeC.value, room.attributes.smartSwitchBeginEndC.value));}})@@ -168,47 +158,40 @@}onSmartSwitchModeChange(e) {- // Must use async operation as smartSwitch.mode will only be set after this listener returns- setTimeout(() => {- let smartSwitch = e.model.item;-- openremote.INSTANCE.getServiceEvents().sendAttributeEvent(- smartSwitch.roomId, "smartSwitchMode" + smartSwitch.suffix, smartSwitch.mode- );-- let beginEndTimestamp = this.computeSmartSwitchBeginEndTimestamp(smartSwitch.mode, smartSwitch.hourMinute);- openremote.INSTANCE.getServiceEvents().sendAttributeEvent(- smartSwitch.roomId, "smartSwitchBeginEnd" + smartSwitch.suffix, beginEndTimestamp- );- }, 1);+ let smartSwitch = e.model.item;+ let smartSwitchMode = e.target.value; // model.item.mode is not updated yet when this event listener runs+ let beginEndTimestamp = this.computeSmartSwitchBeginEndTimestamp(smartSwitchMode, smartSwitch.hourMinute);++ this.sendAttributeEvent(+ smartSwitch.roomId, "smartSwitchMode" + smartSwitch.suffix, smartSwitchMode+ );+ this.sendAttributeEvent(+ smartSwitch.roomId, "smartSwitchBeginEnd" + smartSwitch.suffix, beginEndTimestamp+ );}onSmartSwitchHourMinuteChange(e) {- // Must use async operation as smartSwitch.hourMinute will only be set after this listener returns- setTimeout(() => {- let smartSwitch = e.model.item;-- // If entered time is empty, switch to now on- if (!smartSwitch.hourMinute) {- openremote.INSTANCE.getServiceEvents().sendAttributeEvent(- smartSwitch.roomId, "smartSwitchMode" + smartSwitch.suffix, "NOW_ON"- );- return;- }-- let beginEndTimestamp = this.computeSmartSwitchBeginEndTimestamp(smartSwitch.mode, smartSwitch.hourMinute);-- // Delay/debounce sending the change to service, the user is probably still editing- // the hour/minute (cursor keys, spinner button)- this.smartSwitchHourMinuteChangeDebouncer[smartSwitch] = Polymer.Debouncer.debounce(- this.smartSwitchHourMinuteChangeDebouncer[smartSwitch],- Polymer.Async.timeOut.after(3000),- () => {- openremote.INSTANCE.getServiceEvents().sendAttributeEvent(- smartSwitch.roomId, "smartSwitchBeginEnd" + smartSwitch.suffix, beginEndTimestamp+ let smartSwitch = e.model.item;+ let hourMinute = e.target.value; // model.item.hourMinute is not updated yet when this event listener runs+ let beginEndTimestamp = this.computeSmartSwitchBeginEndTimestamp(smartSwitch.mode, hourMinute);++ // Delay/debounce sending the change to service, the user is probably still editing+ // the hour/minute (cursor keys, spinner button)+ this.smartSwitchHourMinuteChangeDebouncer[smartSwitch] = Polymer.Debouncer.debounce(+ this.smartSwitchHourMinuteChangeDebouncer[smartSwitch],+ Polymer.Async.timeOut.after(3000),+ () => {+ // If entered time is empty, switch to now on+ if (!hourMinute) {+ this.sendAttributeEvent(+ smartSwitch.roomId, "smartSwitchMode" + smartSwitch.suffix, "NOW_ON");- });- }, 1);+ return;+ }+ this.sendAttributeEvent(+ smartSwitch.roomId, "smartSwitchBeginEnd" + smartSwitch.suffix, beginEndTimestamp+ );+ });}computeSmartSwitchBeginEndTimestamp(mode, hourMinute) {@@ -236,7 +219,7 @@}}- return hourMinuteMoment ? parseInt(hourMinuteMoment.format("x")) : null;+ return hourMinuteMoment ? hourMinuteMoment.valueOf() : null;}}diff --git a/deployment/manager/consoles/customerA/smart-home/smart-home-header.html b/deployment/manager/consoles/customerA/smart-home/smart-home-header.htmlindex dc2528077..7f6cd16f8 100644--- a/deployment/manager/consoles/customerA/smart-home/smart-home-header.html+++ b/deployment/manager/consoles/customerA/smart-home/smart-home-header.html@@ -85,13 +85,7 @@ready() {super.ready();-- this.shadowRoot.host.classList.add("flex-none", "layout", "vertical");- }-- connectedCallback() {- super.connectedCallback();- this.showComponent();+ this.shadowRoot.host.classList.add("flex-none");}getNavItemClass(active, item) {diff --git a/deployment/manager/consoles/customerA/smart-home/smart-home-scenes.html b/deployment/manager/consoles/customerA/smart-home/smart-home-scenes.htmlindex 54fca677c..d312e823f 100644--- a/deployment/manager/consoles/customerA/smart-home/smart-home-scenes.html+++ b/deployment/manager/consoles/customerA/smart-home/smart-home-scenes.html@@ -12,6 +12,7 @@width: 100px;height: 100px;margin: 10px;+ border-radius: 0.15em;cursor: pointer;-webkit-user-select: none;-moz-user-select: none;@@ -65,16 +66,6 @@return "smart-home-scenes";}- ready() {- super.ready();- this.shadowRoot.host.classList.add("flex", "layout", "vertical");- }-- connectedCallback() {- super.connectedCallback();- this.showComponent();- }-getItemClass(scene, item) {return scene === item? "layout horizontal center-center sceneItem active"@@ -84,7 +75,7 @@switchScene(e) {let sceneItem = Polymer.dom(e).localTarget;sceneItem.classList.add("selected");- openremote.INSTANCE.getServiceEvents().sendAttributeEvent(+ this.sendAttributeEvent(this.residence.id, sceneItem.id.toLowerCase() + "Scene", "REQUEST_START");}diff --git a/deployment/manager/consoles/customerA/smart-home/smart-home-section.html b/deployment/manager/consoles/customerA/smart-home/smart-home-section.htmlindex 3f7ee6ef0..d2489e468 100644--- a/deployment/manager/consoles/customerA/smart-home/smart-home-section.html+++ b/deployment/manager/consoles/customerA/smart-home/smart-home-section.html@@ -8,13 +8,56 @@background-color: var(--theme-white);border-radius: 10px;margin: 10px 10px 0 10px;+ -webkit-box-shadow: 4px 4px 15px 0px rgba(0, 0, 0, 0.2);+ -moz-box-shadow: 4px 4px 15px 0px rgba(0, 0, 0, 0.2);+ box-shadow: 4px 4px 15px 0px rgba(0, 0, 0, 0.2);+ }++ .title {padding: 10px;- -webkit-box-shadow: 4px 4px 15px 0px rgba(0,0,0,0.2);- -moz-box-shadow: 4px 4px 15px 0px rgba(0,0,0,0.2);- box-shadow: 4px 4px 15px 0px rgba(0,0,0,0.2);+ font-weight: 600;+ -webkit-user-select: none;+ -moz-user-select: none;+ -ms-user-select: none;+ user-select: none;+ cursor: pointer;+ color: var(--theme-darkgrey);+ }++ .content {+ padding: 10px;+ height: auto;+ overflow: auto;+ }++ .content[collapsed] {+ padding: 0;+ height: 0;+ overflow: hidden;+ }++ .expandCollapseIcon {+ text-align: right;+ color: var(--theme-darkgrey);}</style>- <slot></slot>++ <template is="dom-if" if="[[title]]">+ <div class="layout horizontal">+ <div class="flex layout horizontal center title"+ on-click="onTitleClicked">+ <span class="flex or-Icon"> </span>+ <span class="">[[title]]</span>+ <span class$="flex [[icon('plus')]] expandCollapseIcon" hidden$="[[!collapsed]]"></span>+ <span class$="flex [[icon('minus')]] expandCollapseIcon" hidden$="[[collapsed]]"></span>+ </div>+ </div>+ </template>++ <div class="layout vertical content" collapsed$="[[collapsed]]">+ <slot></slot>+ </div>+</template><script>@@ -23,14 +66,26 @@return "smart-home-section";}+ static get properties() {+ return {+ title: {+ type: String,+ reflectToAttribute:true+ },+ collapsed: {+ type: Boolean,+ value: false+ }+ }+ }+ready() {super.ready();- this.shadowRoot.host.classList.add("flex-none", "layout", "vertical");+ this.shadowRoot.host.classList.add("flex-none");}- connectedCallback() {- super.connectedCallback();- this.showComponent();+ onTitleClicked() {+ this.set("collapsed", !this.collapsed);}}diff --git a/deployment/manager/consoles/customerA/smart-home/smart-home-security.html b/deployment/manager/consoles/customerA/smart-home/smart-home-security.htmlindex ce2cbcc38..447f51b7c 100644--- a/deployment/manager/consoles/customerA/smart-home/smart-home-security.html+++ b/deployment/manager/consoles/customerA/smart-home/smart-home-security.html@@ -91,18 +91,8 @@}}- ready() {- super.ready();- this.shadowRoot.host.classList.add("flex", "layout", "vertical");- }-- connectedCallback() {- super.connectedCallback();- this.showComponent();- }-onAlarmEnabledChange() {- openremote.INSTANCE.getServiceEvents().sendAttributeEvent(+ this.sendAttributeEvent(this.residence.id, "alarmEnabled", this.$.alarmEnabled.checked);}diff --git a/deployment/manager/consoles/customerA/smart-home/smart-home-settings.html b/deployment/manager/consoles/customerA/smart-home/smart-home-settings.htmlindex 64ca29f8c..f81f1ee36 100644--- a/deployment/manager/consoles/customerA/smart-home/smart-home-settings.html+++ b/deployment/manager/consoles/customerA/smart-home/smart-home-settings.html@@ -5,12 +5,36 @@<dom-module id="smart-home-settings"><template><style include="smart-home-style">+ .infoLabel {+ font-size: smaller;+ font-style: italic;+ color: var(--theme-darkgrey);+ margin: 0.8em;+ }</style>- <smart-home-section class="center-center">- <div>[[residence.name]]</div>+ <smart-home-section title="[[localize('Vacation')]]">+ <div class="layout horizontal center">+ <div class="flex">[[localize('On vacation until')]]</div>+ <input class="or-Input or-InputDate"+ title="[[localize('End of vacation')]]"+ type="date"+ empty$="[[vacationUntilEmpty]]"+ value="[[vacationUntil]]"+ on-input="onVacationUntilChanged"/>+ </div>+ </smart-home-section>++ <smart-home-section title="[[localize('Weekly Schedule')]]" collapsed>+ TODO+ </smart-home-section>++ <smart-home-section title="[[localize('Scenes')]]" collapsed>+ TODO</smart-home-section>+ <div class="layout horizontal center-center infoLabel">[[residence.name]]</div>+</template><script>@@ -19,14 +43,41 @@return "smart-home-settings";}- ready() {- super.ready();- this.shadowRoot.host.classList.add("flex", "layout", "vertical");+ static get properties() {+ return {+ vacationUntilEmpty: {+ type: Boolean,+ computed: "computeVacationUntilEmpty(residence.*)"+ },+ vacationUntil: {+ type: String,+ computed: "computeVacationUntil(residence.*)"+ },+ smartSwitchHourMinuteChangeDebouncer: {+ type: Object,+ value: {}+ }+ }+ }++ computeVacationUntilEmpty() {+ return !this.residence.attributes.vacationUntil || !this.residence.attributes.vacationUntil.value;+ }++ computeVacationUntil() {+ return this.residence.attributes.vacationUntil && this.residence.attributes.vacationUntil.value+ ? moment(this.residence.attributes.vacationUntil.value).format("YYYY-MM-DD")+ : moment().add(7, "days").format("YYYY-MM-DD"); // Show 1 week in future if no vacation until set}- connectedCallback() {- super.connectedCallback();- this.showComponent();+ onVacationUntilChanged(e) {+ let vacationUntilMoment = moment(e.target.value, "YYYY-MM-DD");+ this.sendAttributeEvent(+ this.residence.id,+ "vacationUntil",+ // Vacation until must be in future or clear+ vacationUntilMoment.isAfter(moment()) ? vacationUntilMoment.valueOf() : undefined+ );}}diff --git a/deployment/manager/consoles/customerA/smart-home/smart-home-smart.html b/deployment/manager/consoles/customerA/smart-home/smart-home-smart.htmlindex 12b65242d..fa461b54e 100644--- a/deployment/manager/consoles/customerA/smart-home/smart-home-smart.html+++ b/deployment/manager/consoles/customerA/smart-home/smart-home-smart.html@@ -36,24 +36,13 @@ready() {super.ready();- this.shadowRoot.host.classList.add("flex-none", "layout", "vertical");+ this.shadowRoot.host.classList.add("flex-none");}- connectedCallback() {- super.connectedCallback();- this.showComponent();- }-- onSmartToggleChange() {- if (this.$.smartToggle.checked) {- openremote.INSTANCE.getServiceEvents().sendAttributeEvent(- this.residence.id, "enableSceneTimer", "REQUEST_START"- );- } else {- openremote.INSTANCE.getServiceEvents().sendAttributeEvent(- this.residence.id, "disableSceneTimer", "REQUEST_START"- );- }+ onSmartToggleChange(e) {+ this.sendAttributeEvent(+ this.residence.id, e.target.checked ? "enableSceneTimer" : "disableSceneTimer", "REQUEST_START"+ );}}diff --git a/deployment/manager/consoles/customerA/examples.html b/deployment/manager/consoles/master/examples.htmlsimilarity index 66%rename from deployment/manager/consoles/customerA/examples.htmlrename to deployment/manager/consoles/master/examples.htmlindex 369284f7c..e657d5b32 100644--- a/deployment/manager/consoles/customerA/examples.html+++ b/deployment/manager/consoles/master/examples.html@@ -14,31 +14,27 @@<!-- Optional: Load more application resources after authentication --><script>- window.addEventListener('AppReady', function (e) {+ window.addEventListener("AppReady", function (e) {console.log("Loading customerA console app resources...");let app = e.detail.app;// Load resources in parallelPromise.all([- app.load.css("/static/3rdparty/mapbox-gl-js/0.42.2/mapbox-gl.css"),- app.load.js("/static/3rdparty/mapbox-gl-js/0.42.2/mapbox-gl.js"),-- app.load.js("/static/bower_components/chart.js/dist/Chart.js"),-- app.load.js("/static/3rdparty/sprintf/1.0.3/sprintf.min.js")+ /*+ app.load.css("/console/master/something.css"),+ app.load.js("/console/master/something.js"),+ */]).then(() => {-/*// Load resources sequentiallyapp.load.js("/resource1").then(() => {- return app.load.js("/resource2")+ return app.load.js("/some/resource")}).catch(e => {app.set("error", e);});*/-}).catch(e => {app.set("error", e);});@@ -69,27 +65,18 @@<body class="layout vertical"><!-- ############## Required: One <or-app> should wrap your frontend, you can enforce login/authentication ############## -->-<or-app login tenant-realm="customerA">+<or-app login tenant-realm="master"><!-- With or-Viewport you get OpenRemote default fonts --><div class="flex layout vertical or-Viewport"><!-- You can use your own styles or the OpenRemote styles and theme --><a href="#" class="myAppHeadline">- The OpenRemote console application of the <code>customerA</code> tenant+ OpenRemote Console App Examples</a><!-- This is a container element that has some padding and visual separation from other containers --><div class="or-MainContent">-- <p>- On your OpenRemote installation, edit the HTML content in- <code>deployment/manager/consoles/customerA/</code>.- </p>- <p>- You can duplicate the <code>customerA</code> directory to create new console applications for other- tenants/realms.- </p><p>View the source in your web browser and follow the examples on this page to write your own OpenRemoteapplication, it's easy with <a href="https://www.webcomponents.org/">Web Components</a>.@@ -104,13 +91,12 @@<!-- Execute an asset query and show a nice scrollable list --><or-asset-list class="myAssetList flex or-MainContent or-FormList"- select-include="ALL_EXCEPT_PATH_AND_ATTRIBUTES"- asset-type="urn:openremote:asset:residence">+ select-include="ALL_EXCEPT_PATH_AND_ATTRIBUTES"><!-- Render each asset with a template --><template><div class="or-FormListItem layout horizontal center justified">- <div>Residence: {{asset.name}}</div>+ <div>Asset Name: {{asset.name}}</div><div>Parent: {{asset.parentName}}</div><div>Created On: {{asset.createdOn}}</div></div>@@ -121,12 +107,12 @@<!-- Execute an asset query and show a nice scrollable list --><or-asset-list class="myAssetList flex or-MainContent or-FormList"select-include="ALL_EXCEPT_PATH_AND_ATTRIBUTES"- asset-type="urn:openremote:asset:room">+ asset-type="urn:openremote:asset:building"><!-- Render each asset with a template --><template><div class="or-FormListItem layout horizontal center justified">- <div>Room: {{asset.name}}</div>+ <div>Asset Name: {{asset.name}}</div><div>Parent: {{asset.parentName}}</div><div>Created On: {{asset.createdOn}}</div></div>@@ -169,30 +155,88 @@</div>+ <!-- Use OpenRemote UI classes for pretty widgets --><div class="or-MainContent">- <div class="layout horizontal or-FormGroup">- <div class="or-FormField">+ <div class="layout vertical">- <button class="or-FormControl or-FormButton or-PushButton"+ <div class="layout horizontal center justified" style="margin: 1em;">++ <button class="or-PushButton"onclick="openremote.INSTANCE.toasts.showToast(new openremote.toast.Toast(openremote.toast.Toast.Type.SUCCESS,'Welcome ' + openremote.INSTANCE.user + ', on ' + openremote.INSTANCE.tenantRealm + '. It is ' + new Date() + '.',3000- )- )">Show a toast+ ))">+ <span class="or-Icon fa fa-eye"></span>+ <span class="html-face">Show toast</span></button>- <button class="or-FormControl or-FormButton or-PushButton"+ <button class="or-FormButtonPrimary or-PushButton"onclick="document.querySelectorAll('.myAssetList').forEach((assetList) => {assetList.executeQuery()})">- Refresh asset lists+ <span class="or-Icon fa fa-refresh"></span>+ <span class="html-face">Refresh asset list</span></button>- <button class="or-FormControl or-FormButtonDanger or-PushButton"- onclick="document.querySelector('or-app').logout()">Logout+ <button class="or-FormButtonDanger or-PushButton"+ onclick="document.querySelector('or-app').logout()">+ <span class="or-Icon fa fa-sign-out"></span>+ <span class="html-face">Logout</span></button>+ <div>+ <input class="or-CheckBox"+ id="toggle1"+ type="checkbox"/>+ <label for="toggle1"></label>+ </div>++ <div>+ <input class="or-CheckBox"+ id="toggle2"+ type="checkbox"+ checked/>+ <label for="toggle2"></label>+ </div>++ <div>+ <input class="or-CheckBox"+ id="toggle3"+ type="checkbox"+ disabled/>+ <label for="toggle3"></label>+ </div>++ <div>+ <input class="or-CheckBox"+ id="toggle4"+ type="checkbox"+ checked disabled/>+ <label for="toggle4"></label>+ </div>++ <div class="or-Select">+ <select title="Some single-select options">+ <option value="foo">Option Foo</option>+ <option value="bar">Option Bar</option>+ <option value="Baz">Option Baz</option>+ </select>+ </div>++ <input class="or-Input or-InputTime"+ title="Some time input"+ type="time"+ step="60"+ required+ value="14:23"/>++ <input class="or-Input or-InputDate"+ title="Some date input"+ type="date"+ value="2018-11-06"/>+</div>+</div></div>diff --git a/deployment/manager/consoles/master/index.html b/deployment/manager/consoles/master/index.htmlindex 1b1aa2d7d..0c6f8596d 100644--- a/deployment/manager/consoles/master/index.html+++ b/deployment/manager/consoles/master/index.html@@ -14,5 +14,8 @@<p>You can duplicate the <code>master</code> directory to create new console applications for other tenants/realms.</p>+<p>+ For more documentation, see <a href="examples.html">examples.html</a>.+</p></body></html>\ No newline at end of filediff --git a/keycloak/theme/account/account.ftl b/keycloak/theme/account/account.ftlindex 7981124bb..4e46e8648 100755--- a/keycloak/theme/account/account.ftl+++ b/keycloak/theme/account/account.ftl@@ -6,7 +6,7 @@<div class="flex or-MainContent"><div class="or-Headline">- <span class="or-HeadlineIcon fa fa-user"></span>+ <span class="or-Icon fa fa-user"></span><span class="or-HeadlineText">${msg("editAccountHtmlTitle")}</span><div class="or-HeadlineSub">* ${msg("requiredFields")}</div></div>@@ -68,12 +68,12 @@<button type="submit"class="or-FormControl or-FormButtonPrimary or-PushButton"name="submitAction" value="Save">- <span class="or-PushButtonIcon fa fa-save"></span><span class="html-face">${msg("doSave")}</span>+ <span class="or-Icon fa fa-save"></span><span class="html-face">${msg("doSave")}</span></button><button type="submit"class="or-FormControl or-FormButton or-PushButton"name="submitAction" value="Cancel">- <span class="or-PushButtonIcon fa fa-close"></span><span class="html-face">${msg("doCancel")}</span>+ <span class="or-Icon fa fa-close"></span><span class="html-face">${msg("doCancel")}</span></button></div></div>diff --git a/keycloak/theme/account/password.ftl b/keycloak/theme/account/password.ftlindex 9273009b7..840fab6e0 100755--- a/keycloak/theme/account/password.ftl+++ b/keycloak/theme/account/password.ftl@@ -6,7 +6,7 @@<div class="flex or-MainContent"><div class="or-Headline">- <span class="or-HeadlineIcon fa fa-key"></span>+ <span class="or-Icon fa fa-key"></span><span class="or-HeadlineText">${msg("changePasswordHtmlTitle")}</span></div>@@ -57,7 +57,7 @@<div class="or-FormField"><button type="submit" class="or-FormControl or-FormButtonPrimary or-PushButton"name="submitAction" value="Save">- <span class="or-PushButtonIcon fa fa-save"></span><span class="html-face">${msg("doSave")}</span>+ <span class="or-Icon fa fa-save"></span><span class="html-face">${msg("doSave")}</span></button></div></div>diff --git a/keycloak/theme/account/template.ftl b/keycloak/theme/account/template.ftlindex a175a30c1..def9c2ee2 100644--- a/keycloak/theme/account/template.ftl+++ b/keycloak/theme/account/template.ftl@@ -45,8 +45,8 @@<#if message?has_content><div style="max-width: 30em;" class="layout horizontal or-FormMessages ${message.type}">- <#if message.type=='success' ><div class="or-MessagesIcon fa fa-check"></div></#if>- <#if message.type=='error' ><div class="or-MessagesIcon fa fa-warning"></div></#if>+ <#if message.type=='success' ><div class="or-Icon fa fa-check"></div></#if>+ <#if message.type=='error' ><div class="or-Icon fa fa-warning"></div></#if>${message.summary}</div></#if>diff --git a/keycloak/theme/login/login.ftl b/keycloak/theme/login/login.ftlindex 66637f3d8..2f7edc72c 100755--- a/keycloak/theme/login/login.ftl+++ b/keycloak/theme/login/login.ftl@@ -64,11 +64,13 @@</div></div>- <div class="or-FormField">- <input class="or-FormControl or-FormButtonPrimary or-PushButton"+ <div class="or-FormField layout horizontal center-center">+ <button class="or-FormControl or-FormButtonPrimary or-PushButton"name="login"- type="submit"- value="${msg("doLogIn")}"/>+ type="submit">+ <span class="or-Icon fa fa-sign-in"></span>+ <span class="html-face">${msg("doLogIn")}</span>+ </button></div></div></form>diff --git a/keycloak/theme/login/template.ftl b/keycloak/theme/login/template.ftlindex f45b14edd..bb05a1bf9 100755--- a/keycloak/theme/login/template.ftl+++ b/keycloak/theme/login/template.ftl@@ -68,10 +68,10 @@<#if displayMessage && message?has_content><div class="layout horizontal or-FormMessages ${message.type}">- <#if message.type=='success' ><div class="or-MessagesIcon fa fa-check"></div></#if>- <#if message.type=='warning' ><div class="or-MessagesIcon fa fa-warning"></div></#if>- <#if message.type=='error' ><div class="or-MessagesIcon fa fa-warning"></div></#if>- <#if message.type=='info' ><div class="or-MessagesIcon fa fa-info"></div></#if>+ <#if message.type=='success' ><div class="or-Icon fa fa-check"></div></#if>+ <#if message.type=='warning' ><div class="or-Icon fa fa-warning"></div></#if>+ <#if message.type=='error' ><div class="or-Icon fa fa-warning"></div></#if>+ <#if message.type=='info' ><div class="or-Icon fa fa-info"></div></#if>${message.summary}</div></#if>diff --git a/manager/src/main/java/org/openremote/manager/setup/builtin/RulesDemoSetup.java b/manager/src/main/java/org/openremote/manager/setup/builtin/RulesDemoSetup.javaindex a2435733a..68d540ae6 100644--- a/manager/src/main/java/org/openremote/manager/setup/builtin/RulesDemoSetup.java+++ b/manager/src/main/java/org/openremote/manager/setup/builtin/RulesDemoSetup.java@@ -71,6 +71,20 @@ public class RulesDemoSetup extends AbstractManagerSetup {);apartmentActionsRulesetId = rulesetStorageService.merge(ruleset).getId();}+ try (InputStream inputStream = RulesDemoSetup.class.getResourceAsStream("/demo/rules/DemoResidenceNotifyAlarmTrigger.groovy")) {+ String rules = IOUtils.toString(inputStream, Charset.forName("utf-8"));+ Ruleset ruleset = new AssetRuleset(+ "Demo Residence - Notify Alarm Trigger", managerDemoSetup.apartment1Id, rules, Ruleset.Lang.GROOVY+ );+ apartmentActionsRulesetId = rulesetStorageService.merge(ruleset).getId();+ }+ try (InputStream inputStream = RulesDemoSetup.class.getResourceAsStream("/demo/rules/DemoResidenceSmartSwitch.groovy")) {+ String rules = IOUtils.toString(inputStream, Charset.forName("utf-8"));+ Ruleset ruleset = new AssetRuleset(+ "Demo Residence - Smart Start Switch", managerDemoSetup.apartment1Id, rules, Ruleset.Lang.GROOVY+ );+ apartmentActionsRulesetId = rulesetStorageService.merge(ruleset).getId();+ }// Apartment 2try (InputStream inputStream = RulesDemoSetup.class.getResourceAsStream("/demo/rules/DemoResidenceAllLightsOff.js")) {