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
UI updates: styling colour palette
Rich Turner85a15266c209
diff --git a/ui/component/core/src/index.ts b/ui/component/core/src/index.tsindex b052dcb7e..38168a9ed 100644--- a/ui/component/core/src/index.ts+++ b/ui/component/core/src/index.ts@@ -9,15 +9,18 @@ import i18nextXhr from "i18next-xhr-backend";import {AssetDescriptor, AttributeDescriptor, AttributeValueDescriptor, MetaItemDescriptor} from "@openremote/model";import * as Util from "./util";-export {Util}+export {Util};export const DefaultColor1: string = "#FFF"; // Header and panelsexport const DefaultColor2: string = "#F9F9F9"; // Backgroundexport const DefaultColor3: string = "#202020"; // Textexport const DefaultColor4: string = "#1B5630"; // Buttonsexport const DefaultColor5: string = "#CCC"; // Borders and lines-export const DefaultBoxShadow: string = "0 5px 5px -5px rgba(0,0,0,0.57)";+export const DefaultColor6: string = "#be0000"; // Invalid/Error+export const DefaultBoxShadowBottom: string = "0 5px 5px -5px rgba(0,0,0,0.57)";+export const DefaultBoxShadow: string = "0 1px 3px 0 rgba(0,0,0,0.21)";export const DefaultHeaderHeight: string = "60px";+export const DefaultDisabledOpacity: string = "0.3";export enum ORError {NONE = "NONE",diff --git a/ui/component/or-header/src/index.ts b/ui/component/or-header/src/index.tsindex 1b84cd8ea..6023cad8f 100644--- a/ui/component/or-header/src/index.ts+++ b/ui/component/or-header/src/index.ts@@ -22,7 +22,7 @@ class OrHeader extends LitElement {protected render() {return html`<!-- Header -->- <div id="header">+ <div id="header" class="shadow"><div id="toolbar-top"><div><img id="logo" src="${this.logo}" /></div><!-- This gets hidden on a small screen-->diff --git a/ui/component/or-header/src/style.ts b/ui/component/or-header/src/style.tsindex dfd197d37..60823515d 100644--- a/ui/component/or-header/src/style.ts+++ b/ui/component/or-header/src/style.ts@@ -1,5 +1,5 @@import {css, unsafeCSS} from "lit-element";-import {DefaultColor1, DefaultColor2, DefaultColor3, DefaultColor4, DefaultColor5, DefaultBoxShadow, DefaultHeaderHeight} from "@openremote/core";+import {DefaultColor1, DefaultColor2, DefaultColor3, DefaultColor4, DefaultColor5, DefaultBoxShadowBottom, DefaultHeaderHeight} from "@openremote/core";// language=CSSexport const style = css`@@ -44,7 +44,12 @@ export const style = css`--or-icon-height: calc(var(--internal-or-header-item-size) - 10px);--or-icon-width: calc(var(--internal-or-header-item-size) - 10px);z-index: 9999999;- box-shadow: ${unsafeCSS(DefaultBoxShadow)};+ }++ .shadow {+ -webkit-box-shadow: ${unsafeCSS(DefaultBoxShadowBottom)};+ -moz-box-shadow: ${unsafeCSS(DefaultBoxShadowBottom)};+ box-shadow: ${unsafeCSS(DefaultBoxShadowBottom)};}#drawer {diff --git a/ui/component/or-rules-editor/src/index.ts b/ui/component/or-rules-editor/src/index.tsindex 3fbd7662e..410034ef8 100644--- a/ui/component/or-rules-editor/src/index.ts+++ b/ui/component/or-rules-editor/src/index.ts@@ -409,15 +409,15 @@ class OrRulesEditor extends translate(i18next)(LitElement) {protected render() {return html`- <side-menu class="bg-white shadow">+ <div id="rule-list-container" class="shadow"><or-rule-list .rulesets="${this._rulesets}" .ruleset="${this.activeRuleset}" ></or-rule-list>- <div class="bottom-toolbar">+ <div id="bottom-toolbar">${openremote.hasRole("write:rules") ? html`- <icon @click="${this.deleteRuleset}"><or-icon icon="delete"></or-icon></icon>- <icon style="margin-left: auto;" @click="${this.createRuleset}"><or-icon icon="plus"></or-icon></icon>+ <button @click="${this.deleteRuleset}"><or-icon icon="delete"></or-icon></button>+ <button style="margin-left: auto;" @click="${this.createRuleset}"><or-icon icon="plus"></or-icon></button>` : ``}</div>- </side-menu>+ </div>${this.activeRule ? html`<div class="rule-container"><or-rule-header class="shadow" .readonly="${this.isReadonly("header")}" .ruleset="${this.activeRuleset}" .rule="${this.activeRule}" .saveEnabled="${!this._saveInProgress && this.isValidRule && this._activeModified}"></or-rule-header>diff --git a/ui/component/or-rules-editor/src/or-rule-header.ts b/ui/component/or-rules-editor/src/or-rule-header.tsindex 1b4280c40..2eb71e223 100644--- a/ui/component/or-rules-editor/src/or-rule-header.ts+++ b/ui/component/or-rules-editor/src/or-rule-header.ts@@ -43,30 +43,26 @@ class OrRuleHeader extends LitElement {if (this.ruleset) {this.ruleset.enabled = !this.ruleset.enabled;this.dispatchEvent(new OrRuleChangedEvent());+ this.requestUpdate();}}protected render() {return html`- <div class="rule-container">-- <div class="layout horizontal">- <input ?disabled="${this.readonly}" required placeholder=" " @change="${this.changeName}" type="text" minlength="3" maxlength="255" .value="${this.ruleset ? this.ruleset.name : null}" />-- <div class="layout horizontal" style="margin-left: auto;">- <span style="margin: 9px 0;" class="toggle-label" ?data-disabled="${!this.ruleset!.id}"><or-translate value="active"></or-translate></span>- <label class="switch" ?data-disabled="${!this.ruleset!.id}">- <input @change="${this.toggleEnabled}" ?disabled="${!this.ruleset!.id || this.readonly}" ?checked="${this.ruleset!.enabled}" type="checkbox">- <span class="slider round"></span>- </label>+ <div id="container">+ <input id="title" ?disabled="${this.readonly}" required placeholder=" " @change="${this.changeName}" type="text" minlength="3" maxlength="255" .value="${this.ruleset ? this.ruleset.name : null}" />++ <div id="controls">+ <span id="toggle-label" ?data-disabled="${!this.ruleset!.id}"><or-translate value="active"></or-translate></span>+ <label id="toggle" ?data-disabled="${!this.ruleset!.id}" @click="${this.toggleEnabled}" ?data-checked="${this.ruleset!.enabled}">+ <span></span>+ </label>- ${this.ruleset ? html`- <button ?disabled="${!this.saveEnabled}" @click="${this.saveRuleset}"><or-translate value="save"></or-translate></button>- ` : ``}- </div>-- </div>+ ${this.ruleset ? html`+ <button id="save-btn" ?disabled="${!this.saveEnabled}" @click="${this.saveRuleset}"><or-translate value="save"></or-translate></button>+ ` : ``}+ </div></div>`;}diff --git a/ui/component/or-rules-editor/src/or-rule-list.ts b/ui/component/or-rules-editor/src/or-rule-list.tsindex 41bfa733e..2c1e282a0 100644--- a/ui/component/or-rules-editor/src/or-rule-list.ts+++ b/ui/component/or-rules-editor/src/or-rule-list.ts@@ -30,7 +30,7 @@ class OrRulesList extends LitElement {${this.rulesets && this.rulesets.map((ruleset: TenantRuleset, index: number) => {return html`<a ?selected="${this.ruleset && ruleset.id === this.ruleset.id}" class="d-flex list-item" @click="${() => this.setActiveRule(this.rulesets[index])}">- <span class="rule-status ${ruleset.enabled ? "bg-green" : "bg-red"}"></span>+ <span class="${ruleset.enabled ? "bg-green" : "bg-red"}"></span><div class="flex"><span>${ruleset.name}<span>${!ruleset.id ? " [concept]" : ""}</span></span></div>diff --git a/ui/component/or-rules-editor/src/style.ts b/ui/component/or-rules-editor/src/style.tsindex c7b5525c2..0c9f495bc 100644--- a/ui/component/or-rules-editor/src/style.ts+++ b/ui/component/or-rules-editor/src/style.ts@@ -1,5 +1,5 @@import {css, unsafeCSS} from "lit-element";-import {DefaultColor1, DefaultColor2, DefaultColor5} from "@openremote/core";+import {DefaultColor1, DefaultColor2, DefaultColor5, DefaultColor3, DefaultBoxShadow, DefaultColor4, DefaultColor6, DefaultDisabledOpacity} from "@openremote/core";// language=CSSexport const rulesEditorStyle = css`@@ -9,60 +9,56 @@ export const rulesEditorStyle = css`height: 100%;width: 100%;- --internal-or-rule-background-color: var(--or-rule-background-color, var(--or-app-color2, ${unsafeCSS(DefaultColor2)}));- --internal-or-rule-panel-color: var(--or-rule-panel-color, var(--or-app-color1, ${unsafeCSS(DefaultColor1)}));- --internal-or-rule-list-background-color: var(--or-rule-list-background-color, var(--or-app-color2, ${unsafeCSS(DefaultColor2)}));- --internal-or-rule-list-foreground-color: var(--or-rule-list-foreground-color, var(--app-foreground-color, var(--or-app-color5, ${unsafeCSS(DefaultColor5)})));- --internal-or-rule-header-background-color: var(--or-rule-header-background-color, var(--or-app-color1, ${unsafeCSS(DefaultColor1)}));- --internal-or-rule-toolbar-background-color: var(--or-rule-toolbar-background-color, var(--or-app-color1, ${unsafeCSS(DefaultColor1)}));- --internal-or-rule-editor-background-color: var(--or-rule-editor-background-color, var(--or-app-color2, ${unsafeCSS(DefaultColor2)}));- --internal-or-rule-text-color: var(--or-rule-text-color, inherit);+ --internal-or-rules-editor-background-color: var(--or-rules-editor-background-color, var(--or-app-color2, ${unsafeCSS(DefaultColor2)}));+ --internal-or-rules-editor-text-color: var(--or-rules-editor-text-color, inherit);+ --internal-or-rules-editor-panel-color: var(--or-rules-editor-panel-color, var(--or-app-color1, ${unsafeCSS(DefaultColor1)}));+ --internal-or-rules-editor-button-color: var(--or-rules-editor-button-color, var(--or-app-color4, ${unsafeCSS(DefaultColor4)}));+ --internal-or-rules-editor-invalid-color: var(--or-rules-editor-invalid-color, var(--or-app-color6, ${unsafeCSS(DefaultColor6)}));+ --internal-or-rules-editor-panel-color: var(--or-rules-editor-panel-color, var(--or-app-color1, ${unsafeCSS(DefaultColor1)}));+ --internal-or-rules-editor-line-color: var(--or-rules-editor-line-color, var(--or-app-color5, ${unsafeCSS(DefaultColor5)}));++ --internal-or-rules-editor-list-selected-color: var(--or-rules-editor-list-selected-color, var(--or-app-color2, ${unsafeCSS(DefaultColor2)}));+ --internal-or-rules-editor-list-text-color: var(--or-rules-editor-list-text-color, var(--or-app-color3, ${unsafeCSS(DefaultColor3)}));+ --internal-or-rules-editor-list-text-size: var(--or-rules-editor-list-text-size, 15px);++ --internal-or-rules-editor-list-button-size: var(--or-rules-editor-list-button-size, 24px);++ --internal-or-rules-editor-header-background-color: var(--or-rules-editor-header-background-color, var(--or-app-color1, ${unsafeCSS(DefaultColor1)}));+ --internal-or-rules-editor-header-height: var(--or-rules-editor-header-height, 80px);}.shadow {- -webkit-box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.21);- -moz-box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.21);- box-shadow: 0px 1px 3px 0px rgba(0, 0, 0, 0.21);+ -webkit-box-shadow: ${unsafeCSS(DefaultBoxShadow)};+ -moz-box-shadow: ${unsafeCSS(DefaultBoxShadow)};+ box-shadow: ${unsafeCSS(DefaultBoxShadow)};}- side-menu {+ #rule-list-container {min-width: 300px;width: 300px;z-index: 2;display: flex;flex-direction: column;- }+ background-color: var(--internal-or-rules-editor-panel-color);+ color: var(--internal-or-rules-editor-list-text-color);- or-rule-list {- flex-grow: 1;- background-color: var(--internal-or-rule-list-background-color);- }-- or-rule-header {- background-color: var(--internal-or-rule-header-background-color);}- .bottom-toolbar {+ #rule-list-container #bottom-toolbar {display: flex;- border-top: 1px solid var(--app-tertiary-color);- background-color: var(--internal-or-rule-toolbar-background-color);- }-- .bottom-toolbar or-icon {- --or-icon-height: 16px;+ border-top: 1px solid var(--internal-or-rules-editor-line-color);+ --or-icon-fill: var(--internal-or-rules-editor-panel-color);+ --or-icon-width: var(--internal-or-rules-editor-list-button-size);+ --or-icon-height: var(--internal-or-rules-editor-list-button-size);}- icon {- cursor: pointer;+ #bottom-toolbar button {padding: 5px;margin: 10px;- border: 1px solid var(--app-tertiary-color);+ cursor: pointer;+ border: 1px solid var(--internal-or-rules-editor-line-color);border-radius: 3px;- }-- icon:hover {- background-color: var(--app-primary-color);- color: var(--app-white-color, #FFF);+ background-color: var(--internal-or-rules-editor-button-color);}.rule-container {@@ -71,10 +67,14 @@ export const rulesEditorStyle = css`flex-grow: 1;}+ or-rule-header {+ height: var(--internal-or-rules-editor-header-height);+ }+.rule-editor-panel {display: flex;flex-grow: 1;- background-color: var(--internal-or-rule-editor-background-color);+ background-color: var(--internal-or-rules-editor-background-color);}.rule-editor-panel > * {@@ -111,7 +111,7 @@ export const rulesEditorStyle = css`// language=CSSexport const invalidStyle = css`*:invalid {- border-bottom: 2px solid red;+ border-bottom: 2px solid var(--internal-or-rules-editor-invalid-color);}`;@@ -119,7 +119,8 @@ export const invalidStyle = css`export const buttonStyle = css`.button-clear {background: none;- color: var(--internal-or-rule-foreground-color);+ color: var(--internal-or-rules-editor-button-color);+ --or-icon-fill: var(--internal-or-rules-editor-button-color);border: none;padding: 0;display: inline-block;@@ -129,10 +130,6 @@ export const buttonStyle = css`.button-clear:focus {outline: 0;}-- .button-clear > or-icon {- fill: var(--internal-or-rule-foreground-color);- }.add-button {display: inline-block;@@ -148,7 +145,7 @@ export const buttonStyle = css`padding-top: 5px;border-top-width: 1px;border-top-style: solid;- border-color: var(--internal-or-rule-foreground-color);+ border-color: var(--internal-or-rules-editor-line-color);}.add-buttons-container > button {@@ -166,7 +163,7 @@ export const ruleSectionStyle = css`padding: 20px;display: flex;flex-direction: column;- background-color: var(--internal-or-rule-panel-color);+ background-color: var(--internal-or-rules-editor-panel-color);box-shadow: rgba(0, 0, 0, 0.11) 0 1px 2px 0;}@@ -180,7 +177,10 @@ export const ruleSectionStyle = css`export const ruleListStyle = css`:host {overflow: auto;+ flex-grow: 1;+ font-size: var(--internal-or-rules-editor-list-text-size);}+.d-flex {display: -webkit-box;display: -moz-box;@@ -197,7 +197,6 @@ export const ruleListStyle = css`flex: 1;}-.list-title {display: block;padding: 30px 30px 5px 20px;@@ -210,36 +209,25 @@ export const ruleListStyle = css`.list-item {text-decoration: none;- font-size: 14px;padding: 13px 15px;border-left: 5px solid transparent;- color: var(--internal-or-rule-list-foreground-color);cursor: pointer;-transition: all 200ms ease-in;+ opacity: 0.8;}.list-item:hover {- border-left-color: transparent;- background-color: #f7f7f7;- color: #000000;+ border-left-color: var(--internal-or-rules-editor-list-selected-color);+ background-color: var(--internal-or-rules-editor-list-selected-color);}.list-item[selected] {- border-left-color: var(--app-primary-color);- background-color: #f7f7f7;- color: #000000;- }-- .list-item:hover {- opacity: 0.77;+ border-left-color: var(--internal-or-rules-editor-button-color);+ background-color: var(--internal-or-rules-editor-list-selected-color);+ opacity: 1;}.list-item > span {- font-size: 18px;- }-- .rule-status {width: 8px;height: 8px;border-radius: 8px;@@ -263,66 +251,64 @@ export const headerStyle = css`:host {display: block;width: 100%;-z-index: 1;+ background-color: var(--internal-or-rules-editor-header-background-color);+ --or-icon-fill: var(--internal-or-rules-editor-panel-color);}- .rule-container {- padding: 20px 30px;- }-- .layout.horizontal {+ #container {display: flex;+ height: 100%;flex-direction: row;+ padding: 0 20px;}- input {+ #title {font-size: 18px;font-weight: bold;- border: none;+ border: 2px solid transparent;background-color: transparent;- border-bottom: 2px solid transparent;- transition: all 150ms ease-in;-+ transition: all 150ms ease-in;width: 350px;max-width: 100%;}- input:hover {- border-bottom: 2px solid #d5d5d5;+ #title:hover {+ border-bottom-color: 2px solid var(--internal-or-rules-editor-line-color);}-- button {++ #title:focus {+ outline: none;+ }++ #controls {+ margin: 0 0 0 auto;+ display: flex;+ flex-direction: row;+ align-items: center;+ height: 100%;+ }++ #save-btn {padding: 0 20px;font-size: 14px;height: 40px;-border-radius: 5px;border: none;- background-color: var(--internal-or-rule-foreground-color);+ background-color: var(--internal-or-rules-editor-button-color);margin-left: auto;- color: var(--app-white-color, #FFF);+ color: var(--internal-or-rules-editor-panel-color);font-weight: bold;cursor: pointer;}- button[disabled] {- background-color: #e4e4e4;- }-- .button-simple {- border: none;- color: var(--internal-or-rule-foreground-color);- background-color: var(--internal-or-rule-header-background-color);- }-- or-input {- padding: 10px;+ #save-btn[disabled] {+ opacity: ${unsafeCSS(DefaultDisabledOpacity)};+ pointer-events: none;}-/* The switch - the box around the slider */- .switch {+ #toggle {position: relative;display: inline-block;width: 36px;@@ -330,15 +316,8 @@ export const headerStyle = css`margin: 13px 30px 13px 10px;}- /* Hide default HTML checkbox */- .switch input {- opacity: 0;- width: 0;- height: 0;- }-/* The slider */- .slider {+ #toggle > span {position: absolute;cursor: pointer;top: 0;@@ -348,54 +327,33 @@ export const headerStyle = css`background-color: #ccc;-webkit-transition: .4s;transition: .4s;+ border-radius: 34px;}-- .switch[data-disabled] {- cursor: auto;- }-- .toggle-label[data-disabled] {- color: #e4e4e4;- }-- .switch[data-disabled] .slider::before {- background-color: #e4e4e4;++ #toggle-label[data-disabled], #toggle[data-disabled] {+ opacity: ${unsafeCSS(DefaultDisabledOpacity)};+ pointer-events: none;}- .slider:before {+ #toggle > span:before {position: absolute;content: "";height: 20px;width: 20px;left: 0;top: -3px;+ opacity: 1;background-color: white;+ border-radius: 50%;-webkit-transition: .4s;transition: .4s;- box-shadow: 0 1px 5px 0 rgba(0, 0, 0, 0.6);- }-- input:checked + .slider:before {- background-color: var(--internal-or-rule-foreground-color);- }-- input:focus + .slider {+ box-shadow: ${unsafeCSS(DefaultBoxShadow)};}- input:checked + .slider:before {- -webkit-transform: translateX(20px);- -ms-transform: translateX(20px);+ #toggle[data-checked] > span:before {+ background-color: var(--internal-or-rules-editor-button-color);transform: translateX(20px);}-- /* Rounded sliders */- .slider.round {- border-radius: 34px;- }-- .slider.round:before {- border-radius: 50%;- }`;// language=CSS@@ -414,7 +372,7 @@ export const whenStyle = css`padding: 20px 20px 10px 20px;border-width: 2px;border-style: solid;- border-color: var(--internal-or-rule-foreground-color);+ border-color: var(--internal-or-rules-editor-line-color);}.rule-group > .remove-button {@@ -459,16 +417,12 @@ export const whenStyle = css`left: 0;top: 100%;padding: 2px;- border: 2px solid var(--internal-or-rule-foreground-color);+ border: 2px solid var(--internal-or-rules-editor-button-color);border-radius: 3px;font-weight: bold;- }-- .operator * {font-size: small;- color: var(--internal-or-rule-foreground-color);- }-+ }+.rule-condition > * {flex-grow: 0;}@@ -573,14 +527,14 @@ export const assetQueryEditorStyle = css`left: 0;top: 100%;padding: 2px;- border: 2px solid var(--internal-or-rule-foreground-color);+ border: 2px solid var(--internal-or-rules-editor-button-color);border-radius: 3px;font-weight: bold;}.operator * {font-size: small;- color: var(--internal-or-rule-foreground-color);+ color: var(--internal-or-rules-editor-button-color);}.attribute > * {