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
WIP Rules editor
robindekkers1f2c91462393
diff --git a/ui/component/or-input/src/index.ts b/ui/component/or-input/src/index.tsindex 3235cc1de..4f0459a02 100644--- a/ui/component/or-input/src/index.ts+++ b/ui/component/or-input/src/index.ts@@ -1,5 +1,7 @@import {html, LitElement, property} from 'lit-element';++import {orInputStyle} from './style';class OrInput extends LitElement {@property({type: String})@@ -11,6 +13,13 @@ class OrInput extends LitElement {@property({type: String})value: string = '';++ static get styles() {+ return [+ orInputStyle+ ];+ }+protected render() {return html`@@ -21,16 +30,17 @@ class OrInput extends LitElement {onChange() {if(this.shadowRoot){- const value = (<HTMLInputElement>this.shadowRoot.getElementById('or-input')).value;+ const input = (<HTMLInputElement>this.shadowRoot.getElementById('or-input'));+ const value = input.value;+ const name = input.name;// Launch event for all parent elementslet event = new CustomEvent('or-input:changed', {- detail: { value: value },+ detail: { value: value, name: name },bubbles: true,composed: true });this.dispatchEvent(event);-}}diff --git a/ui/component/or-input/src/style.ts b/ui/component/or-input/src/style.tsnew file mode 100644index 000000000..f1819d9ed--- /dev/null+++ b/ui/component/or-input/src/style.ts@@ -0,0 +1,15 @@+import {css} from "lit-element";++// TODO this is temp work, should be replaced with material design components / styling+// language=CSS+export const orInputStyle = css`+ input {+ position: relative;+ font-family: inherit;+ background-color: transparent;+ padding: 10px;+ border-radius: 0;+ border: none;+ font-size: 14px;+ }+`;\ No newline at end of filediff --git a/ui/component/or-rules-editor/src/index.ts b/ui/component/or-rules-editor/src/index.tsindex 2975a49b8..35ee61ab7 100644--- a/ui/component/or-rules-editor/src/index.ts+++ b/ui/component/or-rules-editor/src/index.ts@@ -2,7 +2,14 @@ import {customElement, html, LitElement, property, TemplateResult} from "lit-eleimport "@openremote/or-select";import "@openremote/or-icon";-import {Rule, RuleActionWriteAttribute, RulesetLang, TenantRuleset} from "@openremote/model";+import {+ AttributeDescriptor,+ Rule,+ RuleActionWriteAttribute,+ RulesetLang,+ TenantRuleset,+ ValueType+} from "@openremote/model";import openremote from "@openremote/core";import rest from "@openremote/rest";@@ -29,6 +36,32 @@ const rulesetModel: TenantRuleset = {rules: JSON.stringify({rules: [ruleModel]})};++const attributeDescriptors: AttributeDescriptor[] = [+ {name: "profiles", valueDescriptor: {name: "STRING", valueType: ValueType.STRING}},+ {name: "airportIata", valueDescriptor: {name: "STRING", valueType: ValueType.STRING}},+ {name: "airlineIata", valueDescriptor: {name: "STRING", valueType: ValueType.STRING}},+ {name: "originRegion", valueDescriptor: {name: "STRING", valueType: ValueType.STRING}},+ {name: "languageCodes", valueDescriptor: {name: "STRING", valueType: ValueType.STRING}},+ {name: "passengerCapacity", valueDescriptor: {name: "NUMBER", valueType: ValueType.NUMBER}},+ {name: "countryCode", valueDescriptor: {name: "STRING", valueType: ValueType.STRING}}+];++const rulesEditorConfig = {+ languageCodes: {+ options: [+ "Dutch",+ "English",+ ]+ },+ countryCode: {+ options: [+ "NL",+ "GB",+ ]+ },+};+class InputHandlers {public handlers: Array<(condition: RuleActionWriteAttribute) => TemplateResult | undefined> = [];@@ -74,13 +107,17 @@ class OrRulesEditor extends LitElement {super();this.readRules();this.addEventListener("rules:set-active-rule", this.setActiveRule);+ this.addEventListener("rules:write-rule", this.writeRule);this.addEventListener("rules:create-rule", this.createRule);this.addEventListener("rules:update-rule", this.updateRule);this.addEventListener("rules:delete-rule", this.deleteRule);}public readRules() {- rest.api.RulesResource.getTenantRulesets(openremote.config.realm, { language: RulesetLang.JSON, fullyPopulate: true }).then((response: any) => {+ rest.api.RulesResource.getTenantRulesets(openremote.config.realm, {+ language: RulesetLang.JSON,+ fullyPopulate: true+ }).then((response: any) => {if (response && response.data) {this.rulesets = response.data;if (this.ruleset && this.rulesets) {@@ -112,7 +149,15 @@ class OrRulesEditor extends LitElement {this.ruleset = newRule;this.computeRuleset();- rest.api.RulesResource.createTenantRuleset(newRule).then((response: any) => {++ }+ }++ public writeRule() {+ if (this.ruleset && this.rule) {+ this.rule.name = this.ruleset.name;+ this.ruleset.rules = JSON.stringify({rules: [this.rule]});+ rest.api.RulesResource.createTenantRuleset(this.ruleset).then((response: any) => {this.readRules();});}@@ -128,11 +173,11 @@ class OrRulesEditor extends LitElement {// Parse rule to string of array of rulesthis.rule.name = this.ruleset.name;- this.ruleset.rules = JSON.stringify({rules: [this.rule] });+ this.ruleset.rules = JSON.stringify({rules: [this.rule]});// this.ruleset.rules = JSON.stringify(this.rules);rest.api.RulesResource.updateTenantRuleset(this.ruleset.id, this.ruleset).then((response: any) => {- this.readRules();+ this.readRules();});}@@ -162,7 +207,6 @@ class OrRulesEditor extends LitElement {this.rule = ruleModel;this.rule.name = this.ruleset.name;}-this.requestUpdate();}@@ -177,7 +221,7 @@ class OrRulesEditor extends LitElement {return html`<div class="rule-editor-container"><side-menu class="bg-white shadow">- <or-rule-list .rulesets="${this.rulesets}" .ruleset="${this.ruleset}"></or-rule-list>+ <or-rule-list .rulesets="${this.rulesets}" .ruleset="${this.ruleset}" ></or-rule-list><div class="bottom-toolbar"><icon class="small-icon" @click="${this.deleteRule}"><or-icon icon="delete"></or-icon></icon><icon class="small-icon" @click="${this.createRule}"><or-icon icon="plus"></or-icon></icon>@@ -185,12 +229,12 @@ class OrRulesEditor extends LitElement {</side-menu>${this.ruleset ? html`<or-body>- <or-rule-header class="bg-white shadow" .ruleset="${this.ruleset}"></or-rule-header>+ <or-rule-header class="bg-white shadow" .ruleset="${this.ruleset}" .rule="${this.rule}"></or-rule-header>${this.rule ? html`<div class="content">- <or-rule-when .rule="${this.rule}"></or-rule-when>- <or-rule-then .rule="${this.rule}"></or-rule-then>+ <or-rule-when .rule="${this.rule}" .attributeDescriptors="${attributeDescriptors}"></or-rule-when>+ <or-rule-then .rule="${this.rule}" .attributeDescriptors="${attributeDescriptors}"></or-rule-then></div>` : ``}diff --git a/ui/component/or-rules-editor/src/or-rule-header/index.ts b/ui/component/or-rules-editor/src/or-rule-header/index.tsindex 5b787d3f4..d09a53a21 100644--- a/ui/component/or-rules-editor/src/or-rule-header/index.ts+++ b/ui/component/or-rules-editor/src/or-rule-header/index.ts@@ -38,7 +38,12 @@ class OrRuleHeader extends LitElement {<span @click="${this.toggleEditmode}"><or-icon style="margin:10px;" icon="pencil-outline"></or-icon></span><span class="rule-status ${this.ruleset && this.ruleset.enabled ? 'bg-green' : 'bg-red'}"></span><or-toggle @click="${this.toggleEnabled}">toggle</or-toggle>- <button @click="${this.updateRule}">opslaan</button>+ ${this.ruleset && this.ruleset.id ? html`+ <button @click="${this.updateRule}">opslaan</button>+ ` : html`+ <button @click="${this.createRule}">toevoegen</button>+ `}+</div></div>`;@@ -57,6 +62,15 @@ class OrRuleHeader extends LitElement {}}+ createRule() {+ let event = new CustomEvent('rules:write-rule', {+ detail: {ruleset: this.ruleset},+ bubbles: true,+ composed: true+ });+ this.dispatchEvent(event);+ }+updateRule() {let event = new CustomEvent('rules:update-rule', {detail: {ruleset: this.ruleset},diff --git a/ui/component/or-rules-editor/src/or-rule-then-condition/index.ts b/ui/component/or-rules-editor/src/or-rule-then-condition/index.tsindex b3efbd27f..448a7272a 100644--- a/ui/component/or-rules-editor/src/or-rule-then-condition/index.ts+++ b/ui/component/or-rules-editor/src/or-rule-then-condition/index.ts@@ -7,8 +7,9 @@ import "@openremote/or-select";import "@openremote/or-icon";import handler from "../index";import {style} from "./style";+import set from 'lodash/set';-import {RuleActionUnion, RuleActionWriteAttribute} from "@openremote/model";+import {RuleActionUnion, RuleActionWriteAttribute, AttributeDescriptor} from "@openremote/model";// TODO use create select option to@customElement("or-rule-then-condition")@@ -26,6 +27,9 @@ class OrRuleThenCondition extends LitElement {@property({type: Number})private value: number = 0;+ @property({type: Array})+ public attributeDescriptors?: AttributeDescriptor[];+constructor() {super();@@ -34,9 +38,9 @@ class OrRuleThenCondition extends LitElement {public setValue(e: any) {const value = e.detail.value;-+ const name = e.detail.name;if (this.condition && this.condition.value) {- this.condition.value = value;+ this.condition.value = set(this.condition.value, name, value);this.requestUpdate();}}@@ -46,7 +50,7 @@ class OrRuleThenCondition extends LitElement {return html`<div class="rule-container">${this.condition ? html`- <or-select-asset-attribute disabled type="${this.condition}" value="${this.condition.attributeName}"></or-select-asset-attribute>+ <or-select-asset-attribute disabled type="${this.condition}" value="${this.condition.attributeName}" .attributeDescriptors="${this.attributeDescriptors}"></or-select-asset-attribute><or-select-operator disabled type="${this.condition}" value="EQUAL"></or-select-operator>${this.createInputControl(this.condition!)}` : ``}@@ -59,7 +63,8 @@ class OrRuleThenCondition extends LitElement {const result = h(this.condition!);if (result) {- return html`${result}`;+ let response = html`${result}`;+ return response;}}diff --git a/ui/component/or-rules-editor/src/or-rule-then-condition/style.ts b/ui/component/or-rules-editor/src/or-rule-then-condition/style.tsindex c5fac89bb..a913f29d9 100644--- a/ui/component/or-rules-editor/src/or-rule-then-condition/style.ts+++ b/ui/component/or-rules-editor/src/or-rule-then-condition/style.ts@@ -9,7 +9,7 @@ export const style = css`.rule-container {display: flex;margin-bottom: 10px;- padding: 15px 20px;+ padding: 5px 20px;border-radius: 5px;border: 1px solid var(--app-lightgrey-color, #F5F5F5);diff --git a/ui/component/or-rules-editor/src/or-rule-then/index.ts b/ui/component/or-rules-editor/src/or-rule-then/index.tsindex b43369770..622152506 100644--- a/ui/component/or-rules-editor/src/or-rule-then/index.ts+++ b/ui/component/or-rules-editor/src/or-rule-then/index.ts@@ -1,7 +1,8 @@import {html, LitElement, property, customElement, PropertyValues} from 'lit-element';import {style} from './style';-import {Rule, RuleTrigger, RuleActionUnion, NewAssetQuery, BaseAssetQueryMatch} from "@openremote/model";+import {Rule, RuleTrigger, RuleActionUnion, NewAssetQuery, BaseAssetQueryMatch, RuleActionUpdateAttributeUpdateAction,+ AttributeDescriptor} from "@openremote/model";import '../or-rule-then-condition';@@ -15,9 +16,14 @@ const defaultAssetType:NewAssetQuery = {};let defaultThenCondition:RuleActionUnion = {- action: "write-attribute",- attributeName: 'profileColor',- value: {"%RULESET_ID%": {"profileName":"%RULESET_NAME%", "profileColor": "red"}},+ action: "update-attribute",+ updateAction: RuleActionUpdateAttributeUpdateAction.ADD_OR_REPLACE,+ attributeName: "profiles",+ key: "%RULESET_ID%",+ value: {+ profileName: "%RULESET_NAME%",+ profileColor: "orange"+ },target: { "useAssetsFromWhen": true}};@@ -40,7 +46,7 @@ class OrRuleThen extends LitElement {<div class="rule-then-container bg-white shadow">${this.rule && this.rule.then ? this.rule.then.map((then:RuleActionUnion) => {return html`- <or-rule-then-condition .condition="${then}"></or-rule-then-condition>+ <or-rule-then-condition .condition="${then}" .attributeDescriptors="${this.attributeDescriptors}"></or-rule-then-condition><span class="rule-additional">&</span>`}) : ``}@@ -53,6 +59,10 @@ class OrRuleThen extends LitElement {@property({type: Object})rule?: Rule;+ @property({type: Array})+ public attributeDescriptors?: AttributeDescriptor[];++constructor() {super();}diff --git a/ui/component/or-rules-editor/src/or-rule-when-condition/index.ts b/ui/component/or-rules-editor/src/or-rule-when-condition/index.tsindex 5570e8022..494e82ab9 100644--- a/ui/component/or-rules-editor/src/or-rule-when-condition/index.ts+++ b/ui/component/or-rules-editor/src/or-rule-when-condition/index.ts@@ -7,7 +7,8 @@ import '@openremote/or-select';import '@openremote/or-icon';import {style} from './style';-import {AttributePredicate} from "@openremote/model";+import {AttributePredicate, AttributeDescriptor, ValueType} from "@openremote/model";+import find from 'lodash/find';@customElement('or-rule-when-condition')class OrRuleWhenCondition extends LitElement {@@ -29,15 +30,19 @@ class OrRuleWhenCondition extends LitElement {</or-select-asset-type>${this.predicate.name ? html`- <or-select-asset-attribute icon="${this.predicate}" value="${this.predicate.name.value}"></or-select-asset-attribute>+ <or-select-asset-attribute icon="${this.predicate}" value="${this.predicate.name.value}" .attributeDescriptors="${this.attributeDescriptors}"></or-select-asset-attribute>${this.predicate.value && this.predicate.value.predicateType === 'string' ? html`${this.predicate.name.value ? html`- <or-select-operator type="${this.predicate.value.predicateType}" value="${this.predicate.value.match}"></or-select-operator>+ <or-select-operator type="${this.getAttributeDescriptors(this.predicate.name.value)!.valueDescriptor!.valueType}" value="${this.predicate.value.match}"></or-select-operator>` : ``}- ${this.predicate.value.match ? html`- <or-input type="text" value="${this.predicate.value.value ? this.predicate.value.value : ''}"></or-input>+ ${this.predicate.name.value && this.predicate.value.match ? html`+ ${this.getAttributeDescriptors(this.predicate.name.value)!.valueDescriptor!.valueType === ValueType.ARRAY ? html`+ <or-select .options="${this.getAttributeDescriptors(this.predicate.name.value)!.initialValue}" value="${this.predicate.value.value ? this.predicate.value.value : ''}"></or-select>+ `: html`+ <or-input type="text" value="${this.predicate.value.value ? this.predicate.value.value : ''}"></or-input>+ `}` : ``}${this.predicate.value.value ? html`@@ -61,6 +66,8 @@ class OrRuleWhenCondition extends LitElement {@property({type: Number})index?: number;+ @property({type: Array})+ public attributeDescriptors?: AttributeDescriptor[];// setAssetType(value:string) {// const assetType = {@@ -75,13 +82,17 @@ class OrRuleWhenCondition extends LitElement {// }// }+ getAttributeDescriptors(name: string) {+ return find(this.attributeDescriptors, ['name', name]);+ }+setAssetAttribute(e:any) {const value = e.detail.value;if(this.predicate && this.predicate.name) {this.predicate.name.value = value;- this.setOperator(e)+ this.setOperator(e);this.requestUpdate();}}diff --git a/ui/component/or-rules-editor/src/or-rule-when-condition/style.ts b/ui/component/or-rules-editor/src/or-rule-when-condition/style.tsindex 2eebff3ed..8c6f276f2 100644--- a/ui/component/or-rules-editor/src/or-rule-when-condition/style.ts+++ b/ui/component/or-rules-editor/src/or-rule-when-condition/style.ts@@ -9,11 +9,12 @@ export const style = css`.rule-container {display: flex;margin-bottom: 10px;- padding: 15px 20px;+ padding: 5px 20px;border-radius: 5px;border: 1px solid var(--app-lightgrey-color, #F5F5F5);}--+ or-icon {+ margin-top: 5px;+ }`;\ No newline at end of filediff --git a/ui/component/or-rules-editor/src/or-rule-when/index.ts b/ui/component/or-rules-editor/src/or-rule-when/index.tsindex b6d642a97..b814b61db 100644--- a/ui/component/or-rules-editor/src/or-rule-when/index.ts+++ b/ui/component/or-rules-editor/src/or-rule-when/index.ts@@ -1,17 +1,12 @@import {html, LitElement, property, customElement, PropertyValues} from 'lit-element';import {style} from './style';-import {Rule, RuleTrigger, AttributePredicate, BaseAssetQueryMatch, NewAssetQuery} from "@openremote/model";+import {Rule, RuleTrigger, AttributePredicate, BaseAssetQueryMatch, NewAssetQuery, AttributeDescriptor,+ BaseAssetQueryOperator} from "@openremote/model";import '../or-rule-when-condition';-const ruleModel:Rule = {- name: "",- when: undefined,- then: undefined-};-const defaultWhenCondition:RuleTrigger = {"asset": {"types": [{@@ -57,7 +52,7 @@ class OrRuleWhen extends LitElement {${this.rule && this.rule.when && this.rule.when.asset && this.rule.when.asset.attributes && this.rule.when.asset.attributes.predicates ? html`${this.rule.when.asset.attributes.predicates.map((predicate:AttributePredicate, index) => {return html`- <or-rule-when-condition index="${index}" .predicate="${predicate}"></or-rule-when-condition>+ <or-rule-when-condition index="${index}" .predicate="${predicate}" .attributeDescriptors="${this.attributeDescriptors}"></or-rule-when-condition><span class="rule-additional">&</span>`})}@@ -74,6 +69,10 @@ class OrRuleWhen extends LitElement {@property({type: Array})predicates?: AttributePredicate[] = [];+ @property({type: Array})+ public attributeDescriptors?: AttributeDescriptor[];++constructor() {super();this.addEventListener('when-condition:delete', this.deleteWhenCondition);@@ -82,8 +81,10 @@ class OrRuleWhen extends LitElement {protected updated(_changedProperties: PropertyValues): void {super.updated(_changedProperties);- if (!this.rule) {- this.rule = ruleModel;+ if(this.rule && !this.rule.when) {+ this.rule.when = defaultWhenCondition;+ this.addPredicate();+ this.requestUpdate();}}@@ -92,11 +93,15 @@ class OrRuleWhen extends LitElement {this.rule.when = defaultWhenCondition;}+ this.addPredicate();+ this.requestUpdate();++ }++ addPredicate() {if(this.rule && this.rule.when && this.rule.when.asset && this.rule.when.asset.attributes && this.rule.when.asset.attributes.predicates) {this.rule.when.asset.attributes.predicates.push(defaultPredicate);- this.requestUpdate();}-}deleteWhenCondition (e:any) {diff --git a/ui/component/or-rules-editor/src/selects/or-select-asset-attribute/index.ts b/ui/component/or-rules-editor/src/selects/or-select-asset-attribute/index.tsindex 59e49555d..6254628db 100644--- a/ui/component/or-rules-editor/src/selects/or-select-asset-attribute/index.ts+++ b/ui/component/or-rules-editor/src/selects/or-select-asset-attribute/index.ts@@ -1,6 +1,8 @@import {html, LitElement, customElement, property} from "lit-element";import {AttributeDescriptor, AttributeValueType, AttributeValueDescriptor, ValueType} from "@openremote/model";+import {selectStyle} from "@openremote/or-select/dist/style";+const Test = {STRING: {name: "flightProfile", icon: "file-text-o", valueType: ValueType.STRING},NUMBER: {name: ""}@@ -22,23 +24,17 @@ class OrSelectAssetAttribute extends LitElement {@property({type: Boolean})public disabled: boolean = false;+@property({type: Function})private changed: any;constructor() {super();+ }- // TODO Should come from rules-config based on asset type?- this.attributeDescriptors = [- { name: "flightProfile", valueDescriptor: { name: "NUMBER", valueType: ValueType.NUMBER } },- { name: "profileName", valueDescriptor: { name: "STRING", valueType: ValueType.STRING } },- { name: "profileColor", valueDescriptor: { name: "STRING", valueType: ValueType.STRING } },- { name: "airportIata", valueDescriptor: { name: "STRING", valueType: ValueType.STRING } },- { name: "airlineIata", valueDescriptor: { name: "STRING", valueType: ValueType.STRING } },- { name: "originRegion", valueDescriptor: { name: "STRING", valueType: ValueType.STRING } },- { name: "languageCodes", valueDescriptor: { name: "STRING", valueType: ValueType.STRING } },- { name: "passengerCapacity", valueDescriptor: { name: "NUMBER", valueType: ValueType.NUMBER } },- { name: "countryCode", valueDescriptor: { name: "STRING", valueType: ValueType.STRING } }+ static get styles() {+ return [+ selectStyle];}diff --git a/ui/component/or-rules-editor/src/selects/or-select-operator/index.ts b/ui/component/or-rules-editor/src/selects/or-select-operator/index.tsindex 0e59fae03..662fef2b2 100644--- a/ui/component/or-rules-editor/src/selects/or-select-operator/index.ts+++ b/ui/component/or-rules-editor/src/selects/or-select-operator/index.ts@@ -1,5 +1,7 @@import {html, LitElement, property, customElement} from 'lit-element';-import {AttributeValueType, BaseAssetQueryMatch} from "@openremote/model";+import {AttributeValueType, BaseAssetQueryMatch, BaseAssetQueryOperator} from "@openremote/model";++import {selectStyle} from "@openremote/or-select/dist/style";@customElement('or-select-operator')class OrRuleWhen extends LitElement {@@ -8,23 +10,29 @@ class OrRuleWhen extends LitElement {type?: AttributeValueType;@property({type: String})- value?: BaseAssetQueryMatch;+ value?: BaseAssetQueryOperator;@property({type: Boolean})disabled: boolean = false;+ static get styles() {+ return [+ selectStyle+ ];+ }+protected render() {return html`${this.type ? html`<select ?disabled="${this.disabled}" id="or-select-operator" @change="${this.onChange}">- <option ?selected="${this.value === BaseAssetQueryMatch.EXACT}" value="${BaseAssetQueryMatch.EXACT}">=</option>- <option ?selected="${this.value === BaseAssetQueryMatch.NOT_EXACT}" value="${BaseAssetQueryMatch.NOT_EXACT}">!=</option>+ <option ?selected="${this.value === BaseAssetQueryOperator.EQUALS}" value="${BaseAssetQueryOperator.EQUALS}">=</option>+ <option ?selected="${this.value === BaseAssetQueryOperator.NOT_EQUALS}" value="${BaseAssetQueryOperator.NOT_EQUALS}">!=</option>${this.type === AttributeValueType.NUMBER ? html`- <option value="LESS_THAN"><</option>- <option value="GREATER_THAN">></option>- <option value="LESS_EQUALS">=<</option>- <option value="GREATER_EQUALS">=></option>+ <option ?selected="${this.value === BaseAssetQueryOperator.LESS_THAN}" value="${BaseAssetQueryOperator.LESS_THAN}" value="LESS_THAN"><</option>+ <option ?selected="${this.value === BaseAssetQueryOperator.GREATER_THAN}" value="${BaseAssetQueryOperator.GREATER_THAN}" value="GREATER_THAN">></option>+ <option ?selected="${this.value === BaseAssetQueryOperator.LESS_EQUALS}" value="${BaseAssetQueryOperator.LESS_EQUALS}" value="LESS_EQUALS">=<</option>+ <option ?selected="${this.value === BaseAssetQueryOperator.GREATER_EQUALS}" value="${BaseAssetQueryOperator.GREATER_EQUALS}" value="GREATER_EQUALS">=></option>` :``}</select>` :``}diff --git a/ui/component/or-select/src/index.ts b/ui/component/or-select/src/index.tsindex bae4c6d17..c3135d105 100644--- a/ui/component/or-select/src/index.ts+++ b/ui/component/or-select/src/index.ts@@ -1,18 +1,36 @@import {html, LitElement, property, PropertyValues} from 'lit-element';import {MDCSelect} from '@material/select';+import {selectStyle} from './style';+class OrSelect extends LitElement {@property({type: String})label: string = '';+ @property({type: String})+ name: string = '';++ @property({type: String})+ value: string = '';++ @property({type: Array})+ options: string[] = [];++ static get styles() {+ return [+ selectStyle+ ];+ }+protected render() {return html`<div class="mdc-select">- <i class="mdc-select__dropdown-icon"></i>- <slot></slot>- <label class="mdc-floating-label mdc-floating-label--float-above">${this.label}</label>- <div class="mdc-line-ripple"></div>+ <select id="or-select" @change="${this.onChange}" name="${this.name}" >+ ${this.options.map((option: string) => {+ return html`<option ?selected=${this.value === option} value="${option}">${option}</option>`+ })}+ </select></div>`;}@@ -21,6 +39,23 @@ class OrSelect extends LitElement {super.firstUpdated(_changedProperties);}+ onChange() {+ if(this.shadowRoot){+ const input = (<HTMLInputElement>this.shadowRoot.getElementById('or-select'));+ const value = input.value;+ const name = input.name;++ // Launch event for all parent elements+ let event = new CustomEvent('or-input:changed', {+ detail: { value: value, name: name },+ bubbles: true,+ composed: true });++ this.dispatchEvent(event);+ }+ }++constructor() {super();}diff --git a/ui/component/or-select/src/style.ts b/ui/component/or-select/src/style.tsnew file mode 100644index 000000000..9c1d1c768--- /dev/null+++ b/ui/component/or-select/src/style.ts@@ -0,0 +1,25 @@+import {css} from "lit-element";++// TODO this is temp work, should be replaced with material design components / styling+// language=CSS+export const selectStyle = css`+ .mdc-select {+ font-family:+ 'Roboto','Helvetica','Arial',sans-serif;+ position: relative;+ }++ select {+ position: relative;+ font-family: inherit;+ background-color: transparent;+ padding: 10px;+ border-radius: 0;+ border: none;+ -webkit-appearance: none;+ -moz-appearance: none;+ appearance: none;+ font-size: 14px;+ }++`;\ No newline at end of filediff --git a/ui/component/or-timeline/src/index.ts b/ui/component/or-timeline/src/index.tsindex dd8cbd517..e34660486 100644--- a/ui/component/or-timeline/src/index.ts+++ b/ui/component/or-timeline/src/index.ts@@ -211,7 +211,7 @@ class OrTimeline extends LitElement {// Figure out placement percentage between left and right of inputconst newPoint = v / this.maxRange;// Janky value to get pointer to line up better- let offset = 30;+ let offset = 15;let newPlace;// Prevent bubble from going beyond left or right (unsupported browsers)