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: or-rules-editor overhaul now supports full structure of JSON rules (still lots of predicate/value editors to be implemented)
Rich Turner87cdfaeaaf32
diff --git a/ui/component/or-rules-editor/src/const/attribute-descriptors.ts b/ui/component/or-rules-editor/src/const/attribute-descriptors.tsdeleted file mode 100644index 1c455c612..000000000--- a/ui/component/or-rules-editor/src/const/attribute-descriptors.ts+++ /dev/null@@ -1,220 +0,0 @@-import {- AttributeDescriptor,- ValueType-} from "@openremote/model";--export const attributeDescriptors: any[] = [ {- attributeName: "flightProfiles",- attributeValueDescriptor : {- icon : "cubes",- valueType : "OBJECT",- name: "OBJECT"- }- }, {- attributeName: "languageCodes",- attributeValueDescriptor : {- icon : "ellipsis-h",- valueType : "ARRAY",- name: "ARRAY"- }- }, {- attributeName: "flightName",- metaItemDescriptors : [ ],- valueDescriptor : {- icon : "file-text-o",- valueType : "STRING",- name: "STRING"- }- }, {- attributeName: "flightDirection",- metaItemDescriptors : [ ],- valueDescriptor : {- icon : "file-text-o",- valueType : "STRING",- name: "STRING"- }- }, {- attributeName: "airlineIata",- metaItemDescriptors : [ ],- valueDescriptor : {- icon : "file-text-o",- valueType : "STRING",- name: "STRING"- }- }, {- attributeName: "scheduleDate",- metaItemDescriptors : [ ],- valueDescriptor : {- icon : "file-text-o",- valueType : "STRING",- name: "STRING"- }- }, {- attributeName: "scheduleTime",- metaItemDescriptors : [ ],- valueDescriptor : {- icon : "file-text-o",- valueType : "STRING",- name: "STRING"- }- }, {- attributeName: "scheduledInBlockTime",- metaItemDescriptors : [ ],- valueDescriptor : {- icon : "file-text-o",- valueType : "STRING",- name: "STRING"- }- }, {- attributeName: "estimatedLandingTime",- metaItemDescriptors : [ ],- valueDescriptor : {- icon : "file-text-o",- valueType : "STRING",- name: "STRING"- }- }, {- attributeName: "actualLandingTime",- metaItemDescriptors : [ ],- valueDescriptor : {- icon : "file-text-o",- valueType : "STRING",- name: "STRING"- }- }, {- attributeName: "estimatedPierTime",- metaItemDescriptors : [ ],- valueDescriptor : {- icon : "file-text-o",- valueType : "STRING",- name: "STRING"- }- }, {- attributeName: "estimatedCheckPointTime",- metaItemDescriptors : [ ],- valueDescriptor : {- icon : "file-text-o",- valueType : "STRING",- name: "STRING"- }- }, {- attributeName: "estimatedSchengenCheckPointTime",- metaItemDescriptors : [ ],- valueDescriptor : {- icon : "file-text-o",- valueType : "STRING",- name: "STRING"- }- }, {- attributeName: "terminal",- metaItemDescriptors : [ ],- valueDescriptor : {- icon : "file-text-o",- valueType : "STRING",- name: "STRING"- }- }, {- attributeName: "gate",- metaItemDescriptors : [ ],- valueDescriptor : {- icon : "file-text-o",- valueType : "STRING",- name: "STRING"- }- }, {- attributeName: "gateNumber",- metaItemDescriptors : [ ],- valueDescriptor : {- icon : "hashtag",- valueType : "NUMBER",- name: "NUMBER"- }- }, {- attributeName: "pier",- metaItemDescriptors : [ ],- valueDescriptor : {- icon : "file-text-o",- valueType : "STRING",- name: "STRING"- }- }, {- attributeName: "checkPoint",- metaItemDescriptors : [ ],- valueDescriptor : {- icon : "file-text-o",- valueType : "STRING",- name: "STRING"- }- }, {- attributeName: "pierDisplayName",- metaItemDescriptors : [ ],- valueDescriptor : {- icon : "file-text-o",- valueType : "STRING",- name: "STRING"- }- }, {- attributeName: "pax",- metaItemDescriptors : [ ],- valueDescriptor : {- icon : "hashtag",- valueType : "NUMBER",- name: "NUMBER"- }- }, {- attributeName: "paxArrivalCheckPoint",- metaItemDescriptors : [ ],- valueDescriptor : {- icon : "hashtag",- valueType : "NUMBER",- name: "NUMBER"- }- }, {- attributeName: "paxSchengenCheckPoint",- metaItemDescriptors : [ ],- valueDescriptor : {- icon : "hashtag",- valueType : "NUMBER",- name: "NUMBER"- }- }, {- attributeName: "airportName",- metaItemDescriptors : [ ],- valueDescriptor : {- icon : "file-text-o",- valueType : "STRING",- name: "STRING"- }- }, {- attributeName: "departureAirportIata",- metaItemDescriptors : [ ],- valueDescriptor : {- icon : "file-text-o",- valueType : "STRING",- name: "STRING"- }- }, {- attributeName: "city",- metaItemDescriptors : [ ],- valueDescriptor : {- icon : "file-text-o",- valueType : "STRING",- name: "STRING"- }- }, {- attributeName: "countryCode",- metaItemDescriptors : [ ],- valueDescriptor : {- icon : "file-text-o",- valueType : "STRING",- name: "STRING"- }- }, {- attributeName: "originRegion",- metaItemDescriptors : [ ],- valueDescriptor : {- icon : "file-text-o",- valueType : "STRING",- name: "STRING"- }- } ];diff --git a/ui/component/or-rules-editor/src/const/resources.ts b/ui/component/or-rules-editor/src/const/resources.tsdeleted file mode 100644index 7d9da2b88..000000000--- a/ui/component/or-rules-editor/src/const/resources.ts+++ /dev/null@@ -1,14 +0,0 @@-export const airlines = ["", "3O", "4U", "5O", "5P", "6H", "6Y", "8Q", "9W", "A3", "A5", "A9", "AA", "AC", "AF", "AI", "AM", "AR", "AT", "AY", "AZ", "B2", "BA", "BE", "BR", "BT", "CD", "CI", "CM", "CX", "CZ", "D8", "DL", "DS", "DT", "DY", "EI", "EK", "ET", "EW", "EY", "FB", "FH", "FI", "FR", "G3", "GA", "GM", "HV", "I2", "IB", "IR", "IZ", "JP", "JQ", "JU", "KC", "KE", "KK", "KL", "KM", "KQ", "LH", "LO", "LS", "LX", "LY", "MF", "MH", "MK", "MS", "MU", "N4", "NE", "NH", "NN", "OK", "OR", "OS", "OU", "P7", "PC", "PE", "PK", "PS", "PY", "QF", "QR", "QS", "RJ", "RO", "S4", "SA", "SK", "SM", "SQ", "SU", "SV", "SX", "TB", "TG", "TK", "TO", "TP", "TS", "TU", "U2", "UA", "UJ", "UL", "UU", "UX", "VN", "VR", "VS", "VY", "WW", "WX", "WY", "X3", "XC", "XG", "XQ", "XR", "YW", "Z4"];--export const languages = ["af", "am", "ar", "ay", "az", "be", "bg", "bi", "bn", "bs", "ca", "ch", "cs", "da", "de", "dv", "dz", "el", "en", "es", "et", "fa", "ff", "fi", "fj", "fo", "fr", "ga", "gn", "gv", "he", "hi", "hr", "ht", "hu", "hy", "id", "is", "it", "ja", "ka", "kg", "kk", "kl", "km", "ko", "ku", "ky", "la", "lb", "ln", "lo", "lt", "lu", "lv", "mg", "mh", "mi", "mk", "mn", "ms", "mt", "my", "na", "nb", "nd", "ne", "nl", "nn", "no", "nr", "ny", "pa", "pl", "ps", "pt", "qu", "rn", "ro", "ru", "rw", "sg", "si", "sk", "sl", "sm", "sn", "so", "sq", "sr", "ss", "st", "sv", "sw", "ta", "tg", "th", "ti", "tk", "tn", "to", "tr", "ts", "uk", "ur", "uz", "ve", "vi", "xh", "zh", "zsm", "zu"];--export const countries = ["AD", "AE", "AF", "AG", "AI", "AL", "AM", "AO", "AQ", "AR", "AS", "AT", "AU", "AW", "AX", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BL", "BM", "BN", "BO", "BQ", "BR", "BS", "BT", "BV", "BW", "BY", "BZ", "CA", "CC", "CD", "CF", "CG", "CH", "CI", "CK", "CL", "CM", "CN", "CO", "CR", "CU", "CV", "CW", "CX", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "EH", "ER", "ES", "ET", "FI", "FJ", "FK", "FM", "FO", "FR", "GA", "GB", "GD", "GE", "GF", "GG", "GH", "GI", "GL", "GM", "GN", "GP", "GQ", "GR", "GS", "GT", "GU", "GW", "GY", "HK", "HM", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IM", "IN", "IO", "IQ", "IR", "IS", "IT", "JE", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KP", "KR", "KW", "KY", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MF", "MG", "MH", "MK", "ML", "MM", "MN", "MO", "MP", "MQ", "MR", "MS", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NC", "NE", "NF", "NG", "NI", "NL", "NO", "NP", "NR", "NU", "NZ", "OM", "PA", "PE", "PF", "PG", "PH", "PK", "PL", "PM", "PN", "PR", "PS", "PT", "PW", "PY", "QA", "RE", "RO", "RS", "RU", "RW", "SA", "SB", "SC", "SD", "SE", "SG", "SH", "SI", "SJ", "SK", "SL", "SM", "SN", "SO", "SR", "SS", "ST", "SV", "SX", "SY", "SZ", "TC", "TD", "TF", "TG", "TH", "TJ", "TK", "TL", "TM", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "UM", "US", "UY", "UZ", "VA", "VC", "VE", "VG", "VI", "VN", "VU", "WF", "WS", "XK", "YE", "YT", "ZA", "ZM", "ZW"]--export const regions = ["Africa", "Americas", "Asia", "Europe", "Oceania", "Polar"];--export const airports = [" As", " Gu", " Ha", " La", " Ms", " QC", " Ru", " Sa", " We", "---", "AAA", "AAB", "AAC", "AAE", "AAF", "AAG", "AAH", "AAI", "AAJ", "AAK", "AAL", "AAM", "AAN", "AAO", "AAQ", "AAR", "AAT", "AAU", "AAV", "AAW", "AAX", "AAY", "AAZ", "ABA", "ABB", "ABC", "ABD", "ABE", "ABF", "ABG", "ABH", "ABI", "ABJ", "ABK", "ABL", "ABM", "ABN", "ABQ", "ABR", "ABS", "ABT", "ABU", "ABV", "ABX", "ABY", "ABZ", "ACA", "ACB", "ACC", "ACD", "ACE", "ACF", "ACH", "ACI", "ACJ", "ACK", "ACN", "ACP", "ACR", "ACS", "ACT", "ACV", "ACX", "ACY", "ACZ", "ADA", "ADB", "ADC", "ADD", "ADE", "ADF", "ADG", "ADH", "ADI", "ADJ", "ADK", "ADL", "ADM", "ADN", "ADO", "ADQ", "ADR", "ADS", "ADT", "ADU", "ADW", "ADX", "ADY", "ADZ", "AEA", "AEB", "AEG", "AEH", "AEL", "AEO", "AEP", "AER", "AES", "AET", "AEU", "AEX", "AEY", "AFA", "AFD", "AFE", "AFF", "AFI", "AFL", "AFN", "AFO", "AFS", "AFT", "AFW", "AFY", "AFZ", "AGA", "AGB", "AGC", "AGE", "AGF", "AGH", "AGI", "AGJ", "AGL", "AGO", "AGP", "AGQ", "AGR", "AGS", "AGT", "AGU", "AGV", "AGX", "AGZ", "AHB", "AHC", "AHE", "AHH", "AHI", "AHL", "AHM", "AHN", "AHO", "AHS", "AHU", "AHZ", "AIA", "AID", "AIE", "AIF", "AIG", "AII", "AIK", "AIN", "AIO", "AIR", "AIS", "AIT", "AIU", "AIV", "AIZ", "AJA", "AJF", "AJI", "AJJ", "AJK", "AJL", "AJN", "AJR", "AJU", "AJY", "AKA", "AKB", "AKC", "AKD", "AKF", "AKH", "AKI", "AKJ", "AKK", "AKL", "AKN", "AKO", "AKP", "AKR", "AKS", "AKT", "AKU", "AKV", "AKW", "AKX", "AKY", "ALA", "ALB", "ALC", "ALD", "ALF", "ALG", "ALH", "ALI", "ALJ", "ALL", "ALM", "ALN", "ALO", "ALP", "ALQ", "ALR", "ALS", "ALU", "ALW", "ALX", "ALY", "AMA", "AMB", "AMC", "AMD", "AMH", "AMI", "AMJ", "AMK", "AMM", "AMN", "AMO", "AMP", "AMQ", "AMS", "AMT", "AMU", "AMV", "AMW", "AMX", "AMZ", "ANB", "ANC", "AND", "ANE", "ANF", "ANG", "ANI", "ANJ", "ANK", "ANM", "ANN", "ANO", "ANP", "ANQ", "ANR", "ANS", "ANU", "ANV", "ANW", "ANX", "ANY", "AOC", "AOE", "AOG", "AOH", "AOI", "AOJ", "AOK", "AOL", "AOO", "AOP", "AOR", "AOT", "AOU", "AOY", "APA", "APB", "APC", "APE", "APF", "APG", "APH", "API", "APK", "APL", "APN", "APQ", "APS", "APT", "APU", "APV", "APW", "APX", "APY", "APZ", "AQA", "AQB", "AQG", "AQI", "AQJ", "AQM", "AQP", "ARA", "ARB", "ARC", "ARD", "ARE", "ARG", "ARH", "ARI", "ARJ", "ARK", "ARL", "ARM", "ARN", "ARR", "ARS", "ART", "ARU", "ARV", "ARW", "ARY", "ARZ", "ASA", "ASB", "ASC", "ASD", "ASE", "ASF", "ASG", "ASH", "ASI", "ASJ", "ASK", "ASL", "ASM", "ASN", "ASO", "ASP", "ASQ", "ASR", "AST", "ASU", "ASV", "ASW", "ASX", "ASY", "ATA", "ATB", "ATC", "ATD", "ATE", "ATF", "ATG", "ATH", "ATI", "ATJ", "ATK", "ATL", "ATM", "ATO", "ATP", "ATQ", "ATR", "ATS", "ATV", "ATW", "ATY", "ATZ", "AUA", "AUC", "AUD", "AUF", "AUG", "AUH", "AUJ", "AUK", "AUM", "AUN", "AUO", "AUQ", "AUR", "AUS", "AUT", "AUU", "AUW", "AUX", "AUY", "AUZ", "AVA", "AVB", "AVG", "AVI", "AVK", "AVL", "AVN", "AVO", "AVP", "AVU", "AVV", "AVW", "AWA", "AWB", "AWD", "AWK", "AWM", "AWN", "AWP", "AWZ", "AXA", "AXC", "AXD", "AXE", "AXG", "AXK", "AXL", "AXM", "AXN", "AXP", "AXR", "AXS", "AXT", "AXU", "AXV", "AXX", "AYG", "AYK", "AYL", "AYN", "AYO", "AYP", "AYQ", "AYR", "AYS", "AYT", "AYU", "AZA", "AZD", "AZI", "AZL", "AZN", "AZO", "AZP", "AZR", "AZS", "AZZ", "BAB", "BAD", "BAE", "BAF", "BAG", "BAH", "BAI", "BAL", "BAN", "BAO", "BAQ", "BAS", "BAT", "BAU", "BAV", "BAX", "BAY", "BAZ", "BBA", "BBB", "BBC", "BBD", "BBE", "BBG", "BBH", "BBI", "BBJ", "BBK", "BBL", "BBM", "BBN", "BBO", "BBP", "BBQ", "BBR", "BBS", "BBT", "BBU", "BBV", "BBW", "BBX", "BBY", "BBZ", "BCA", "BCB", "BCD", "BCE", "BCF", "BCG", "BCH", "BCI", "BCL", "BCM", "BCN", "BCO", "BCR", "BCS", "BCT", "BCX", "BDA", "BDB", "BDC", "BDD", "BDE", "BDF", "BDH", "BDI", "BDJ", "BDK", "BDL", "BDM", "BDN", "BDO", "BDP", "BDQ", "BDR", "BDS", "BDT", "BDU", "BDV", "BDW", "BDX", "BDY", "BDZ", "BEB", "BEC", "BED", "BEF", "BEG", "BEH", "BEI", "BEJ", "BEL", "BEM", "BEN", "BEO", "BEP", "BEQ", "BES", "BET", "BEU", "BEV", "BEW", "BEX", "BEY", "BEZ", "BFA", "BFD", "BFE", "BFF", "BFG", "BFH", "BFI", "BFJ", "BFK", "BFL", "BFM", "BFN", "BFO", "BFP", "BFR", "BFS", "BFT", "BFU", "BFV", "BFW", "BFX", "BGA", "BGB", "BGC", "BGD", "BGE", "BGF", "BGH", "BGI", "BGJ", "BGL", "BGM", "BGN", "BGO", "BGQ", "BGR", "BGS", "BGT", "BGU", "BGV", "BGW", "BGX", "BGY", "BGZ", "BHA", "BHB", "BHD", "BHE", "BHG", "BHH", "BHI", "BHJ", "BHK", "BHM", "BHN", "BHO", "BHP", "BHQ", "BHR", "BHS", "BHU", "BHV", "BHW", "BHX", "BHY", "BIA", "BIB", "BID", "BIE", "BIF", "BIG", "BIH", "BIK", "BIL", "BIM", "BIN", "BIO", "BIP", "BIQ", "BIR", "BIS", "BIT", "BIU", "BIV", "BIW", "BIX", "BIY", "BJA", "BJB", "BJC", "BJD", "BJF", "BJH", "BJK", "BJL", "BJM", "BJO", "BJP", "BJR", "BJU", "BJV", "BJW", "BJX", "BJY", "BJZ", "BKA", "BKB", "BKC", "BKD", "BKE", "BKG", "BKH", "BKI", "BKJ", "BKK", "BKL", "BKM", "BKO", "BKP", "BKQ", "BKR", "BKS", "BKT", "BKU", "BKW", "BKX", "BKY", "BKZ", "BLA", "BLB", "BLC", "BLD", "BLE", "BLF", "BLG", "BLH", "BLI", "BLJ", "BLK", "BLL", "BLN", "BLO", "BLP", "BLQ", "BLR", "BLS", "BLT", "BLU", "BLV", "BLX", "BLY", "BLZ", "BMA", "BMB", "BMC", "BMD", "BME", "BMF", "BMG", "BMI", "BMJ", "BMK", "BML", "BMM", "BMN", "BMO", "BMP", "BMR", "BMS", "BMT", "BMU", "BMV", "BMW", "BMX", "BMY", "BNA", "BNB", "BNC", "BND", "BNE", "BNG", "BNI", "BNK", "BNL", "BNN", "BNO", "BNP", "BNR", "BNS", "BNU", "BNW", "BNX", "BNY", "BOA", "BOB", "BOC", "BOD", "BOE", "BOG", "BOH", "BOI", "BOJ", "BOL", "BOM", "BON", "BOO", "BOP", "BOR", "BOS", "BOU", "BOW", "BOX", "BOY", "BOZ", "BPC", "BPF", "BPG", "BPH", "BPI", "BPL", "BPM", "BPN", "BPR", "BPS", "BPT", "BPX", "BPY", "BQA", "BQB", "BQD", "BQE", "BQG", "BQH", "BQK", "BQL", "BQN", "BQO", "BQQ", "BQS", "BQT", "BQU", "BQW", "BRA", "BRB", "BRC", "BRD", "BRE", "BRI", "BRK", "BRL", "BRM", "BRN", "BRO", "BRQ", "BRR", "BRS", "BRT", "BRU", "BRV", "BRW", "BRX", "BRY", "BSA", "BSB", "BSC", "BSD", "BSE", "BSF", "BSG", "BSJ", "BSK", "BSL", "BSM", "BSN", "BSO", "BSQ", "BSR", "BSS", "BST", "BSU", "BSW", "BSX", "BSY", "BSZ", "BTA", "BTB", "BTC", "BTD", "BTE", "BTF", "BTG", "BTH", "BTI", "BTJ", "BTK", "BTL", "BTM", "BTN", "BTO", "BTQ", "BTR", "BTS", "BTT", "BTU", "BTV", "BTW", "BTX", "BTY", "BTZ", "BUA", "BUB", "BUC", "BUD", "BUF", "BUG", "BUI", "BUJ", "BUL", "BUM", "BUN", "BUO", "BUP", "BUQ", "BUR", "BUS", "BUW", "BUX", "BUY", "BUZ", "BVA", "BVB", "BVC", "BVE", "BVG", "BVH", "BVI", "BVK", "BVL", "BVM", "BVO", "BVR", "BVS", "BVU", "BVX", "BVY", "BVZ", "BWA", "BWB", "BWC", "BWD", "BWE", "BWF", "BWG", "BWH", "BWI", "BWK", "BWL", "BWM", "BWN", "BWO", "BWQ", "BWT", "BWU", "BWW", "BXA", "BXB", "BXD", "BXE", "BXG", "BXH", "BXI", "BXJ", "BXK", "BXN", "BXO", "BXP", "BXR", "BXS", "BXT", "BXU", "BXV", "BYC", "BYF", "BYJ", "BYK", "BYM", "BYN", "BYQ", "BYR", "BYS", "BYT", "BYU", "BYW", "BZA", "BZC", "BZD", "BZE", "BZG", "BZI", "BZK", "BZL", "BZN", "BZO", "BZP", "BZR", "BZU", "BZV", "BZY", "BZZ", "CAA", "CAB", "CAC", "CAD", "CAE", "CAF", "CAG", "CAH", "CAI", "CAJ", "CAK", "CAL", "CAM", "CAN", "CAO", "CAP", "CAQ", "CAR", "CAS", "CAT", "CAU", "CAV", "CAW", "CAX", "CAY", "CAZ", "CBB", "CBD", "CBE", "CBF", "CBG", "CBH", "CBI", "CBJ", "CBK", "CBL", "CBM", "CBN", "CBO", "CBP", "CBQ", "CBR", "CBS", "CBT", "CBU", "CBV", "CBW", "CBX", "CBY", "CCB", "CCC", "CCF", "CCG", "CCH", "CCI", "CCJ", "CCK", "CCL", "CCM", "CCN", "CCO", "CCP", "CCR", "CCS", "CCT", "CCU", "CCV", "CCW", "CCX", "CCY", "CCZ", "CDA", "CDB", "CDC", "CDD", "CDF", "CDG", "CDH", "CDI", "CDJ", "CDK", "CDL", "CDN", "CDO", "CDP", "CDQ", "CDR", "CDS", "CDT", "CDU", "CDV", "CDW", "CDY", "CEB", "CEC", "CED", "CEE", "CEF", "CEG", "CEH", "CEI", "CEK", "CEM", "CEN", "CEO", "CEP", "CEQ", "CER", "CES", "CET", "CEX", "CEZ", "CFB", "CFE", "CFF", "CFG", "CFI", "CFN", "CFO", "CFR", "CFS", "CFU", "CGB", "CGD", "CGH", "CGI", "CGK", "CGM", "CGN", "CGO", "CGP", "CGQ", "CGR", "CGV", "CGY", "CHA", "CHB", "CHC", "CHF", "CHG", "CHH", "CHJ", "CHM", "CHN", "CHO", "CHQ", "CHR", "CHS", "CHT", "CHU", "CHV", "CHX", "CHY", "CIA", "CID", "CIF", "CIH", "CII", "CIJ", "CIK", "CIM", "CIO", "CIP", "CIQ", "CIS", "CIT", "CIU", "CIW", "CIX", "CIY", "CIZ", "CJA", "CJB", "CJC", "CJJ", "CJL", "CJM", "CJS", "CJT", "CJU", "CKB", "CKC", "CKG", "CKH", "CKI", "CKO", "CKS", "CKT", "CKY", "CKZ", "CLA", "CLB", "CLE", "CLH", "CLJ", "CLL", "CLM", "CLN", "CLO", "CLP", "CLQ", "CLT", "CLV", "CLX", "CLY", "CLZ", "CMA", "CMB", "CMC", "CMD", "CME", "CMF", "CMG", "CMH", "CMI", "CMK", "CML", "CMM", "CMN", "CMO", "CMP", "CMQ", "CMR", "CMS", "CMU", "CMV", "CMW", "CMX", "CNA", "CNB", "CNC", "CND", "CNF", "CNG", "CNI", "CNJ", "CNL", "CNM", "CNN", "CNP", "CNQ", "CNR", "CNS", "CNV", "CNX", "COC", "COG", "COH", "COJ", "COK", "COL", "COO", "COQ", "COR", "COS", "COU", "COV", "COW", "COX", "COZ", "CPA", "CPB", "CPC", "CPD", "CPE", "CPF", "CPH", "CPL", "CPO", "CPQ", "CPR", "CPT", "CPU", "CPV", "CPX", "CQA", "CQD", "CQF", "CQS", "CRA", "CRB", "CRC", "CRD", "CRF", "CRI", "CRK", "CRL", "CRM", "CRO", "CRP", "CRQ", "CRR", "CRU", "CRV", "CRW", "CRZ", "CSA", "CSB", "CSC", "CSF", "CSG", "CSH", "CSI", "CSK", "CSO", "CSU", "CSX", "CSY", "CSZ", "CTA", "CTC", "CTD", "CTF", "CTG", "CTI", "CTL", "CTM", "CTN", "CTP", "CTQ", "CTS", "CTT", "CTU", "CUA", "CUC", "CUD", "CUE", "CUF", "CUG", "CUL", "CUM", "CUN", "CUO", "CUP", "CUQ", "CUR", "CUT", "CUU", "CUV", "CUY", "CUZ", "CVC", "CVE", "CVF", "CVG", "CVH", "CVJ", "CVM", "CVN", "CVQ", "CVT", "CVU", "CWB", "CWC", "CWE", "CWF", "CWL", "CWR", "CWT", "CWW", "CWX", "CXA", "CXB", "CXI", "CXJ", "CXM", "CXN", "CXP", "CXR", "CXT", "CXY", "CYA", "CYB", "CYG", "CYI", "CYO", "CYP", "CYR", "CYS", "CYU", "CYW", "CYX", "CYZ", "CZA", "CZE", "CZF", "CZL", "CZM", "CZS", "CZU", "CZW", "CZX", "CZY", "DAA", "DAB", "DAC", "DAD", "DAE", "DAG", "DAK", "DAL", "DAM", "DAN", "DAP", "DAR", "DAS", "DAT", "DAU", "DAV", "DAX", "DAY", "DAZ", "DBA", "DBB", "DBD", "DBM", "DBN", "DBO", "DBQ", "DBT", "DBV", "DBY", "DCA", "DCF", "DCI", "DCM", "DCN", "DCT", "DCU", "DDC", "DDG", "DDN", "DDU", "DEA", "DEB", "DEC", "DED", "DEE", "DEF", "DEH", "DEI", "DEL", "DEM", "DEN", "DER", "DES", "DET", "DEZ", "DFI", "DFP", "DFW", "DGD", "DGE", "DGF", "DGL", "DGN", "DGO", "DGP", "DGR", "DGT", "DGU", "DGW", "DGX", "DHA", "DHD", "DHF", "DHI", "DHM", "DHN", "DHR", "DHT", "DIB", "DIE", "DIG", "DIJ", "DIK", "DIL", "DIM", "DIN", "DIP", "DIQ", "DIR", "DIS", "DIU", "DIY", "DJA", "DJB", "DJE", "DJG", "DJJ", "DJM", "DJO", "DJR", "DJU", "DKR", "DKS", "DKV", "DLA", "DLC", "DLD", "DLE", "DLG", "DLH", "DLI", "DLK", "DLM", "DLU", "DLV", "DLX", "DLY", "DLZ", "DMB", "DMD", "DME", "DMK", "DMM", "DMT", "DMU", "DNA", "DNB", "DND", "DNH", "DNK", "DNL", "DNM", "DNO", "DNP", "DNR", "DNX", "DNZ", "DOB", "DOD", "DOE", "DOG", "DOH", "DOK", "DOL", "DOM", "DON", "DOP", "DOR", "DOU", "DOX", "DOY", "DPA", "DPE", "DPG", "DPL", "DPO", "DPS", "DQA", "DQH", "DRB", "DRD", "DRG", "DRJ", "DRK", "DRN", "DRO", "DRR", "DRS", "DRT", "DRW", "DRY", "DSA", "DSC", "DSD", "DSE", "DSI", "DSK", "DSM", "DSN", "DSO", "DSV", "DTA", "DTD", "DTE", "DTI", "DTL", "DTM", "DTN", "DTR", "DTW", "DUA", "DUB", "DUC", "DUD", "DUE", "DUF", "DUG", "DUJ", "DUK", "DUM", "DUQ", "DUR", "DUS", "DUT", "DVK", "DVL", "DVN", "DVO", "DVP", "DVR", "DVT", "DWA", "DWB", "DWC", "DWD", "DWH", "DWN", "DXB", "DXD", "DXR", "DYA", "DYG", "DYL", "DYR", "DYS", "DYU", "DYW", "DZA", "DZN", "DZO", "EAE", "EAM", "EAR", "EAS", "EAU", "EBA", "EBB", "EBD", "EBG", "EBH", "EBJ", "EBL", "EBM", "EBS", "EBU", "EBW", "ECG", "ECH", "ECN", "ECP", "ECV", "EDB", "EDF", "EDI", "EDL", "EDM", "EDO", "EDR", "EEK", "EEN", "EFK", "EFL", "EGC", "EGE", "EGH", "EGM", "EGN", "EGO", "EGS", "EGX", "EHL", "EHM", "EIE", "EIH", "EIK", "EIL", "EIN", "EIS", "EIY", "EJA", "EJH", "EKB", "EKO", "EKS", "EKT", "ELB", "ELC", "ELD", "ELF", "ELG", "ELH", "ELI", "ELL", "ELM", "ELO", "ELP", "ELQ", "ELS", "ELT", "ELU", "EMA", "EMD", "EME", "EMG", "EMK", "EMN", "EMX", "ENA", "ENB", "ENC", "END", "ENE", "ENF", "ENH", "ENK", "ENN", "ENO", "ENS", "ENT", "ENU", "ENY", "EOH", "EOI", "EOR", "EOZ", "EPA", "EPL", "EPR", "EPS", "EPU", "EQS", "ERA", "ERB", "ERC", "ERD", "ERF", "ERG", "ERH", "ERI", "ERM", "ERN", "ERS", "ERZ", "ESB", "ESD", "ESE", "ESG", "ESH", "ESI", "ESK", "ESL", "ESM", "ESR", "ESS", "ESU", "ETD", "ETH", "ETR", "ETZ", "EUA", "EUC", "EUG", "EUM", "EUN", "EUQ", "EUX", "EVD", "EVE", "EVG", "EVH", "EVN", "EVV", "EVW", "EVX", "EWB", "EWI", "EWK", "EWN", "EWO", "EWR", "EXM", "EXT", "EYL", "EYP", "EYR", "EYS", "EYW", "EZE", "EZS", "EZV", "FAA", "FAB", "FAC", "FAE", "FAG", "FAH", "FAI", "FAJ", "FAN", "FAO", "FAQ", "FAR", "FAS", "FAT", "FAU", "FAV", "FAY", "FAZ", "FBA", "FBD", "FBE", "FBG", "FBK", "FBM", "FCA", "FCB", "FCO", "FCS", "FDA", "FDE", "FDF", "FDH", "FDO", "FDU", "FEB", "FEC", "FEG", "FEJ", "FEK", "FEL", "FEN", "FEZ", "FFD", "FFU", "FGD", "FGI", "FGU", "FHB", "FHU", "FHZ", "FID", "FIE", "FIG", "FIH", "FIK", "FIL", "FIN", "FIZ", "FJR", "FKB", "FKI", "FKJ", "FKQ", "FKS", "FLA", "FLB", "FLF", "FLG", "FLI", "FLL", "FLM", "FLN", "FLO", "FLR", "FLS", "FLW", "FLY", "FMA", "FMC", "FMG", "FMI", "FMM", "FMO", "FMS", "FMU", "FNA", "FNB", "FNC", "FNE", "FNG", "FNH", "FNI", "FNJ", "FNT", "FNU", "FOB", "FOC", "FOD", "FOE", "FOG", "FOM", "FON", "FOO", "FOR", "FOS", "FOT", "FOU", "FPO", "FPR", "FPY", "FRA", "FRC", "FRD", "FRE", "FRF", "FRH", "FRI", "FRK", "FRL", "FRM", "FRO", "FRS", "FRT", "FRU", "FRW", "FRZ", "FSC", "FSD", "FSM", "FSP", "FSS", "FTA", "FTE", "FTI", "FTU", "FTW", "FTX", "FUE", "FUG", "FUJ", "FUK", "FUL", "FUN", "FUO", "FUT", "FVL", "FVM", "FWA", "FXO", "FYT", "FYU", "FYV", "FZO", "GAB", "GAE", "GAF", "GAG", "GAH", "GAJ", "GAL", "GAM", "GAN", "GAO", "GAP", "GAQ", "GAR", "GAS", "GAT", "GAU", "GAW", "GAY", "GBB", "GBD", "GBE", "GBF", "GBJ", "GBK", "GBL", "GBT", "GBU", "GBV", "GBZ", "GCD", "GCI", "GCJ", "GCK", "GCM", "GCN", "GCW", "GDD", "GDE", "GDG", "GDI", "GDJ", "GDL", "GDN", "GDO", "GDP", "GDQ", "GDT", "GDV", "GDX", "GDY", "GDZ", "GEA", "GEB", "GEE", "GEF", "GEG", "GEL", "GEO", "GER", "GES", "GET", "GEV", "GEX", "GFF", "GFK", "GFN", "GFO", "GFR", "GFY", "GGD", "GGG", "GGM", "GGN", "GGO", "GGS", "GGT", "GGW", "GHA", "GHB", "GHC", "GHT", "GHU", "GIB", "GIC", "GID", "GIG", "GII", "GIL", "GIR", "GIS", "GIU", "GIY", "GIZ", "GJA", "GJL", "GJM", "GJR", "GJT", "GKA", "GKD", "GKE", "GKH", "GKN", "GLA", "GLF", "GLG", "GLH", "GLI", "GLJ", "GLK", "GLL", "GLM", "GLO", "GLS", "GLT", "GLV", "GLX", "GLZ", "GMA", "GMB", "GMD", "GME", "GMI", "GML", "GMM", "GMN", "GMO", "GMP", "GMR", "GMS", "GMT", "GNA", "GNB", "GND", "GNF", "GNI", "GNM", "GNN", "GNR", "GNS", "GNV", "GNY", "GNZ", "GOA", "GOB", "GOG", "GOH", "GOI", "GOJ", "GOM", "GON", "GOO", "GOP", "GOQ", "GOR", "GOT", "GOU", "GOV", "GOY", "GOZ", "GPA", "GPB", "GPI", "GPL", "GPN", "GPO", "GPS", "GPT", "GRB", "GRI", "GRJ", "GRK", "GRL", "GRO", "GRP", "GRQ", "GRR", "GRS", "GRU", "GRV", "GRW", "GRX", "GRY", "GRZ", "GSA", "GSE", "GSJ", "GSN", "GSO", "GSP", "GSQ", "GSR", "GSS", "GST", "GSU", "GTA", "GTE", "GTF", "GTI", "GTN", "GTO", "GTP", "GTR", "GTS", "GTT", "GTW", "GUA", "GUB", "GUD", "GUH", "GUI", "GUJ", "GUL", "GUP", "GUQ", "GUR", "GUT", "GUU", "GUV", "GUW", "GUX", "GUZ", "GVA", "GVI", "GVN", "GVP", "GVR", "GVT", "GVX", "GWA", "GWD", "GWE", "GWL", "GWT", "GWY", "GXF", "GXG", "GXQ", "GXX", "GYA", "GYD", "GYE", "GYI", "GYL", "GYM", "GYN", "GYP", "GYS", "GYU", "GYY", "GZO", "GZP", "GZT", "HAA", "HAC", "HAD", "HAH", "HAJ", "HAK", "HAM", "HAN", "HAQ", "HAS", "HAU", "HAV", "HAW", "HBA", "HBE", "HBK", "HBT", "HBU", "HBX", "HCM", "HCN", "HCQ", "HCR", "HDD", "HDF", "HDG", "HDH", "HDM", "HDN", "HDR", "HDS", "HDY", "HEA", "HED", "HEG", "HEH", "HEI", "HEK", "HEL", "HEM", "HER", "HET", "HEV", "HEW", "HFA", "HFE", "HFN", "HFS", "HFT", "HGA", "HGD", "HGH", "HGL", "HGN", "HGO", "HGR", "HGS", "HGU", "HGZ", "HHE", "HHI", "HHN", "HHQ", "HHZ", "HIA", "HIB", "HID", "HIJ", "HIN", "HIP", "HIR", "HIW", "HJJ", "HJR", "HKD", "HKG", "HKK", "HKN", "HKT", "HKY", "HLA", "HLD", "HLF", "HLH", "HLJ", "HLN", "HLO", "HLP", "HLS", "HLT", "HLU", "HLW", "HLY", "HLZ", "HMA", "HMB", "HME", "HMG", "HMI", "HMJ", "HMO", "HMR", "HMV", "HNA", "HNC", "HND", "HNE", "HNH", "HNL", "HNM", "HNS", "HNY", "HOA", "HOD", "HOF", "HOG", "HOH", "HOI", "HOK", "HOM", "HON", "HOQ", "HOR", "HOS", "HOT", "HOU", "HOV", "HOX", "HPA", "HPB", "HPH", "HPN", "HRB", "HRE", "HRG", "HRK", "HRL", "HRM", "HRO", "HRS", "HRT", "HSG", "HSM", "HSN", "HSS", "HSV", "HTA", "HTG", "HTI", "HTN", "HTR", "HTS", "HTU", "HTY", "HTZ", "HUB", "HUE", "HUF", "HUG", "HUH", "HUI", "HUN", "HUQ", "HUU", "HUX", "HUY", "HUZ", "HVA", "HVB", "HVD", "HVG", "HVK", "HVM", "HVN", "HVR", "HWK", "HWN", "HXX", "HYA", "HYC", "HYD", "HYN", "HYS", "HYV", "HZB", "HZG", "HZK", "HZP", "IAA", "IAB", "IAD", "IAG", "IAH", "IAM", "IAN", "IAO", "IAR", "IAS", "IBA", "IBB", "IBE", "IBP", "IBR", "IBZ", "ICA", "ICI", "ICK", "ICN", "ICR", "ICS", "ICT", "ICY", "IDA", "IDB", "IDF", "IDH", "IDK", "IDO", "IDR", "IDY", "IEG", "IEJ", "IEV", "IFF", "IFH", "IFJ", "IFL", "IFN", "IFO", "IFP", "IGA", "IGB", "IGD", "IGG", "IGH", "IGL", "IGM", "IGN", "IGO", "IGR", "IGS", "IGT", "IGU", "IHC", "IHN", "IHO", "IIA", "IIL", "IJK", "IJU", "IKA", "IKI", "IKL", "IKO", "IKP", "IKS", "IKT", "ILA", "ILD", "ILF", "ILG", "ILI", "ILK", "ILM", "ILO", "ILP", "ILQ", "ILR", "ILU", "ILY", "ILZ", "IMB", "IMF", "IMK", "IMO", "IMP", "IMT", "INA", "INC", "IND", "INF", "ING", "INH", "INI", "INJ", "INL", "INM", "INN", "INO", "INQ", "INT", "INU", "INV", "INX", "INZ", "IOA", "IOM", "ION", "IOR", "IOS", "IOU", "IPA", "IPC", "IPE", "IPG", "IPH", "IPI", "IPL", "IPN", "IPT", "IPU", "IQA", "IQM", "IQN", "IQQ", "IQT", "IRA", "IRC", "IRD", "IRE", "IRG", "IRI", "IRJ", "IRK", "IRM", "IRO", "IRP", "IRZ", "ISA", "ISB", "ISC", "ISE", "ISG", "ISI", "ISJ", "ISK", "ISN", "ISP", "IST", "ISU", "ITA", "ITB", "ITH", "ITI", "ITM", "ITO", "ITQ", "IUD", "IUE", "IVA", "IVC", "IVG", "IVL", "IVR", "IVW", "IWA", "IWJ", "IWO", "IXA", "IXB", "IXC", "IXD", "IXE", "IXG", "IXH", "IXI", "IXJ", "IXK", "IXL", "IXM", "IXN", "IXP", "IXQ", "IXR", "IXS", "IXT", "IXU", "IXV", "IXW", "IXY", "IXZ", "IYK", "IYS", "IZA", "IZO", "IZT", "Id", "JAA", "JAB", "JAC", "JAD", "JAF", "JAG", "JAI", "JAK", "JAL", "JAM", "JAN", "JAU", "JAV", "JAX", "JBQ", "JBR", "JCB", "JCK", "JCM", "JCR", "JDF", "JDH", "JDO", "JDR", "JDZ", "JED", "JEE", "JEG", "JEQ", "JER", "JFK", "JFR", "JGA", "JGN", "JGS", "JHB", "JHG", "JHL", "JHM", "JHQ", "JHS", "JIA", "JIB", "JIC", "JIK", "JIL", "JIM", "JIN", "JIP", "JIR", "JIU", "JIW", "JJI", "JJM", "JJN", "JKG", "JKH", "JKR", "JLN", "JLR", "JLS", "JMK", "JMO", "JMS", "JMU", "JNA", "JNG", "JNI", "JNU", "JNX", "JNZ", "JOE", "JOG", "JOH", "JOI", "JOK", "JOL", "JOM", "JOS", "JPA", "JPR", "JQA", "JQE", "JRF", "JRH", "JRN", "JRO", "JSA", "JSH", "JSI", "JSM", "JSR", "JST", "JSU", "JSY", "JTR", "JTY", "JUB", "JUI", "JUJ", "JUL", "JUM", "JUN", "JUR", "JUT", "JUV", "JUZ", "JVA", "JWA", "JYV", "JZH", "KAA", "KAB", "KAC", "KAD", "KAG", "KAJ", "KAL", "KAN", "KAO", "KAP", "KAR", "KAT", "KAU", "KAV", "KAW", "KAX", "KAY", "KAZ", "KBA", "KBB", "KBG", "KBH", "KBI", "KBL", "KBM", "KBN", "KBO", "KBP", "KBQ", "KBR", "KBS", "KBU", "KBV", "KBY", "KBZ", "KCA", "KCB", "KCE", "KCH", "KCM", "KCO", "KCS", "KCT", "KCU", "KCZ", "KDA", "KDC", "KDD", "KDH", "KDI", "KDJ", "KDL", "KDM", "KDN", "KDO", "KDR", "KDT", "KDU", "KDV", "KDX", "KEC", "KED", "KEE", "KEF", "KEI", "KEJ", "KEL", "KEM", "KEN", "KEO", "KEP", "KEQ", "KER", "KET", "KEV", "KEY", "KFA", "KFE", "KFG", "KFP", "KFS", "KGA", "KGC", "KGD", "KGE", "KGF", "KGG", "KGI", "KGJ", "KGL", "KGO", "KGP", "KGS", "KGU", "KGY", "KHC", "KHD", "KHE", "KHG", "KHH", "KHI", "KHJ", "KHK", "KHM", "KHN", "KHR", "KHS", "KHT", "KHV", "KHW", "KHY", "KHZ", "KIA", "KID", "KIF", "KIH", "KIJ", "KIK", "KIM", "KIN", "KIP", "KIR", "KIS", "KIT", "KIV", "KIW", "KIX", "KIY", "KJA", "KJK", "KJP", "KKA", "KKC", "KKD", "KKE", "KKJ", "KKM", "KKN", "KKO", "KKP", "KKR", "KKW", "KKX", "KKY", "KKZ", "KLB", "KLC", "KLD", "KLE", "KLG", "KLH", "KLI", "KLJ", "KLK", "KLO", "KLQ", "KLR", "KLU", "KLV", "KLX", "KLY", "KLZ", "KMA", "KME", "KMG", "KMH", "KMI", "KMJ", "KMK", "KML", "KMN", "KMO", "KMP", "KMQ", "KMR", "KMS", "KMU", "KMV", "KMW", "KMX", "KMZ", "KNA", "KND", "KNG", "KNH", "KNI", "KNJ", "KNK", "KNM", "KNN", "KNQ", "KNR", "KNS", "KNU", "KNW", "KNX", "KNZ", "KOA", "KOC", "KOE", "KOF", "KOI", "KOJ", "KOK", "KOO", "KOP", "KOS", "KOT", "KOU", "KOV", "KOW", "KOX", "KPC", "KPI", "KPM", "KPO", "KPS", "KQT", "KRA", "KRB", "KRE", "KRF", "KRG", "KRH", "KRI", "KRJ", "KRK", "KRL", "KRM", "KRN", "KRO", "KRP", "KRQ", "KRR", "KRS", "KRT", "KRW", "KRY", "KRZ", "KSA", "KSC", "KSD", "KSE", "KSF", "KSH", "KSI", "KSJ", "KSK", "KSL", "KSM", "KSN", "KSO", "KSQ", "KSS", "KST", "KSU", "KSV", "KSW", "KSY", "KSZ", "KTA", "KTD", "KTE", "KTF", "KTG", "KTI", "KTL", "KTM", "KTN", "KTO", "KTP", "KTQ", "KTR", "KTT", "KTU", "KTW", "KTX", "KUA", "KUC", "KUD", "KUF", "KUG", "KUH", "KUL", "KUM", "KUN", "KUO", "KUQ", "KUS", "KUT", "KUU", "KUV", "KVA", "KVB", "KVC", "KVD", "KVG", "KVK", "KVL", "KVX", "KWA", "KWE", "KWG", "KWH", "KWI", "KWJ", "KWL", "KWM", "KWO", "KWS", "KWT", "KWZ", "KXE", "KXF", "KXK", "KYA", "KYD", "KYE", "KYF", "KYI", "KYK", "KYP", "KYS", "KYT", "KYU", "KYZ", "KZC", "KZF", "KZI", "KZN", "KZO", "KZS", "LAD", "LAE", "LAF", "LAH", "LAI", "LAJ", "LAK", "LAN", "LAO", "LAP", "LAQ", "LAR", "LAS", "LAU", "LAX", "LAY", "LAZ", "LBA", "LBB", "LBC", "LBD", "LBE", "LBF", "LBG", "LBI", "LBJ", "LBL", "LBO", "LBQ", "LBR", "LBS", "LBU", "LBV", "LBW", "LBX", "LBY", "LCA", "LCC", "LCD", "LCE", "LCF", "LCG", "LCH", "LCJ", "LCL", "LCM", "LCN", "LCO", "LCV", "LCX", "LCY", "LDA", "LDB", "LDC", "LDE", "LDH", "LDI", "LDK", "LDN", "LDO", "LDS", "LDU", "LDV", "LDX", "LDY", "LDZ", "LEA", "LEB", "LEC", "LED", "LEF", "LEH", "LEI", "LEJ", "LEK", "LEL", "LEN", "LEP", "LEQ", "LER", "LES", "LET", "LEU", "LEV", "LEX", "LEY", "LEZ", "LFB", "LFO", "LFR", "LFT", "LFW", "LGA", "LGB", "LGG", "LGH", "LGI", "LGK", "LGL", "LGO", "LGP", "LGQ", "LGR", "LGS", "LGW", "LHA", "LHE", "LHG", "LHI", "LHK", "LHR", "LHS", "LIA", "LIE", "LIF", "LIG", "LIH", "LII", "LIL", "LIM", "LIN", "LIO", "LIP", "LIQ", "LIR", "LIS", "LIT", "LIW", "LIX", "LJA", "LJG", "LJU", "LKA", "LKB", "LKG", "LKH", "LKL", "LKN", "LKO", "LKW", "LKY", "LKZ", "LLA", "LLE", "LLF", "LLG", "LLI", "LLJ", "LLK", "LLS", "LLW", "LLX", "LMB", "LME", "LMI", "LMM", "LMN", "LMO", "LMP", "LMQ", "LMR", "LMT", "LMY", "LNB", "LNE", "LNI", "LNK", "LNO", "LNS", "LNV", "LNX", "LNY", "LNZ", "LOA", "LOB", "LOC", "LOD", "LOE", "LOH", "LOK", "LOO", "LOP", "LOS", "LOV", "LOY", "LPA", "LPB", "LPD", "LPG", "LPI", "LPJ", "LPK", "LPL", "LPM", "LPP", "LPQ", "LPT", "LPU", "LPX", "LPY", "LQM", "LQN", "LRA", "LRB", "LRD", "LRE", "LRG", "LRH", "LRL", "LRM", "LRR", "LRS", "LRT", "LRU", "LRV", "LSA", "LSC", "LSE", "LSH", "LSI", "LSL", "LSM", "LSO", "LSP", "LSQ", "LSS", "LST", "LSU", "LSW", "LSX", "LSY", "LSZ", "LTA", "LTC", "LTD", "LTG", "LTI", "LTK", "LTL", "LTM", "LTN", "LTO", "LTP", "LTQ", "LTR", "LTT", "LTU", "LTV", "LTX", "LUA", "LUB", "LUC", "LUD", "LUE", "LUG", "LUH", "LUJ", "LUK", "LUM", "LUN", "LUO", "LUP", "LUQ", "LUR", "LUS", "LUT", "LUU", "LUV", "LUW", "LUX", "LVA", "LVB", "LVI", "LVO", "LVP", "LVR", "LWB", "LWH", "LWK", "LWN", "LWO", "LWR", "LWS", "LWT", "LWY", "LXA", "LXG", "LXR", "LXS", "LXU", "LYA", "LYB", "LYC", "LYE", "LYG", "LYH", "LYI", "LYN", "LYP", "LYR", "LYS", "LZA", "LZC", "LZH", "LZI", "LZN", "LZO", "LZR", "LZY", "MAA", "MAB", "MAD", "MAF", "MAG", "MAH", "MAI", "MAJ", "MAK", "MAL", "MAM", "MAN", "MAO", "MAQ", "MAR", "MAS", "MAT", "MAU", "MAX", "MAY", "MAZ", "MBA", "MBB", "MBC", "MBD", "MBE", "MBH", "MBI", "MBJ", "MBK", "MBO", "MBP", "MBQ", "MBS", "MBT", "MBU", "MBW", "MBX", "MBZ", "MCA", "MCE", "MCG", "MCH", "MCI", "MCJ", "MCN", "MCO", "MCP", "MCQ", "MCR", "MCS", "MCT", "MCU", "MCV", "MCW", "MCX", "MCY", "MCZ", "MDC", "MDE", "MDG", "MDH", "MDI", "MDK", "MDL", "MDO", "MDP", "MDQ", "MDS", "MDT", "MDU", "MDW", "MDX", "MDY", "MDZ", "MEA", "MEB", "MEC", "MED", "MEE", "MEG", "MEH", "MEI", "MEK", "MEL", "MEM", "MEN", "MEP", "MEQ", "MER", "MES", "MET", "MEU", "MEW", "MEX", "MEY", "MEZ", "MFA", "MFC", "MFE", "MFF", "MFG", "MFJ", "MFK", "MFM", "MFN", "MFO", "MFP", "MFQ", "MFR", "MFS", "MFU", "MFX", "MGA", "MGB", "MGD", "MGF", "MGH", "MGK", "MGL", "MGM", "MGN", "MGQ", "MGS", "MGT", "MGU", "MGV", "MGW", "MGX", "MGZ", "MHA", "MHD", "MHG", "MHH", "MHI", "MHK", "MHO", "MHP", "MHQ", "MHT", "MHU", "MHV", "MHW", "MHX", "MHZ", "MIA", "MID", "MIE", "MIG", "MIH", "MII", "MIJ", "MIK", "MIM", "MIN", "MIP", "MIR", "MIS", "MIU", "MJA", "MJC", "MJD", "MJF", "MJG", "MJI", "MJL", "MJM", "MJN", "MJP", "MJR", "MJT", "MJU", "MJV", "MJZ", "MKA", "MKB", "MKC", "MKE", "MKG", "MKH", "MKI", "MKJ", "MKK", "MKL", "MKM", "MKP", "MKQ", "MKR", "MKU", "MKW", "MKY", "MKZ", "MLA", "MLB", "MLE", "MLG", "MLI", "MLM", "MLN", "MLO", "MLP", "MLR", "MLS", "MLU", "MLW", "MLX", "MLY", "MLZ", "MMB", "MMC", "MMD", "MME", "MMF", "MMG", "MMH", "MMJ", "MMK", "MMM", "MMO", "MMP", "MMQ", "MMU", "MMX", "MMY", "MMZ", "MNA", "MNB", "MNC", "MNE", "MNF", "MNG", "MNH", "MNI", "MNJ", "MNK", "MNL", "MNO", "MNQ", "MNR", "MNS", "MNU", "MNX", "MNY", "MOA", "MOB", "MOC", "MOD", "MOE", "MOF", "MOG", "MOI", "MOJ", "MOL", "MOM", "MON", "MOO", "MOQ", "MOT", "MOU", "MOV", "MOZ", "MPA", "MPC", "MPD", "MPH", "MPL", "MPM", "MPN", "MPT", "MPV", "MPW", "MPY", "MQA", "MQC", "MQD", "MQE", "MQF", "MQH", "MQK", "MQL", "MQM", "MQN", "MQP", "MQQ", "MQS", "MQU", "MQX", "MQZ", "MRD", "MRE", "MRG", "MRH", "MRI", "MRO", "MRP", "MRQ", "MRR", "MRS", "MRU", "MRV", "MRW", "MRX", "MRY", "MRZ", "MSA", "MSE", "MSH", "MSJ", "MSL", "MSM", "MSN", "MSO", "MSP", "MSQ", "MSR", "MSS", "MST", "MSU", "MSW", "MSX", "MSY", "MSZ", "MTA", "MTB", "MTD", "MTE", "MTF", "MTI", "MTJ", "MTK", "MTL", "MTQ", "MTR", "MTS", "MTT", "MTV", "MTW", "MTY", "MTZ", "MUA", "MUB", "MUC", "MUD", "MUE", "MUG", "MUH", "MUK", "MUN", "MUQ", "MUR", "MUS", "MUW", "MUX", "MUY", "MUZ", "MVA", "MVB", "MVD", "MVF", "MVK", "MVL", "MVO", "MVP", "MVQ", "MVR", "MVS", "MVT", "MVV", "MVX", "MVY", "MVZ", "MWB", "MWD", "MWE", "MWF", "MWJ", "MWK", "MWN", "MWQ", "MWX", "MWZ", "MXB", "MXD", "MXH", "MXI", "MXJ", "MXK", "MXL", "MXM", "MXN", "MXP", "MXS", "MXT", "MXU", "MXV", "MXX", "MXZ", "MYA", "MYB", "MYC", "MYD", "MYE", "MYG", "MYI", "MYJ", "MYM", "MYN", "MYP", "MYQ", "MYR", "MYT", "MYU", "MYW", "MYX", "MYY", "MYZ", "MZB", "MZC", "MZG", "MZH", "MZI", "MZK", "MZL", "MZM", "MZO", "MZP", "MZQ", "MZR", "MZT", "MZU", "MZV", "MZW", "MZY", "Mar", "NAA", "NAC", "NAE", "NAG", "NAH", "NAI", "NAJ", "NAK", "NAL", "NAM", "NAN", "NAO", "NAP", "NAQ", "NAR", "NAS", "NAT", "NAU", "NAV", "NAW", "NAY", "NBC", "NBE", "NBH", "NBL", "NBO", "NBW", "NBX", "NCA", "NCE", "NCG", "NCH", "NCI", "NCJ", "NCL", "NCN", "NCR", "NCS", "NCT", "NCU", "NCY", "NDB", "NDC", "NDD", "NDE", "NDG", "NDJ", "NDL", "NDM", "NDR", "NDS", "NDU", "NDY", "NDZ", "NEC", "NEF", "NEG", "NEJ", "NEK", "NEL", "NEU", "NEV", "NFG", "NGA", "NGB", "NGD", "NGE", "NGI", "NGL", "NGO", "NGQ", "NGS", "NGX", "NHA", "NHD", "NHF", "NHS", "NHT", "NHV", "NIA", "NIF", "NIG", "NIM", "NIO", "NIS", "NIT", "NIX", "NJA", "NJC", "NKC", "NKG", "NKL", "NKM", "NKS", "NKU", "NKW", "NKY", "NLA", "NLD", "NLF", "NLK", "NLL", "NLO", "NLP", "NLS", "NLV", "NMA", "NMB", "NMC", "NML", "NMR", "NMS", "NMT", "NNA", "NNB", "NNG", "NNI", "NNM", "NNR", "NNT", "NNU", "NNX", "NNY", "NOA", "NOB", "NOC", "NOD", "NOG", "NOJ", "NOK", "NON", "NOR", "NOS", "NOU", "NOV", "NOZ", "NPE", "NPL", "NPO", "NQL", "NQN", "NQT", "NQU", "NQY", "NRA", "NRD", "NRE", "NRK", "NRL", "NRM", "NRN", "NRT", "NSH", "NSI", "NSK", "NSM", "NSN", "NSO", "NSP", "NST", "NSV", "NSY", "NTB", "NTE", "NTG", "NTI", "NTL", "NTN", "NTO", "NTQ", "NTR", "NTT", "NTX", "NTY", "NUB", "NUD", "NUE", "NUI", "NUK", "NUR", "NUS", "NUU", "NUX", "NVA", "NVG", "NVI", "NVK", "NVN", "NVP", "NVS", "NVT", "NWA", "NWI", "NYA", "NYE", "NYI", "NYK", "NYM", "NYN", "NYO", "NYT", "NYU", "NZA", "NZE", "Niu", "OAG", "OAH", "OAI", "OAJ", "OAK", "OAM", "OAR", "OAS", "OAX", "OAZ", "OBC", "OBF", "OBI", "OBL", "OBN", "OBO", "OBS", "OBU", "OCC", "OCJ", "OCV", "ODA", "ODB", "ODC", "ODD", "ODE", "ODH", "ODJ", "ODL", "ODN", "ODO", "ODR", "ODS", "ODY", "OEC", "OEL", "OEM", "OER", "OES", "OFI", "OFJ", "OFU", "OGE", "OGG", "OGL", "OGN", "OGO", "OGR", "OGS", "OGX", "OGZ", "OHA", "OHD", "OHE", "OHH", "OHO", "OHR", "OHT", "OIM", "OIR", "OIT", "OIZ", "OKA", "OKC", "OKD", "OKE", "OKF", "OKH", "OKI", "OKJ", "OKL", "OKN", "OKO", "OKQ", "OKR", "OKT", "OKU", "OKY", "OLA", "OLB", "OLC", "OLD", "OLI", "OLJ", "OLK", "OLM", "OLP", "OMA", "OMB", "OMC", "OMD", "OME", "OMF", "OMG", "OMH", "OMI", "OMM", "OMO", "OMR", "OMS", "OND", "ONG", "ONI", "ONJ", "ONQ", "ONR", "ONT", "ONU", "ONX", "OOK", "OOL", "OOM", "OOR", "OOT", "OPA", "OPI", "OPO", "OPS", "OPU", "ORA", "ORB", "ORC", "ORD", "ORE", "ORF", "ORG", "ORH", "ORJ", "ORK", "ORM", "ORN", "ORP", "ORR", "ORT", "ORU", "ORV", "ORW", "ORX", "ORY", "OSB", "OSD", "OSE", "OSH", "OSI", "OSK", "OSL", "OSN", "OSO", "OSR", "OSS", "OST", "OSW", "OSY", "OSZ", "OTC", "OTH", "OTI", "OTK", "OTL", "OTM", "OTP", "OTR", "OTZ", "OUA", "OUD", "OUE", "OUG", "OUH", "OUI", "OUL", "OUR", "OUS", "OUT", "OUZ", "OVA", "OVB", "OVD", "OVG", "OVL", "OVR", "OVS", "OWB", "OXB", "OXF", "OXP", "OXY", "OYA", "OYE", "OYK", "OYL", "OYN", "OYO", "OZC", "OZG", "OZH", "OZP", "OZZ", "PAA", "PAB", "PAC", "PAD", "PAE", "PAF", "PAG", "PAH", "PAJ", "PAK", "PAN", "PAP", "PAQ", "PAS", "PAT", "PAU", "PAV", "PAX", "PAY", "PAZ", "PBB", "PBC", "PBD", "PBE", "PBG", "PBH", "PBI", "PBJ", "PBL", "PBM", "PBN", "PBO", "PBP", "PBQ", "PBR", "PBU", "PBV", "PBZ", "PCA", "PCB", "PCF", "PCG", "PCL", "PCN", "PCO", "PCP", "PCR", "PCS", "PDA", "PDC", "PDE", "PDF", "PDG", "PDI", "PDK", "PDL", "PDO", "PDP", "PDS", "PDU", "PDV", "PDX", "PDZ", "PEA", "PED", "PEE", "PEF", "PEG", "PEH", "PEI", "PEK", "PEL", "PEM", "PEN", "PER", "PES", "PET", "PEU", "PEV", "PEW", "PEX", "PEZ", "PFB", "PFC", "PFJ", "PFN", "PFO", "PFQ", "PFR", "PGA", "PGF", "PGH", "PGI", "PGK", "PGV", "PGX", "PGZ", "PHA", "PHB", "PHC", "PHE", "PHF", "PHH", "PHI", "PHL", "PHO", "PHS", "PHW", "PHX", "PHY", "PIA", "PIB", "PIC", "PID", "PIE", "PIF", "PIH", "PIK", "PIL", "PIN", "PIO", "PIP", "PIR", "PIS", "PIT", "PIU", "PIV", "PIW", "PIX", "PIZ", "PJA", "PJC", "PJG", "PJM", "PKA", "PKB", "PKC", "PKE", "PKG", "PKH", "PKJ", "PKK", "PKN", "PKO", "PKP", "PKR", "PKT", "PKU", "PKV", "PKW", "PKY", "PKZ", "PLD", "PLF", "PLH", "PLL", "PLM", "PLN", "PLO", "PLP", "PLQ", "PLS", "PLT", "PLU", "PLV", "PLW", "PLZ", "PMA", "PMC", "PMD", "PMF", "PMG", "PMI", "PMK", "PML", "PMO", "PMQ", "PMR", "PMS", "PMV", "PMW", "PMY", "PMZ", "PNA", "PNB", "PNG", "PNH", "PNI", "PNK", "PNL", "PNP", "PNQ", "PNR", "PNS", "PNT", "PNV", "PNY", "PNZ", "POA", "POD", "POG", "POI", "POJ", "POL", "POM", "PON", "POO", "POP", "POR", "POS", "POT", "POU", "POV", "POW", "POX", "POZ", "PPB", "PPE", "PPG", "PPH", "PPI", "PPJ", "PPK", "PPL", "PPN", "PPP", "PPQ", "PPR", "PPS", "PPT", "PPU", "PPW", "PPY", "PQC", "PQE", "PQI", "PQM", "PQQ", "PRA", "PRC", "PRD", "PRG", "PRH", "PRI", "PRK", "PRM", "PRN", "PRP", "PRQ", "PRR", "PRS", "PRU", "PRV", "PRY", "PSA", "PSC", "PSD", "PSE", "PSG", "PSH", "PSI", "PSJ", "PSL", "PSM", "PSO", "PSP", "PSR", "PSS", "PSU", "PSW", "PSY", "PSZ", "PTA", "PTF", "PTG", "PTH", "PTJ", "PTM", "PTO", "PTP", "PTQ", "PTU", "PTX", "PTY", "PTZ", "PUB", "PUD", "PUF", "PUG", "PUJ", "PUK", "PUN", "PUP", "PUQ", "PUR", "PUS", "PUU", "PUV", "PUX", "PUY", "PUZ", "PVA", "PVD", "PVG", "PVH", "PVI", "PVK", "PVN", "PVO", "PVR", "PVS", "PWE", "PWM", "PWN", "PWO", "PWQ", "PWT", "PXM", "PXO", "PXU", "PYB", "PYE", "PYH", "PYJ", "PYO", "PYR", "PYY", "PZA", "PZB", "PZH", "PZL", "PZO", "PZU", "PZY", "QAC", "QAK", "QAM", "QAR", "QAS", "QBC", "QBQ", "QBX", "QCH", "QCJ", "QCN", "QCO", "QCP", "QCR", "QCY", "QDB", "QDC", "QDF", "QDJ", "QEF", "QEO", "QFD", "QFO", "QFR", "QGA", "QGB", "QGC", "QGF", "QGP", "QGS", "QGU", "QGY", "QHA", "QHB", "QHN", "QHP", "QHR", "QHV", "QID", "QIE", "QIG", "QIQ", "QIT", "QJB", "QJD", "QKX", "QLA", "QLC", "QLD", "QLF", "QLS", "QLT", "QLU", "QMF", "QMM", "QMZ", "QNC", "QND", "QNJ", "QNM", "QNS", "QNV", "QNX", "QOA", "QOB", "QOE", "QOJ", "QOW", "QPA", "QPD", "QPG", "QPH", "QPM", "QPS", "QPZ", "QRA", "QRC", "QRM", "QRO", "QRR", "QRT", "QRZ", "QSA", "QSC", "QSF", "QSI", "QSN", "QSR", "QSX", "QTJ", "QUG", "QUN", "QUS", "QUT", "QUY", "QVA", "QVB", "QVE", "QVP", "QWS", "QWV", "QXC", "QYD", "QYR", "QYY", "QZD", "QZN", "QZO", "RAB", "RAE", "RAG", "RAH", "RAI", "RAJ", "RAK", "RAM", "RAN", "RAO", "RAP", "RAR", "RAS", "RAV", "RAZ", "RBA", "RBB", "RBC", "RBE", "RBJ", "RBM", "RBO", "RBQ", "RBR", "RBS", "RBT", "RBU", "RBV", "RBX", "RBY", "RCB", "RCH", "RCL", "RCM", "RCO", "RCQ", "RCS", "RCT", "RCU", "RCY", "RDB", "RDC", "RDD", "RDE", "RDG", "RDM", "RDN", "RDS", "RDT", "RDU", "RDZ", "REA", "REB", "REC", "REG", "REI", "REL", "REN", "REP", "REQ", "RER", "RES", "RET", "REU", "REX", "REY", "RFA", "RFD", "RFN", "RFP", "RFR", "RFS", "RGA", "RGH", "RGI", "RGK", "RGL", "RGN", "RGO", "RGS", "RGT", "RHA", "RHD", "RHE", "RHG", "RHI", "RHL", "RHO", "RHP", "RIA", "RIB", "RIC", "RIG", "RIJ", "RIK", "RIM", "RIN", "RIS", "RIX", "RIY", "RJA", "RJB", "RJH", "RJK", "RJL", "RJN", "RKA", "RKC", "RKD", "RKE", "RKO", "RKS", "RKT", "RKV", "RLG", "RLO", "RMA", "RMB", "RMF", "RMI", "RMK", "RML", "RMN", "RMQ", "RMS", "RMY", "RNA", "RNB", "RNE", "RNI", "RNJ", "RNL", "RNM", "RNN", "RNO", "RNS", "RNU", "ROA", "ROB", "ROC", "ROD", "ROH", "ROI", "ROK", "ROO", "ROP", "ROR", "ROS", "ROT", "ROV", "ROW", "ROY", "ROZ", "RPA", "RPM", "RPN", "RPR", "RQO", "RQW", "RRE", "RRG", "RRK", "RRR", "RRS", "RSA", "RSB", "RSD", "RSK", "RSS", "RST", "RSU", "RSW", "RTA", "RTB", "RTC", "RTG", "RTM", "RTP", "RTS", "RTW", "RTY", "RUA", "RUD", "RUE", "RUG", "RUH", "RUK", "RUM", "RUN", "RUP", "RUR", "RUS", "RUT", "RUV", "RUY", "RVA", "RVD", "RVK", "RVN", "RVO", "RVR", "RVT", "RVV", "RVY", "RWI", "RWN", "RXE", "RXS", "RYB", "RYG", "RYK", "RYN", "RYO", "RZA", "RZE", "RZN", "RZR", "SAB", "SAF", "SAH", "SAK", "SAL", "SAN", "SAO", "SAP", "SAQ", "SAS", "SAT", "SAU", "SAV", "SAW", "SAY", "SAZ", "SBA", "SBB", "SBE", "SBG", "SBH", "SBI", "SBJ", "SBK", "SBL", "SBN", "SBP", "SBQ", "SBR", "SBU", "SBW", "SBY", "SBZ", "SCC", "SCD", "SCE", "SCG", "SCI", "SCL", "SCM", "SCN", "SCO", "SCP", "SCQ", "SCS", "SCT", "SCU", "SCV", "SCW", "SCY", "SCZ", "SDB", "SDD", "SDE", "SDF", "SDG", "SDH", "SDJ", "SDK", "SDL", "SDN", "SDP", "SDQ", "SDR", "SDS", "SDT", "SDU", "SDV", "SDY", "SEA", "SEB", "SEH", "SEN", "SEO", "SEQ", "SEU", "SEV", "SEW", "SEY", "SEZ", "SFA", "SFB", "SFC", "SFD", "SFE", "SFG", "SFH", "SFI", "SFJ", "SFK", "SFL", "SFN", "SFO", "SFQ", "SFS", "SFT", "SGA", "SGC", "SGD", "SGE", "SGF", "SGG", "SGI", "SGN", "SGO", "SGP", "SGQ", "SGS", "SGU", "SGV", "SGX", "SGY", "SGZ", "SHA", "SHB", "SHD", "SHE", "SHH", "SHI", "SHJ", "SHK", "SHL", "SHM", "SHO", "SHP", "SHQ", "SHR", "SHS", "SHT", "SHU", "SHV", "SHW", "SHX", "SHY", "SHZ", "SIA", "SIB", "SIC", "SID", "SIE", "SIF", "SIG", "SIH", "SII", "SIJ", "SIL", "SIM", "SIN", "SIO", "SIP", "SIQ", "SIR", "SIS", "SIT", "SIU", "SIX", "SJA", "SJB", "SJC", "SJD", "SJE", "SJI", "SJJ", "SJK", "SJL", "SJO", "SJP", "SJQ", "SJS", "SJT", "SJU", "SJV", "SJW", "SJY", "SJZ", "SKB", "SKC", "SKD", "SKE", "SKG", "SKH", "SKK", "SKL", "SKN", "SKO", "SKP", "SKQ", "SKS", "SKT", "SKU", "SKV", "SKX", "SKZ", "SLA", "SLC", "SLD", "SLF", "SLH", "SLI", "SLK", "SLL", "SLM", "SLN", "SLP", "SLS", "SLU", "SLV", "SLW", "SLX", "SLY", "SLZ", "SMA", "SMB", "SMF", "SMG", "SMI", "SML", "SMM", "SMQ", "SMR", "SMS", "SMU", "SMV", "SMW", "SMX", "SMY", "SMZ", "SNA", "SNB", "SNC", "SNE", "SNF", "SNG", "SNH", "SNI", "SNJ", "SNM", "SNN", "SNO", "SNP", "SNR", "SNU", "SNV", "SNW", "SNX", "SNZ", "SOB", "SOC", "SOD", "SOE", "SOF", "SOG", "SOJ", "SOK", "SOM", "SON", "SOO", "SOQ", "SOT", "SOU", "SOW", "SOX", "SOY", "SOZ", "SPD", "SPE", "SPI", "SPJ", "SPM", "SPN", "SPP", "SPS", "SPU", "SPY", "SQC", "SQD", "SQG", "SQH", "SQL", "SQM", "SQN", "SQO", "SQQ", "SQR", "SQU", "SQW", "SQX", "SQY", "SQZ", "SRA", "SRB", "SRD", "SRE", "SRG", "SRH", "SRI", "SRJ", "SRN", "SRP", "SRQ", "SRT", "SRX", "SRY", "SRZ", "SSA", "SSD", "SSE", "SSG", "SSH", "SSJ", "SSN", "SSO", "SSR", "SST", "SSX", "SSY", "SSZ", "STA", "STB", "STC", "STD", "STH", "STI", "STL", "STM", "STN", "STP", "STR", "STV", "STW", "STX", "STY", "STZ", "SUB", "SUF", "SUG", "SUH", "SUI", "SUJ", "SUL", "SUN", "SUO", "SUP", "SUQ", "SUR", "SUT", "SUV", "SUX", "SVA", "SVB", "SVC", "SVD", "SVF", "SVG", "SVI", "SVJ", "SVL", "SVO", "SVP", "SVQ", "SVU", "SVW", "SVX", "SVZ", "SWA", "SWC", "SWD", "SWF", "SWH", "SWJ", "SWN", "SWP", "SWQ", "SWS", "SWU", "SWX", "SWY", "SXB", "SXE", "SXF", "SXG", "SXI", "SXJ", "SXK", "SXL", "SXM", "SXN", "SXO", "SXQ", "SXR", "SXS", "SXT", "SXU", "SXV", "SXX", "SXZ", "SYA", "SYC", "SYD", "SYE", "SYJ", "SYK", "SYM", "SYN", "SYO", "SYP", "SYQ", "SYR", "SYT", "SYU", "SYW", "SYX", "SYY", "SYZ", "SZA", "SZB", "SZF", "SZG", "SZJ", "SZK", "SZN", "SZP", "SZR", "SZS", "SZT", "SZV", "SZW", "SZX", "SZZ", "TAB", "TAC", "TAD", "TAE", "TAF", "TAG", "TAH", "TAI", "TAJ", "TAK", "TAL", "TAM", "TAN", "TAO", "TAP", "TAQ", "TAR", "TAS", "TAT", "TAU", "TAW", "TAX", "TAY", "TAZ", "TBB", "TBF", "TBG", "TBH", "TBJ", "TBK", "TBL", "TBN", "TBO", "TBP", "TBS", "TBT", "TBU", "TBW", "TBY", "TBZ", "TCA", "TCB", "TCE", "TCG", "TCH", "TCL", "TCN", "TCO", "TCP", "TCQ", "TCU", "TCW", "TCX", "TCZ", "TDA", "TDD", "TDG", "TDJ", "TDK", "TDL", "TDR", "TDT", "TDV", "TDX", "TEA", "TEC", "TED", "TEE", "TEF", "TEG", "TEI", "TEL", "TEM", "TEN", "TEQ", "TER", "TES", "TET", "TEU", "TEX", "TEY", "TEZ", "TFF", "TFI", "TFL", "TFM", "TFN", "TFS", "TFT", "TGA", "TGC", "TGD", "TGG", "TGH", "TGI", "TGJ", "TGM", "TGN", "TGO", "TGQ", "TGR", "TGT", "TGU", "THB", "THC", "THE", "THF", "THG", "THH", "THI", "THK", "THL", "THN", "THO", "THQ", "THR", "THS", "THT", "THU", "THY", "THZ", "TIA", "TIB", "TID", "TIE", "TIF", "TIH", "TII", "TIJ", "TIM", "TIN", "TIO", "TIP", "TIQ", "TIR", "TIU", "TIV", "TIY", "TIZ", "TJA", "TJB", "TJG", "TJH", "TJI", "TJK", "TJM", "TJQ", "TJS", "TJU", "TJV", "TKC", "TKD", "TKG", "TKH", "TKJ", "TKK", "TKN", "TKO", "TKP", "TKQ", "TKR", "TKS", "TKT", "TKU", "TKV", "TKW", "TKX", "TKY", "TKZ", "TLB", "TLC", "TLD", "TLE", "TLH", "TLI", "TLJ", "TLL", "TLM", "TLS", "TLU", "TLV", "TLX", "TLZ", "TMC", "TMD", "TME", "TMG", "TMH", "TMI", "TMJ", "TML", "TMM", "TMN", "TMO", "TMP", "TMQ", "TMR", "TMS", "TMT", "TMU", "TMW", "TMX", "TMZ", "TNA", "TNB", "TNC", "TND", "TNE", "TNF", "TNG", "TNH", "TNI", "TNJ", "TNL", "TNM", "TNN", "TNO", "TNR", "TNV", "TNX", "TOB", "TOD", "TOE", "TOF", "TOG", "TOH", "TOJ", "TOL", "TOM", "TOO", "TOQ", "TOS", "TOT", "TOU", "TOW", "TOX", "TOY", "TPA", "TPC", "TPE", "TPG", "TPI", "TPJ", "TPK", "TPL", "TPN", "TPP", "TPQ", "TPR", "TPS", "TQL", "TQS", "TRA", "TRB", "TRC", "TRD", "TRE", "TRF", "TRG", "TRI", "TRK", "TRN", "TRO", "TRQ", "TRR", "TRS", "TRU", "TRV", "TRW", "TRY", "TRZ", "TSA", "TSB", "TSC", "TSE", "TSF", "TSH", "TSJ", "TSL", "TSN", "TSR", "TST", "TSU", "TSV", "TSX", "TSY", "TTA", "TTB", "TTC", "TTE", "TTG", "TTH", "TTI", "TTJ", "TTN", "TTQ", "TTR", "TTS", "TTT", "TTU", "TUA", "TUB", "TUC", "TUD", "TUF", "TUG", "TUI", "TUK", "TUL", "TUM", "TUN", "TUO", "TUP", "TUQ", "TUR", "TUS", "TUU", "TUV", "TVA", "TVC", "TVL", "TVU", "TVY", "TWB", "TWE", "TWF", "TWU", "TWZ", "TXG", "TXK", "TXL", "TXM", "TXN", "TXU", "TYB", "TYD", "TYF", "TYG", "TYL", "TYM", "TYN", "TYP", "TYR", "TYS", "TYT", "TZL", "TZR", "TZX", "UAB", "UAH", "UAI", "UAK", "UAL", "UAP", "UAQ", "UAR", "UAS", "UAX", "UBA", "UBB", "UBJ", "UBP", "UBR", "UBT", "UBU", "UCK", "UCN", "UCT", "UCZ", "UDA", "UDE", "UDI", "UDJ", "UDN", "UDR", "UEE", "UEL", "UEN", "UEO", "UET", "UFA", "UGA", "UGC", "UGO", "UGT", "UHE", "UIB", "UIH", "UII", "UIK", "UIN", "UIO", "UIP", "UIQ", "UIR", "UJE", "UKA", "UKB", "UKK", "UKS", "UKU", "UKX", "ULA", "ULB", "ULD", "ULG", "ULK", "ULN", "ULO", "ULP", "ULQ", "ULU", "ULV", "ULX", "ULY", "UMA", "UME", "UMI", "UMM", "UMR", "UMT", "UMU", "UMY", "UNA", "UND", "UNE", "UNG", "UNI", "UNK", "UNN", "UNT", "UOL", "UPB", "UPG", "UPL", "UPN", "UPP", "UPV", "URA", "URC", "URE", "URG", "URJ", "URM", "URO", "URR", "URS", "URT", "URY", "USH", "USI", "USK", "USL", "USM", "USN", "USQ", "USS", "USU", "UTA", "UTB", "UTE", "UTG", "UTH", "UTI", "UTN", "UTO", "UTP", "UTR", "UTS", "UTT", "UTW", "UUA", "UUD", "UUK", "UUN", "UUS", "UVE", "UVF", "UVL", "UYL", "UYN", "UYU", "UZC", "UZU", "VAA", "VAC", "VAD", "VAF", "VAG", "VAH", "VAI", "VAK", "VAL", "VAM", "VAN", "VAO", "VAP", "VAR", "VAS", "VAT", "VAU", "VAV", "VAW", "VBS", "VBV", "VBY", "VCA", "VCD", "VCE", "VCH", "VCL", "VCP", "VCR", "VCS", "VCT", "VDA", "VDB", "VDC", "VDE", "VDH", "VDM", "VDP", "VDR", "VDS", "VDY", "VDZ", "VEE", "VER", "VEV", "VEY", "VFA", "VGA", "VGD", "VGO", "VHC", "VHM", "VHY", "VHZ", "VIA", "VIC", "VID", "VIE", "VIG", "VII", "VIJ", "VIL", "VIN", "VIQ", "VIR", "VIT", "VIX", "VIY", "VJB", "VKG", "VKO", "VKT", "VKX", "VLC", "VLD", "VLG", "VLI", "VLL", "VLM", "VLN", "VLP", "VLR", "VLS", "VLU", "VLV", "VME", "VMU", "VNA", "VND", "VNE", "VNO", "VNR", "VNS", "VNT", "VNX", "VOG", "VOH", "VOI", "VOL", "VOT", "VOZ", "VPE", "VPN", "VPS", "VPY", "VQS", "VRA", "VRB", "VRC", "VRE", "VRK", "VRL", "VRN", "VRO", "VRU", "VSA", "VSE", "VSF", "VSG", "VSK", "VST", "VTB", "VTE", "VTF", "VTG", "VTL", "VTM", "VTU", "VTZ", "VUP", "VUS", "VVB", "VVC", "VVI", "VVK", "VVO", "VVZ", "VXC", "VXE", "VXO", "VYD", "WAA", "WAC", "WAE", "WAF", "WAG", "WAH", "WAI", "WAK", "WAL", "WAM", "WAO", "WAP", "WAQ", "WAR", "WAT", "WAV", "WAW", "WAX", "WAY", "WAZ", "WBD", "WBG", "WBM", "WBO", "WBQ", "WCA", "WCH", "WDH", "WDI", "WEF", "WEH", "WEI", "WEL", "WET", "WEW", "WEX", "WFI", "WGA", "WGB", "WGC", "WGE", "WGP", "WGT", "WHF", "WHK", "WHO", "WHS", "WHU", "WIC", "WIE", "WIK", "WIL", "WIN", "WIO", "WIR", "WIT", "WIX", "WJR", "WJU", "WKA", "WKB", "WKF", "WKI", "WKJ", "WKR", "WLA", "WLC", "WLG", "WLH", "WLO", "WLS", "WMA", "WMB", "WMD", "WME", "WMH", "WML", "WMN", "WMP", "WMR", "WMX", "WNA", "WND", "WNN", "WNP", "WNR", "WNS", "WNZ", "WOA", "WOE", "WOL", "WOT", "WPA", "WPB", "WPK", "WPR", "WPU", "WRE", "WRG", "WRI", "WRL", "WRO", "WRW", "WRY", "WRZ", "WSG", "WSN", "WSO", "WSP", "WSR", "WSU", "WSZ", "WTA", "WTD", "WTK", "WTN", "WTP", "WTS", "WTZ", "WUD", "WUG", "WUH", "WUN", "WUS", "WUU", "WUX", "WUZ", "WVB", "WVK", "WVN", "WWI", "WWK", "WXF", "WXN", "WYA", "WYE", "WYN", "XAB", "XAC", "XAN", "XAP", "XAR", "XAS", "XAU", "XAV", "XBE", "XBG", "XBJ", "XBO", "XBQ", "XBV", "XCB", "XCH", "XCM", "XCO", "XCP", "XCR", "XCX", "XCZ", "XDA", "XDE", "XDJ", "XDK", "XEN", "XFN", "XFW", "XGA", "XGG", "XGN", "XGR", "XGT", "XHE", "XIC", "XIL", "XIN", "XIY", "XJM", "XKA", "XKH", "XKS", "XKY", "XLN", "XLR", "XLS", "XLU", "XLW", "XMC", "XME", "XMF", "XMG", "XMH", "XMI", "XMJ", "XMK", "XML", "XMN", "XMS", "XMW", "XMY", "XNA", "XNN", "XNU", "XOG", "XPA", "XPL", "XPR", "XQP", "XRY", "XSC", "XSE", "XSJ", "XSL", "XSP", "XSU", "XTB", "XTG", "XTL", "XTO", "XTR", "XUZ", "XVN", "XVO", "XVS", "XWP", "XXN", "XYA", "XYE", "XYR", "XZA", "YAA", "YAC", "YAG", "YAH", "YAI", "YAK", "YAL", "YAM", "YAN", "YAO", "YAP", "YAR", "YAS", "YAT", "YAU", "YAW", "YAX", "YAY", "YAZ", "YBB", "YBC", "YBE", "YBG", "YBK", "YBL", "YBP", "YBR", "YBT", "YBV", "YBX", "YBY", "YCB", "YCC", "YCD", "YCE", "YCG", "YCH", "YCK", "YCL", "YCM", "YCN", "YCO", "YCQ", "YCR", "YCS", "YCU", "YCY", "YCZ", "YDA", "YDB", "YDF", "YDG", "YDM", "YDN", "YDO", "YDP", "YDQ", "YDT", "YEB", "YEC", "YEG", "YEH", "YEI", "YEK", "YEL", "YEM", "YEN", "YEO", "YER", "YET", "YEU", "YEV", "YEY", "YFA", "YFB", "YFC", "YFE", "YFH", "YFI", "YFO", "YFR", "YFS", "YFX", "YGB", "YGD", "YGH", "YGJ", "YGK", "YGL", "YGM", "YGO", "YGP", "YGQ", "YGR", "YGT", "YGV", "YGW", "YGX", "YGZ", "YHA", "YHD", "YHE", "YHF", "YHI", "YHK", "YHM", "YHN", "YHO", "YHP", "YHR", "YHT", "YHU", "YHY", "YHZ", "YIB", "YIF", "YIH", "YIK", "YIN", "YIO", "YIP", "YIV", "YIW", "YJF", "YJN", "YJS", "YJT", "YKA", "YKF", "YKG", "YKJ", "YKL", "YKM", "YKQ", "YKS", "YKU", "YKX", "YKY", "YKZ", "YLC", "YLD", "YLE", "YLG", "YLH", "YLI", "YLJ", "YLK", "YLL", "YLR", "YLT", "YLW", "YMA", "YME", "YMG", "YMH", "YMJ", "YMK", "YML", "YMM", "YMN", "YMO", "YMS", "YMT", "YMX", "YNA", "YNB", "YNC", "YND", "YNE", "YNG", "YNJ", "YNL", "YNM", "YNN", "YNO", "YNS", "YNT", "YNX", "YNY", "YNZ", "YOA", "YOC", "YOD", "YOG", "YOH", "YOJ", "YOL", "YOO", "YOP", "YOS", "YOT", "YOW", "YPA", "YPC", "YPE", "YPG", "YPH", "YPJ", "YPL", "YPM", "YPN", "YPO", "YPQ", "YPR", "YPS", "YPW", "YPX", "YPY", "YQA", "YQB", "YQC", "YQD", "YQF", "YQG", "YQH", "YQI", "YQK", "YQL", "YQM", "YQN", "YQQ", "YQR", "YQS", "YQT", "YQU", "YQV", "YQW", "YQX", "YQY", "YQZ", "YRA", "YRB", "YRF", "YRG", "YRI", "YRJ", "YRL", "YRO", "YRP", "YRQ", "YRS", "YRT", "YRV", "YSB", "YSC", "YSF", "YSG", "YSH", "YSJ", "YSK", "YSL", "YSM", "YSN", "YSP", "YST", "YSU", "YSY", "YTA", "YTD", "YTE", "YTF", "YTH", "YTL", "YTM", "YTQ", "YTR", "YTS", "YTZ", "YUB", "YUD", "YUE", "YUL", "YUM", "YUS", "YUT", "YUX", "YUY", "YVA", "YVB", "YVC", "YVE", "YVM", "YVO", "YVP", "YVQ", "YVR", "YVT", "YVV", "YVZ", "YWA", "YWG", "YWJ", "YWK", "YWL", "YWM", "YWP", "YWY", "YXC", "YXD", "YXE", "YXH", "YXJ", "YXK", "YXL", "YXN", "YXP", "YXQ", "YXR", "YXS", "YXT", "YXU", "YXX", "YXY", "YXZ", "YYB", "YYC", "YYD", "YYE", "YYF", "YYG", "YYH", "YYJ", "YYL", "YYN", "YYQ", "YYR", "YYT", "YYU", "YYW", "YYY", "YYZ", "YZD", "YZE", "YZF", "YZG", "YZH", "YZP", "YZR", "YZS", "YZT", "YZU", "YZV", "YZW", "YZX", "YZY", "YZZ", "ZAC", "ZAD", "ZAG", "ZAH", "ZAJ", "ZAL", "ZAM", "ZAO", "ZAR", "ZAT", "ZAZ", "ZBD", "ZBE", "ZBF", "ZBM", "ZBO", "ZBR", "ZBY", "ZCD", "ZCL", "ZCN", "ZCO", "ZEC", "ZEE", "ZEM", "ZER", "ZFA", "ZFD", "ZFG", "ZFM", "ZFN", "ZGC", "ZGF", "ZGI", "ZGL", "ZGM", "ZGR", "ZGU", "ZHA", "ZHI", "ZHM", "ZIA", "ZIC", "ZIG", "ZIH", "ZIN", "ZJG", "ZJI", "ZJN", "ZKB", "ZKE", "ZKM", "ZKP", "ZLO", "ZLR", "ZLT", "ZMG", "ZMH", "ZMM", "ZMT", "ZND", "ZNE", "ZNF", "ZNG", "ZNZ", "ZOJ", "ZOS", "ZOW", "ZPB", "ZPC", "ZPH", "ZPO", "ZPQ", "ZQL", "ZQN", "ZQW", "ZRE", "ZRH", "ZRI", "ZRJ", "ZRM", "ZSA", "ZSE", "ZSJ", "ZSN", "ZSP", "ZSS", "ZST", "ZTA", "ZTB", "ZTH", "ZTM", "ZTR", "ZTU", "ZUC", "ZUD", "ZUH", "ZUL", "ZUM", "ZVA", "ZVK", "ZWA", "ZWH", "ZWL", "ZYI", "ZYL", "ZZO", "ZZU", "ZZV", "isl"]-// export const airlines = [];-// export const languages = [];-// export const countries = [];-// export const regions = [];-// export const airports = [];\ No newline at end of filediff --git a/ui/component/or-rules-editor/src/const/rule-config.ts b/ui/component/or-rules-editor/src/const/rule-config.tsdeleted file mode 100644index e6defa0a7..000000000--- a/ui/component/or-rules-editor/src/const/rule-config.ts+++ /dev/null@@ -1,157 +0,0 @@-import openremote from "@openremote/core";-import {- Rule,- RulesetLang,- TenantRuleset,- NewAssetQuery,- BaseAssetQueryMatch,- RuleActionUnion,- RuleActionUpdateAttributeUpdateAction,- RuleTrigger,- AttributePredicate,- RuleCondition-} from "@openremote/model";-import {airlines, airports, countries, languages, regions} from "./resources";--export const rulesEditorConfig = {- controls: {- addWhenCondition: true,- addThenCondition: false,- },- options: {- when: {- attributeValueDescriptors: {- departureAirportIata: {- options: airports- },- airlineIata: {- options: airlines- },- originRegion: {- options: regions- },- pax: {},- languageCodes: {- options: languages- },- countryCode: {- options: countries- }- }- },- then: {- attributeValueDescriptors: {- flightProfiles: {}- }- }- }-};--export const ruleTemplate: Rule = {- name: "",- when: undefined,- then: undefined,- otherwise: [- {- action: "update-attribute",- updateAction: RuleActionUpdateAttributeUpdateAction.DELETE,- attributeName: "flightProfiles",- key: "%RULESET_ID%"- }- ],- onStop: [- {- action: "update-attribute",- updateAction: RuleActionUpdateAttributeUpdateAction.DELETE,- attributeName: "flightProfiles",- key: "%RULESET_ID%",- target: {- assets: {- types: [- {- predicateType: "string",- match: BaseAssetQueryMatch.EXACT,- value: "urn:openremote:asset:kmar:flight"- }- ],- attributes: {- predicates: [- {- name: {- predicateType: "string",- match: BaseAssetQueryMatch.EXACT,- value: "flightProfiles"- },- value: {- predicateType: "object-value-key",- key: "%RULESET_ID%"- }- }- ]- }- }- }- }- ]-};--export const rulesetTemplate: TenantRuleset = {- name: "Nieuw Profiel",- type: "tenant",- lang: RulesetLang.JSON,- realm: openremote.getRealm(),- accessPublicRead: true,- rules: JSON.stringify({rules: [ruleTemplate]})-};--export const defaultAssetType: NewAssetQuery = {- types: [{- predicateType: "string",- match: BaseAssetQueryMatch.EXACT,- value: "urn:openremote:asset:kmar:flight"- }]-};--export const defaultThenCondition: RuleActionUnion = {- action: "update-attribute",- updateAction: RuleActionUpdateAttributeUpdateAction.ADD_OR_REPLACE,- attributeName: "flightProfiles",- key: "%RULESET_ID%",- value: {- profileName: "%RULESET_NAME%",- profileColor: "orange"- }-};--export const defaultThen: RuleActionUnion[] = [defaultThenCondition];--export const defaultWhenCondition: RuleCondition<RuleTrigger> = {- predicates: [- {- assets: {- types: [{- predicateType: "string",- match: BaseAssetQueryMatch.EXACT,- value: "urn:openremote:asset:kmar:flight"- }- ],- attributes: {- predicates: []- }- }- }- ]-};--export const defaultPredicate: AttributePredicate = {- name: {- predicateType: "string",- match: BaseAssetQueryMatch.EXACT,- value: "airlineIata"- },- value: {- predicateType: "string",- match: BaseAssetQueryMatch.EXACT- }--};diff --git a/ui/component/or-rules-editor/src/index.ts b/ui/component/or-rules-editor/src/index.tsindex b5ee4b8b5..088636dc5 100644--- a/ui/component/or-rules-editor/src/index.ts+++ b/ui/component/or-rules-editor/src/index.ts@@ -1,272 +1,855 @@-import {customElement, html, LitElement, property, TemplateResult, PropertyValues} from "lit-element";-+import {customElement, html, LitElement, property} from "lit-element";+import i18next from "i18next";import "@openremote/or-select";import "@openremote/or-icon";import {+ AssetDescriptor,+ AttributeDescriptor,+ AttributeValueDescriptor,+ BaseAssetQueryOperator,+ JsonRulesetDefinition,+ LogicGroup,+ MetaItemDescriptor,+ MetaItemType,+ NewAssetQuery,Rule,- RuleActionWriteAttribute,+ RuleActionTarget,+ RuleActionUnion,+ RuleCondition,RulesetLang,- TenantRuleset+ TenantRuleset,+ ValuePredicateUnion,+ ValueType} from "@openremote/model";-import openremote from "@openremote/core";+import openremote, {AssetModelUtil} from "@openremote/core";+import {isTimeDuration} from "@openremote/core/dist/util";import rest from "@openremote/rest";-+import "@openremote/or-translate";+import {translate} from "@openremote/or-translate/dist/translate-mixin";import "./or-rule-list";import "./or-rule-when";-import "./or-rule-then";+import "./or-rule-actions";import "./or-rule-header";+import "./or-rule-section";+import {rulesEditorStyle} from "./style";-import {style} from "./style";-import findIndex from "lodash-es/findIndex";-import cloneDeep from "lodash-es/cloneDeep";+export const enum ConditionType {+ ASSET_QUERY = "assetQuery",+ DATE_TIME = "datetime",+ TIMER = "timer"+}-import {attributeDescriptors} from "./const/attribute-descriptors";-import {ruleTemplate, rulesetTemplate} from "./const/rule-config";-import "@openremote/or-translate";-import {translate} from "@openremote/or-translate/dist/translate-mixin";-import i18next from "i18next";+export const enum ActionType {+ WAIT = "wait",+ NOTIFICATION = "notification",+ WRITE_ATTRIBUTE = "writeAttribute",+ UPDATE_ATTRIBUTE = "updateAttribute"+}++export const enum ActionTargetType {+ TRIGGER_ASSETS = "triggerAssets",+ TAGGED_ASSETS = "taggedAssets",+ USERS = "users",+ OTHER_ASSETS = "otherAssets"+}++export enum AssetQueryOperator {+ VALUE_EMPTY = "empty",+ VALUE_NOT_EMPTY = "notEmpty",+ EQUALS = "equals",+ NOT_EQUALS = "notEquals",+ GREATER_THAN = "greaterThan",+ GREATER_EQUALS = "greaterEquals",+ LESS_THAN = "lessThan",+ LESS_EQUALS = "lessEquals",+ BETWEEN = "between",+ NOT_BETWEEN = "notBetween",+ CONTAINS = "contains",+ NOT_CONTAINS = "notContains",+ STARTS_WITH = "startsWith",+ NOT_STARTS_WITH = "notStartsWith",+ ENDS_WITH = "endsWith",+ NOT_ENDS_WITH = "notEndsWith",+ CONTAINS_KEY = "containsKey",+ NOT_CONTAINS_KEY = "notContainsKey",+ INDEX_CONTAINS = "indexContains",+ NOT_INDEX_CONTAINS = "notIndexContains",+ LENGTH_EQUALS = "lengthEquals",+ NOT_LENGTH_EQUALS = "notLengthEquals",+ LENGTH_GREATER_THAN = "lengthGreaterThan",+ LENGTH_LESS_THAN = "lengthLessThan",+ IS_TRUE = "true",+ IS_FALSE = "false",+ WITHIN_RADIUS = "withinRadius",+ OUTSIDE_RADIUS = "outsideRadius",+ WITHIN_RECTANGLE = "withinRectangle",+ OUTSIDE_RECTANGLE = "outsideRectangle"+}++export interface AssetTypeAttributeName {+ assetType: string;+ attributeName: string;+}++export interface RulesConfig {+ controls?: {+ whenReadonly?: boolean;+ thenReadonly?: boolean;+ headerReadonly?: boolean;+ allowedConditionTypes?: ConditionType[];+ allowedActionTypes?: ActionType[];+ allowedActionTargets?: ActionTargetType[];+ allowedAssetQueryOperators?: Map<AssetTypeAttributeName | AttributeDescriptor | AttributeValueDescriptor | ValueType, AssetQueryOperator[]>;+ hideActionTargetOptions?: boolean;+ hideActionUpdateOptions?: boolean;+ hideConditionTypeOptions?: boolean;+ hideThenAddAction?: boolean;+ hideWhenAddCondition?: boolean;+ hideWhenAddGroup?: boolean;+ hideWhenGroupOutline?: boolean;+ };+ descriptors?: {+ all?: RulesDescriptorSection;+ when?: RulesDescriptorSection;+ action?: RulesDescriptorSection;+ };+ templates?: {+ rule?: Rule;+ rulesetName?: string;+ whenGroup?: LogicGroup<RuleCondition>;+ whenCondition?: RuleCondition;+ whenAssetQuery?: NewAssetQuery;+ then?: RuleActionUnion;+ };+}++export interface RulesDescriptorSection {+ includeAssets?: string[];+ excludeAssets?: string[];+ assets?: { [assetType: string]: RulesConfigAsset };+ attributeDescriptors?: {[attributeName: string]: RulesConfigAttribute };+}++export interface RulesConfigAsset {+ includeAttributes?: string[];+ excludeAttributes?: string[];+ name?: string;+ icon?: string;+ attributeDescriptors?: {[attributeName: string]: RulesConfigAttribute };+}-class InputHandlers {- public handlers: Array<(condition: RuleActionWriteAttribute) => TemplateResult | undefined> = [];+export interface RulesConfigAttribute {+ icon?: string;+ valueDescriptor?: RulesConfigAttribute;+ initialValue?: any;+ allowedValues?: any[];+ allowedMin?: any;+ allowedMax?: any;+}- public addInputHandler(callback: (condition: RuleActionWriteAttribute) => TemplateResult | undefined) {- this.handlers.push(callback);+export interface RulesConfigAttributeValue {+ name?: string;+ icon?: string;+ valueType?: ValueType;+}++function getAssetDescriptorFromSection(assetTpe: string, config: RulesConfig | undefined, useActionConfig: boolean) {+ if (!config || !config.descriptors) {+ return;}- public removeInputHandler(callback: (condition: RuleActionWriteAttribute) => TemplateResult | undefined) {- const i = this.handlers.indexOf(callback);- if (i <= 0) {- this.handlers.splice(i, 1);- }+ const section = useActionConfig ? config.descriptors.action : config.descriptors.when;+ const allSection = config.descriptors.all;++ const descriptor = section && section.assets ? section.assets[assetTpe] : undefined;+ if (descriptor) {+ return descriptor;+ }++ return allSection && allSection.assets ? allSection.assets[assetTpe] : undefined;+}++export function getDescriptorValueType(descriptor?: AttributeDescriptor) {+ if (!descriptor || !descriptor.valueDescriptor) {+ return;}++ return descriptor.valueDescriptor.valueType;+}++export function getAssetTypeFromQuery(query?: NewAssetQuery) {+ return query && query.types && query.types.length > 0 && query.types[0] ? query.types[0].value : undefined;}-export default new InputHandlers();+export function getAssetDescriptors(config: RulesConfig | undefined, useActionConfig: boolean) {+ const assetDescriptors: AssetDescriptor[] = AssetModelUtil.getAssetDescriptors();+ let allowedAssetTypes: string[] = [];+ let excludedAssetTypes: string[] = [];++ if (!config || !config.descriptors) {+ return assetDescriptors;+ }++ const section = useActionConfig ? config.descriptors.action : config.descriptors.when;++ if (section && section.includeAssets) {+ allowedAssetTypes = [...section.includeAssets];+ }++ if (config.descriptors.all && config.descriptors.all.includeAssets) {+ allowedAssetTypes = allowedAssetTypes.concat(config.descriptors.all.includeAssets);+ }++ if (section && section.excludeAssets) {+ excludedAssetTypes = [...section.excludeAssets];+ }++ if (config.descriptors.all && config.descriptors.all.excludeAssets) {+ excludedAssetTypes = excludedAssetTypes.concat(config.descriptors.all.excludeAssets);+ }++ return assetDescriptors.filter((ad) => {+ if (allowedAssetTypes.length > 0 && allowedAssetTypes.indexOf(ad.type!) < 0) {+ return false;+ }+ return excludedAssetTypes.indexOf(ad.type!) < 0;++ }).map((ad) => {+ // Amalgamate matching descriptor from config if defined+ const configDescriptor = getAssetDescriptorFromSection(ad.type!, config, useActionConfig);+ if (!configDescriptor) {+ return ad;+ }++ const modifiedDescriptor: AssetDescriptor = {+ name: ad.name,+ type: ad.type,+ icon: ad.icon,+ attributeDescriptors: ad.attributeDescriptors ? [...ad.attributeDescriptors] : undefined+ };++ if (configDescriptor.icon) {+ modifiedDescriptor.icon = configDescriptor.icon;+ }+ if (configDescriptor.name) {+ modifiedDescriptor.name = configDescriptor.name;+ }-function confirmDialog(msg: string) {- return new Promise( (resolve, reject) => {- const confirmed = window.confirm(msg);+ // Remove any excluded attributes+ if (modifiedDescriptor.attributeDescriptors) {+ const inc = configDescriptor.includeAttributes !== undefined ? configDescriptor.includeAttributes : undefined;+ const exc = configDescriptor.excludeAttributes !== undefined ? configDescriptor.excludeAttributes : undefined;++ if (inc || exc) {+ modifiedDescriptor.attributeDescriptors = modifiedDescriptor.attributeDescriptors.filter((mad) => {+ if (exc && exc.indexOf(mad.attributeName!) >= 0) {+ return false;+ }+ if (inc && inc.indexOf(mad.attributeName!) < 0) {+ return false;+ }+ return true;+ });+ }++ // Override any attribute descriptors+ if (configDescriptor.attributeDescriptors) {+ modifiedDescriptor.attributeDescriptors.map((attributeDescriptor) => {+ let configAttributeDescriptor: RulesConfigAttribute | undefined = configDescriptor.attributeDescriptors![attributeDescriptor.attributeName!];+ if (!configAttributeDescriptor) {+ configAttributeDescriptor = section && section.attributeDescriptors ? section.attributeDescriptors[attributeDescriptor.attributeName!] : undefined;+ }+ if (!configAttributeDescriptor) {+ configAttributeDescriptor = config.descriptors!.all && config.descriptors!.all.attributeDescriptors ? config.descriptors!.all.attributeDescriptors[attributeDescriptor.attributeName!] : undefined;+ }+ if (configAttributeDescriptor) {+ let metaItemDescriptors = attributeDescriptor.metaItemDescriptors;+ if (!metaItemDescriptors) {+ attributeDescriptor.metaItemDescriptors = [];+ metaItemDescriptors = attributeDescriptor.metaItemDescriptors;+ }++ if (configAttributeDescriptor.allowedValues) {+ addOrReplaceMetaItemDescriptor(metaItemDescriptors, AssetModelUtil.getMetaItemDescriptorInitialValue(MetaItemType.ALLOWED_VALUES, configAttributeDescriptor.allowedValues));+ }+ if (configAttributeDescriptor.allowedMin) {+ addOrReplaceMetaItemDescriptor(metaItemDescriptors, AssetModelUtil.getMetaItemDescriptorInitialValue(MetaItemType.RANGE_MIN, configAttributeDescriptor.allowedMin));+ }+ if (configAttributeDescriptor.allowedMax) {+ addOrReplaceMetaItemDescriptor(metaItemDescriptors, AssetModelUtil.getMetaItemDescriptorInitialValue(MetaItemType.RANGE_MAX, configAttributeDescriptor.allowedMax));+ }++ return {+ attributeName: attributeDescriptor.attributeName,+ valueDescriptor: configAttributeDescriptor.valueDescriptor ? configAttributeDescriptor.valueDescriptor : attributeDescriptor.valueDescriptor,+ initialValue: configAttributeDescriptor.initialValue ? configAttributeDescriptor.initialValue : attributeDescriptor.initialValue,+ metaItemDescriptors: attributeDescriptor.metaItemDescriptors+ };+ }- return confirmed ? resolve(true) : reject(false);+ return attributeDescriptor;+ });+ }+ }+ return modifiedDescriptor;});}+function addOrReplaceMetaItemDescriptor(metaItemDescriptors: MetaItemDescriptor[], metaItemDescriptor: MetaItemDescriptor) {+ const index = metaItemDescriptors.findIndex((mid) => mid.urn === metaItemDescriptor.urn);+ if (index >= 0) {+ metaItemDescriptors.splice(index, 1);++ }+ metaItemDescriptors.push(metaItemDescriptor);+}++export class OrRuleChangedEvent extends CustomEvent<void> {++ public static readonly NAME = "or-rule-changed";++ constructor() {+ super(OrRuleChangedEvent.NAME, {+ bubbles: true,+ composed: true+ });+ }+}++declare global {+ export interface HTMLElementEventMap {+ [OrRuleChangedEvent.NAME]: OrRuleChangedEvent;+ }+}+@customElement("or-rules-editor")class OrRulesEditor extends translate(i18next)(LitElement) {+ public static DEFAULT_RULESET_NAME = "New rule";+static get styles() {return [- style+ rulesEditorStyle];}+ public config?: RulesConfig;+@property({type: Number})private value: number = 0;- @property({type: Array})- private rulesets?: TenantRuleset[];+ @property({type: Array, attribute: false})+ private _rulesets?: TenantRuleset[];- @property({type: Object})- private ruleset?: TenantRuleset;+ @property({type: Boolean, attribute: false})+ private isValidRule?: boolean;- @property({type: Array})- private rules?: Rule[];+ private _activeRuleset?: TenantRuleset;+ private _activeRules?: Rule[];+ private _activeModified: boolean = false;+ private _whenAssetDescriptors?: AssetDescriptor[];+ private _actionAssetDescriptors?: AssetDescriptor[];+ private _saveInProgress = false;++ private set activeRuleset(ruleset: TenantRuleset | undefined) {+ this._activeRuleset = ruleset;+ this._activeRules = undefined;+ this._activeModified = false;++ if (ruleset && ruleset.rules) {+ const rules = JSON.parse(ruleset.rules) as JsonRulesetDefinition;+ this._activeRules = rules.rules;+ }- @property({type: Object})- private rule?: Rule;+ this.requestUpdate();+ }- @property({type: Boolean})- private isValidRule?: boolean;+ private get activeRuleset() {+ return this._activeRuleset;+ }++ private get activeRule() {+ return this._activeRules && this._activeRules.length > 0 ? this._activeRules[0] : undefined;+ }constructor() {super();this.readRules();- this.addEventListener("rules:validated", this.validatedRule);- 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);+ this.addEventListener(OrRuleChangedEvent.NAME, this.onRuleChanged);+ this.addEventListener("rules:set-active-rule", this.setActiveRuleset);+ this.addEventListener("rules:create-rule", this.createRuleset);+ this.addEventListener("rules:save-ruleset", this.saveRuleset);+ this.addEventListener("rules:delete-rule", this.deleteRuleset);+ }++ protected ruleEditorPanelTemplate(rule: Rule) {+ const thenTemplate = this.config && this.config.templates && this.config.templates.then ? this.config.templates.then : undefined;+ const targetTypeMap = this.getTargetTypeMap();+ const whenDescriptors = this.getAssetDescriptors(false);+ const actionDescriptors = this.getAssetDescriptors(true);+ const thenAllowAdd = !this.config || !this.config.controls || this.config.controls.hideThenAddAction !== true;+ return html`+ <div class="section-container">+ <or-rule-section heading="${i18next.t("when")}...">+ <or-rule-when .rule="${rule}" .config="${this.config}" .assetDescriptors="${whenDescriptors}" ?readonly="${this.isReadonly("when")}"></or-rule-when>+ </or-rule-section>+ </div>++ <div class="section-container">+ <or-rule-section heading="${i18next.t("then")}...">+ <or-rule-actions .actions="${rule.then}" .config="${this.config}" .newTemplate="${thenTemplate}" .allowAdd="${thenAllowAdd}" .targetTypeMap="${targetTypeMap}" .assetDescriptors="${actionDescriptors}" ?readonly="${this.isReadonly("then")}"></or-rule-actions>+ </or-rule-section>+ </div>+ `;}protected render() {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>- <div class="bottom-toolbar">- ${openremote.hasRole("write:rules") ? html`- <icon class="small-icon" @click="${this.deleteRule}"><or-icon icon="delete"></or-icon></icon>- <icon style="margin-left: auto;" class="small-icon" @click="${this.createRule}"><or-icon icon="plus"></or-icon></icon>- ` : ``}- </div>- </side-menu>- ${this.ruleset ? html`- <or-body>-- ${this.rule ? html`- <or-rule-header class="bg-white shadow" .ruleset="${this.ruleset}" .rule="${this.rule}" ?valid="${this.isValidRule}"></or-rule-header>-- <div class="content">- <or-rule-when .rule="${this.rule}" .attributeDescriptors="${attributeDescriptors}"></or-rule-when>- <or-rule-then .rule="${this.rule}" .attributeDescriptors="${attributeDescriptors}"></or-rule-then>- </div>- ` : ``}-- </or-body>- ` : html`- <div class="center-center">- <h3 style="font-weight: normal;">Kies links een profiel of maak een nieuw profiel aan.</h3>+ <side-menu class="bg-white shadow">+ <or-rule-list .rulesets="${this._rulesets}" .ruleset="${this.activeRuleset}" ></or-rule-list>+ <div class="bottom-toolbar">${openremote.hasRole("write:rules") ? html`- <button style="margin: auto;" @click="${this.createRule}">profiel aanmaken</button>+ <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>` : ``}</div>- `}- </div>+ </side-menu>+ ${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>+ <div class="rule-editor-panel">+ ${this.ruleEditorPanelTemplate(this.activeRule)}+ </div>+ </div>+ ` : html`+ <div class="center-center">+ <h3 style="font-weight: normal;">Kies links een profiel of maak een nieuw profiel aan.</h3>+ ${openremote.hasRole("write:rules") ? html`+ <button style="margin: auto;" @click="${this.createRuleset}">profiel aanmaken</button>+ ` : ``}+ </div>+ `}`;}- private validatedRule(e: any) {- this.isValidRule = e.detail.isValidRule;+ protected isReadonly(sectionName: string) {++ if (!openremote.hasRole("write:rules")) {+ return true;+ }+ if (!this.config || !this.config.controls) {+ return false;+ }++ if (sectionName === "when") {+ return this.config.controls.whenReadonly === true;+ }++ if (sectionName === "then") {+ return this.config.controls.thenReadonly === true;+ }++ if (sectionName === "header") {+ return this.config.controls.headerReadonly === true;+ }+ }++ protected onRuleChanged() {+ this._activeModified = true;+ let isValid = false;+ const rule = this.activeRule;++ if (rule) {+ isValid = this.validateRuleset();+ }++ this.isValidRule = isValid;+ this.requestUpdate();}- private readRules() {+ protected validateRuleset(): boolean {++ const ruleset = this.activeRuleset;+ const rule = this.activeRule;++ if (!ruleset || !rule) {+ return false;+ }++ if (!ruleset.name || ruleset.name.length < 3 || ruleset.name.length > 255) {+ return false;+ }++ if (!rule.when) {+ return false;+ }++ if (!rule.then) {+ return false;+ }++ if (!this.validateConditionGroup(rule.when)) {+ return false;+ }++ if (!this.validateRuleActions(rule, rule.then)) {+ return false;+ }++ // TODO: Validate other rule sections+ return true;+ }++ protected validateConditionGroup(group: LogicGroup<RuleCondition>): boolean {+ if (!group.items || group.items.length === 0) {+ return false;+ }++ for (const condition of group.items) {+ if (!condition.assets && !condition.datetime && !condition.timer) {+ return false;+ }++ if (condition.assets && !this.validateAssetQuery(condition.assets)) {+ return false;+ }++ if (condition.datetime && !this.validateValuePredicate(condition.datetime)) {+ return false;+ }++ if (condition.timer && !isTimeDuration(condition.timer)) {+ return false;+ }+ }++ if (group.groups) {+ for (const childGroup of group.groups) {+ if (!this.validateConditionGroup(childGroup)) {+ return false;+ }+ }+ }++ return true;+ }++ protected validateRuleActions(rule: Rule, actions?: RuleActionUnion[]): boolean {+ if (!actions) {+ return true;+ }++ for (const action of actions) {+ switch (action.action) {+ case "wait":+ if (!action.millis) {+ return false;+ }+ break;+ case "write-attribute":+ if (!action.attributeName) {+ return false;+ }+ if (!this.validateAssetTarget(rule, action.target)) {+ return false;+ }+ break;+ case "notification":++ break;+ case "update-attribute":+ if (!action.attributeName) {+ return false;+ }+ if (!action.updateAction) {+ return false;+ }+ if (!this.validateAssetTarget(rule, action.target)) {+ return false;+ }+ break;+ default:+ return false;+ }+ }++ return true;+ }++ protected validateAssetTarget(rule: Rule, target?: RuleActionTarget): boolean {+ if (!target) {+ return true;+ }++ if (!target.assets && !target.ruleConditionTag) {+ return false;+ }++ if (target.assets) {+ return this.validateAssetQuery(target.assets);+ }++ const typesAndTags = this.getTypeAndTagsFromGroup(rule.when!);+ if (typesAndTags.findIndex((typeAndTag) => target.ruleConditionTag === typeAndTag[1]) < 0) {+ return false;+ }++ return true;+ }++ protected validateAssetQuery(query?: NewAssetQuery): boolean {+ if (!query) {+ return true;+ }++ if (!query.types || query.types.length === 0) {+ return false;+ }++ if (!query.attributes || !query.attributes.items || query.attributes.items.length === 0) {+ return false;+ }++ if (query.types) {+ for (const type of query.types) {+ if (!type.match || !type.value) {+ return false;+ }+ }+ }++ if (query.attributes && query.attributes.items) {+ for (const attribute of query.attributes.items) {+ if (!attribute.name || !attribute.name.match || !attribute.name.value) {+ return false;+ }+ if (!attribute.value || !this.validateValuePredicate(attribute.value)) {+ return false;+ }+ }+ }++ return true;+ }++ protected validateValuePredicate(valuePredicate: ValuePredicateUnion): boolean {+ switch (valuePredicate.predicateType) {+ case "string":+ return valuePredicate.match !== undefined && valuePredicate.value !== undefined;+ case "boolean":+ return valuePredicate.value !== undefined;+ case "string-array":+ return valuePredicate.predicates !== undefined && valuePredicate.predicates.length > 0 && valuePredicate.predicates.findIndex((p) => !p.match || p.value === undefined) === 0;+ case "datetime":+ case "number":+ return valuePredicate.operator !== undefined && valuePredicate.value !== undefined && (valuePredicate.operator !== BaseAssetQueryOperator.BETWEEN || valuePredicate.rangeValue !== undefined);+ case "radial":+ return valuePredicate.radius !== undefined && valuePredicate.lat !== undefined && valuePredicate.lng !== undefined;+ case "rect":+ return valuePredicate.lngMax !== undefined && valuePredicate.latMax !== undefined && valuePredicate.lngMin !== undefined && valuePredicate.latMin !== undefined;+ case "object-value-key":+ return valuePredicate.key !== undefined;+ case "array":+ return (valuePredicate.index && !valuePredicate.value) || valuePredicate.value || valuePredicate.lengthEquals || valuePredicate.lengthLessThan || valuePredicate.lengthGreaterThan;+ case "value-empty":+ case "value-not-empty":+ return true;+ default:+ return false;+ }+ }++ protected readRules() {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) {- const index = findIndex(this.rulesets, ["id", this.ruleset.id]);- let updatedRuleset;-- // ID is not found when a new ruleset is added- if (index > -1) {- updatedRuleset = this.rulesets[index];- } else {- updatedRuleset = this.rulesets[this.rulesets.length - 1];- }- this.ruleset = updatedRuleset;- this.computeRuleset();+ this._rulesets = response.data;++ if (this._rulesets && this.activeRuleset) {+ this.activeRuleset = this._rulesets.find((ruleset) => ruleset.id === this.activeRuleset!.id);}- this.requestUpdate();}}).catch((reason: any) => {- console.log("Error:" + reason);+ console.error("Error: " + reason);});}- private async createRule() {- const shouldContinue = await this.shouldShowModal();+ protected async createRuleset() {+ const shouldContinue = await this.okToLeaveActiveRule();if (!shouldContinue) {return;}- if (this.rulesets) {- const newRule = cloneDeep(rulesetTemplate);- this.rulesets = [...this.rulesets, rulesetTemplate];- this.ruleset = newRule;- this.computeRuleset();- // this.readRules();+ if (this._rulesets) {++ let rule = this.config && this.config.templates && this.config.templates.rule ? JSON.parse(JSON.stringify(this.config.templates.rule)) as Rule : undefined;++ if (!rule) {+ rule = {};+ }++ const name = this.config && this.config.templates && this.config.templates.rulesetName ? this.config.templates.rulesetName : OrRulesEditor.DEFAULT_RULESET_NAME;+ rule.name = name;+ const rules: JsonRulesetDefinition = {+ rules: [rule]+ };++ const ruleset: TenantRuleset = {+ id: 0,+ type: "tenant",+ name: name,+ lang: RulesetLang.JSON,+ realm: openremote.getRealm(),+ rules: JSON.stringify(rules)+ };++ this._rulesets = [...this._rulesets, ruleset];+ this.activeRuleset = ruleset;}}- private 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();- });+ protected saveRuleset(e: Event) {+ e.preventDefault();++ if (!this.activeRuleset || !this.activeRule) {+ return;}- }- private updateRule(e: any) {- this.ruleset = e.detail.ruleset;- if (this.ruleset && this.ruleset.id && this.rule) {- delete this.ruleset.lastModified;- delete this.ruleset.createdOn;- delete this.ruleset.status;- delete this.ruleset.error;+ this._saveInProgress = true;+ this.activeRule.name = this.activeRuleset.name;+ this._activeRules![0] = this.activeRule;+ const ruleset = this.activeRuleset;- // Parse rule to string of array of rules- this.rule.name = this.ruleset.name;- this.ruleset.rules = JSON.stringify({rules: [this.rule]});+ const rules: JsonRulesetDefinition = {+ rules: this._activeRules+ };- // this.ruleset.rules = JSON.stringify(this.rules);- rest.api.RulesResource.updateTenantRuleset(this.ruleset.id, this.ruleset).then((response: any) => {+ ruleset.rules = JSON.stringify(rules);+ delete ruleset.lastModified;+ delete ruleset.createdOn;+ delete ruleset.status;+ delete ruleset.error;++ if (ruleset.id) {+ rest.api.RulesResource.updateTenantRuleset(ruleset.id!, ruleset).then((response) => {+ this._saveInProgress = false;+ this.readRules();+ });+ } else {+ rest.api.RulesResource.createTenantRuleset(ruleset).then((response) => {+ ruleset.id = response.data;+ this._saveInProgress = false;this.readRules();});}-}- private deleteRule() {+ protected deleteRuleset() {++ if (!this.activeRuleset) {+ return;+ }++ let confirmed = !this._activeModified || window.confirm(i18next.t("continueWithoutSaving"));++ if (!confirmed) {+ return;+ }++ confirmed = !this.activeRuleset.id || window.confirm(i18next.t("confirmDelete"));- if (!this.ruleset || !this.ruleset.id) {+ if (!confirmed) {return;}- const id = this.ruleset.id;- confirmDialog("Als je doorgaat worden je veranderingen niet opgeslagen. Doorgaan zonder opslaan?")- .then(() => {- rest.api.RulesResource.deleteTenantRuleset(id).then(() => {- this.cleanRule();- });- })- .catch(() => {- // do something when canceled?+ const id = this.activeRuleset.id;+ const index = this._rulesets!.findIndex((ruleset) => ruleset.id === this.activeRuleset!.id);+ if (index >= 0) {+ this._rulesets!.splice(index, 1);+ }+ this.activeRuleset = undefined;++ if (id) {+ rest.api.RulesResource.deleteTenantRuleset(id).then((response) => {+ this.readRules();});+ }+ }+ protected async setActiveRuleset(e: any) {+ if (this.okToLeaveActiveRule()) {+ this.activeRuleset = e.detail.ruleset;+ }}- private cleanRule() {- if (this.rulesets && this.ruleset) {- const index = findIndex(this.rulesets, ["id", this.ruleset.id]);- if (index) {- this.rulesets.splice(index, 1);- } else {- this.rulesets.splice(this.rulesets.length - 1, 1);- }+ protected okToLeaveActiveRule() {++ const confirmed = !this._activeModified || window.confirm(i18next.t("continueWithoutSaving"));- this.rulesets = [...this.rulesets];- this.ruleset = undefined;- this.rule = undefined;- this.requestUpdate();+ if (confirmed) {+ if (this.activeRuleset && this.activeRuleset.id === 0) {+ const index = this._rulesets!.findIndex((ruleset) => ruleset.id === this.activeRuleset!.id);+ if (index >= 0) {+ this._rulesets!.splice(index, 1);+ this._rulesets = [...this._rulesets!];+ }+ }}+ return confirmed;}- private computeRuleset() {- if (this.ruleset && this.ruleset.rules) {- this.rule = JSON.parse(this.ruleset.rules).rules[0];- } else if (this.ruleset && !this.ruleset.rules) {- this.rule = cloneDeep(ruleTemplate);- this.rule.name = this.ruleset.name;+ protected getTypeAndTagsFromGroup(group: LogicGroup<RuleCondition>): [string, string?][] {+ if (!group) {+ return [];}- this.requestUpdate();- }- private async setActiveRule(e: any) {- const shouldContinue = await this.shouldShowModal();- if (!shouldContinue) {- return;+ let typesAndTags: [string, string?][] = [];++ if (group.items) {+ for (const condition of group.items) {+ const type = getAssetTypeFromQuery(condition.assets);+ if (type) {+ typesAndTags.push([type, condition.tag]);+ }+ }}- this.ruleset = e.detail.ruleset;- this.readRules();++ if (group.groups) {+ for (const condition of group.groups) {+ typesAndTags = typesAndTags.concat(this.getTypeAndTagsFromGroup(condition));+ }+ }++ return typesAndTags;}- private shouldShowModal() {- if (this.ruleset && this.ruleset.rules !== JSON.stringify({rules: [this.rule]})) {- return confirmDialog("Als je doorgaat worden je veranderingen niet opgeslagen. Doorgaan zonder opslaan?");- } else {- return true;- }+ protected getTargetTypeMap(): [string, string?][] {+ if (!this.activeRule || !this.activeRule.when) {+ return [];+ }+ return this.getTypeAndTagsFromGroup(this.activeRule.when);}+ protected getAssetDescriptors(useActionConfig: boolean) {+ if (useActionConfig) {+ if (this._actionAssetDescriptors) {+ return this._actionAssetDescriptors;+ }+ this._actionAssetDescriptors = getAssetDescriptors(this.config, useActionConfig);+ return this._actionAssetDescriptors;+ }+ if (this._whenAssetDescriptors) {+ return this._whenAssetDescriptors;+ }++ this._whenAssetDescriptors = getAssetDescriptors(this.config, useActionConfig);+ return this._whenAssetDescriptors;+ }}diff --git a/ui/component/or-rules-editor/src/or-rule-actions.ts b/ui/component/or-rules-editor/src/or-rule-actions.tsnew file mode 100644index 000000000..6faeda772--- /dev/null+++ b/ui/component/or-rules-editor/src/or-rule-actions.ts@@ -0,0 +1,265 @@+import {customElement, html, LitElement, TemplateResult, property} from "lit-element";+import {actionStyle} from "./style";+import "./or-rule-asset-query";+import {+ ActionType,+ RulesConfig,+ ActionTargetType,+ getAssetTypeFromQuery, OrRuleChangedEvent+} from "./index";+import {+ RuleActionUnion, AssetDescriptor, AttributeDescriptor, RuleActionWriteAttribute+} from "@openremote/model";+import i18next from "i18next";+import {OrSelectChangedEvent} from "@openremote/or-select";+import {OrInputChangedEvent} from "@openremote/or-input";++@customElement("or-rule-actions")+class OrRuleActions extends LitElement {++ static get styles() {+ return actionStyle;+ }++ @property({type: Array})+ public actions?: RuleActionUnion[];++ @property({type: Object})+ public targetTypeMap?: [string, string?][];++ public readonly?: boolean;++ public newTemplate?: RuleActionUnion;++ public config?: RulesConfig;++ public assetDescriptors?: AssetDescriptor[];++ public allowAdd: boolean = true;++ private _ruleActionTargets = [ActionTargetType.TRIGGER_ASSETS, ActionTargetType.TAGGED_ASSETS, ActionTargetType.OTHER_ASSETS, ActionTargetType.USERS];+ private _ruleActionTypes = [ActionType.WRITE_ATTRIBUTE, ActionType.UPDATE_ATTRIBUTE, ActionType.NOTIFICATION, ActionType.WAIT];++ protected ruleActionTemplate(action: RuleActionUnion) {++ if (!action) {+ return ``;+ }++ let targetTemplate: TemplateResult | string = ``;+ let currentTarget = ActionTargetType.TRIGGER_ASSETS;+ const hideTargetOptions = !this.config || !this.config.controls || !this.config.controls.hideActionTargetOptions;+ const hideUpdateOptions = !this.config || !this.config.controls || !this.config.controls.hideActionUpdateOptions;+ const allowedTargets = this.config && this.config.controls && this.config.controls.allowedActionTargets ? this.config.controls.allowedActionTargets : this._ruleActionTargets;+ let targetRhsTemplate: TemplateResult | string = ``;++ if (action.target) {+ if (action.target.ruleConditionTag) {+ currentTarget = ActionTargetType.TAGGED_ASSETS;+ if (!hideTargetOptions) {+ targetRhsTemplate = html`<or-select @or-select-changed="${(e: OrSelectChangedEvent) => this.setActionTriggerTag(action, e.detail.value)}" ?readonly="${this.readonly}" options="${this.getTriggerTags}" value="${action.target.ruleConditionTag}"></or-select>`;+ }+ } else if (action.target.users) {+ currentTarget = ActionTargetType.USERS;+ if (!hideTargetOptions) {+ targetRhsTemplate = html`<span>USER QUERY NOT IMPLEMENTED</span>`;+ }+ } else if (action.target.assets) {+ currentTarget = ActionTargetType.OTHER_ASSETS;+ if (!hideTargetOptions) {+ targetRhsTemplate = html`<or-rule-asset-query .config="${this.config}" .assetDescriptors="${this.assetDescriptors}" .readonly="${this.readonly}" .query="${action.target.assets}"></or-rule-asset-query>`;+ }+ }+ }++ if (!hideTargetOptions) {+ const translatedAllowedTargets = allowedTargets.map((at) => [at, i18next.t(at)] as [string, string]);+ targetTemplate = html`+ <div class="rule-action-target">+ <span><or-translate value="target"></or-translate>: </span><or-select id="actionTargetSelect" @or-select-changed="${(e: OrSelectChangedEvent) => this.setActionTarget(action, e.detail.value as ActionTargetType)}" ?readonly="${this.readonly}" .options="${translatedAllowedTargets}" value="${currentTarget}"></or-select>+ ${targetRhsTemplate}+ </div>+ `;+ }++ let actionTemplate: TemplateResult | string = ``;+ switch (action.action) {+ case "wait":+ actionTemplate = html`<span>WAIT NOT IMPLEMENTED</span>`;+ break;+ case "notification":+ actionTemplate = html`<span>NOTIFICATIONS NOT IMPLEMENTED</span>`;+ break;+ case "write-attribute":+ case "update-attribute":+ let assetTypes: [string, string][] = [];++ switch (currentTarget) {+ case ActionTargetType.USERS:+ return html`<span>INVALID RULE</span>`;+ case ActionTargetType.TRIGGER_ASSETS:+ // Get all asset types+ assetTypes = this.getAssetTypes();+ break;+ case ActionTargetType.OTHER_ASSETS:+ const type = getAssetTypeFromQuery(action.target!.assets);+ if (type) {+ if (this.assetDescriptors) {+ const descriptor = this.assetDescriptors.find((ad) => ad.type === type);+ if (descriptor) {+ assetTypes.push([descriptor.type!, descriptor.name!]);+ }+ }+ }+ break;+ case ActionTargetType.TAGGED_ASSETS:+ assetTypes = this.getAssetTypes(action.target!.ruleConditionTag!);+ break;+ }++ const attributeDescriptors = this.getCommonAttributes(assetTypes);+ const attributeNames = attributeDescriptors.map((ad) => [ad.attributeName, i18next.t(ad.attributeName!)]);+ const assetType = assetTypes.length > 0 ? assetTypes[0][0] : undefined;++ actionTemplate = html`+ <or-select @or-select-changed="${(e: OrSelectChangedEvent) => this.setActionAttributeName(action, e.detail.value)}" ?readonly="${this.readonly}" .options="${attributeNames}" .value="${action.attributeName}"></or-select>+ ${action.attributeName ? html`<or-input @or-input-changed="${(e: OrInputChangedEvent) => this.setActionAttributeValue(action, e.detail.value)}" ?readonly="${this.readonly}" .assetType="${assetType}" .attributeName="${action.attributeName}" .value="${action.value}"></or-input>` : ``}+ `;++ if (action.action === "update-attribute" && !hideUpdateOptions) {+ actionTemplate = html`+ ${actionTemplate}+ <span>UPDATE NOT IMPLEMENTED</span>+ `;+ }+ break;+ }++ return html`+ ${targetTemplate}+ <div class="rule-action-action">+ ${actionTemplate}+ </div>+ `;+ }++ protected render() {++ const allowedActions = this.config && this.config.controls && this.config.controls.allowedActionTypes ? this.config.controls.allowedActionTypes : this._ruleActionTypes;++ return html`+ ${this.actions ? this.actions.map((action: RuleActionUnion) => {+ return html`+ <div class="rule-action">+ ${this.ruleActionTemplate(action)}+ ${!this.readonly && (this.allowAdd || this.actions!.length > 1) ? html`+ <button class="button-clear" @click="${() => this.removeAction(action)}"><or-icon icon="close-circle"></or-icon></input>+ ` : ``}+ </div>+ `; }) : ``}+ ${this.allowAdd ? html`+ <div class="add-buttons-container">+ <button class="button-clear add-button" @click="${this.addAction}"><or-icon icon="plus-circle"></or-icon><or-translate value="rulesEditorAddAction"></or-translate></button>+ </div>+ ` : ``}+ `;+ }++ protected getCommonAttributes(assetTypeAndNames: [string, string][]) {++ let isFirst = true;+ let attributes: AttributeDescriptor[] = [];+ for (const assetTypeAndName of assetTypeAndNames) {+ const assetDescriptor = this.assetDescriptors ? this.assetDescriptors.find((ad) => ad.type === assetTypeAndName[0]) : undefined;+ if (assetDescriptor && assetDescriptor.attributeDescriptors) {+ if (isFirst) {+ attributes = [...assetDescriptor.attributeDescriptors];+ } else {+ attributes = attributes.filter((attribute) => assetDescriptor.attributeDescriptors!.find((ad) => ad.attributeName === attribute.attributeName));+ }+ }+ isFirst = false;+ if (attributes.length === 0) {+ break;+ }+ }++ return attributes;+ }++ protected getTriggerTags(): string[] {+ if (!this.targetTypeMap) {+ return [];+ }++ return this.targetTypeMap.filter((typeAndTag) => typeAndTag[1] !== undefined).map((typeAndTag) => typeAndTag[1]!).sort();+ }++ protected getAssetTypes(tagName?: string) {+ if (!this.targetTypeMap || !this.assetDescriptors) {+ return [];+ }++ return this.targetTypeMap.filter((typeAndTag) => !tagName || typeAndTag[1] === tagName).map((typeAndTag) => {+ const descriptor = this.assetDescriptors!.find((ad) => ad.type === typeAndTag[0]);+ if (descriptor) {+ return [descriptor.type, descriptor.name] as [string, string];+ }+ return null;+ }).filter((type) => type !== null) as [string, string][];+ }++ protected removeAction(action?: RuleActionUnion) {+ if (!this.actions || !action) {+ return;+ }++ const index = this.actions.indexOf(action);+ if (index >= 0) {+ this.actions.splice(index, 1);+ this.dispatchEvent(new OrRuleChangedEvent());+ this.requestUpdate();+ }+ }++ protected addAction() {++ if (!this.actions) {+ return;+ }++ let newAction: RuleActionUnion = {+ action: "write-attribute"+ };++ if (this.newTemplate) {+ newAction = JSON.parse(JSON.stringify(this.newTemplate)) as RuleActionUnion;+ }++ this.actions.push(newAction);+ this.dispatchEvent(new OrRuleChangedEvent());+ this.requestUpdate();+ }++ protected setActionTarget(action: RuleActionUnion, target: ActionTargetType | undefined) {+ // TODO: Set action target+ }++ protected setActionTriggerTag(action: RuleActionUnion, tag: string | undefined) {+ action.target!.ruleConditionTag = tag;+ this.dispatchEvent(new OrRuleChangedEvent());+ this.requestUpdate();+ }++ protected setActionAttributeName(action: RuleActionUnion, name: string | undefined) {+ (action as RuleActionWriteAttribute).attributeName = name;+ this.dispatchEvent(new OrRuleChangedEvent());+ this.requestUpdate();+ }++ protected setActionAttributeValue(action: RuleActionUnion, value: any) {+ (action as RuleActionWriteAttribute).value = value;+ this.dispatchEvent(new OrRuleChangedEvent());+ this.requestUpdate();+ }+}diff --git a/ui/component/or-rules-editor/src/or-rule-asset-query.ts b/ui/component/or-rules-editor/src/or-rule-asset-query.tsnew file mode 100644index 000000000..d8e6beef4--- /dev/null+++ b/ui/component/or-rules-editor/src/or-rule-asset-query.ts@@ -0,0 +1,544 @@+import {customElement, html, LitElement, property} from "lit-element";+import {+ AttributeDescriptor,+ AttributePredicate,+ AttributeValueType,+ BaseAssetQueryMatch,+ BaseAssetQueryOperator,+ NewAssetQuery,+ ValuePredicateUnion,+ ValueType,+ AttributeValueDescriptor,+ AssetDescriptor+} from "@openremote/model";+import {+ AssetQueryOperator, AssetTypeAttributeName,+ getAssetTypeFromQuery,+ getDescriptorValueType, OrRuleChangedEvent,+ RulesConfig,+ RulesConfigAttribute+} from "./index";+import {OrSelectChangedEvent} from "@openremote/or-select";+import "@openremote/or-input";+import {InputType, OrInputChangedEvent} from "@openremote/or-input";+import {getEnumKeyAsString} from "@openremote/core/dist/util";+import {assetQueryEditorStyle} from "./style";+import i18next from "i18next";++@customElement("or-rule-asset-query")+class OrRuleAssetQuery extends LitElement {++ @property({type: Object})+ public query?: NewAssetQuery;++ public readonly?: boolean;++ public config?: RulesConfig;++ public assetDescriptors?: AssetDescriptor[];++ // Value predicates for specific attribute value descriptors+ protected _queryOperatorsMap: Map<AssetTypeAttributeName | AttributeDescriptor | AttributeValueDescriptor | ValueType, AssetQueryOperator[]> = new Map<AssetTypeAttributeName | AttributeDescriptor | AttributeValueDescriptor | ValueType, AssetQueryOperator[]>([+ [AttributeValueType.GEO_JSON_POINT, [AssetQueryOperator.EQUALS, AssetQueryOperator.NOT_EQUALS, AssetQueryOperator.WITHIN_RADIUS, AssetQueryOperator.OUTSIDE_RADIUS, AssetQueryOperator.WITHIN_RECTANGLE, AssetQueryOperator.OUTSIDE_RECTANGLE]],+ [ValueType.STRING, [AssetQueryOperator.EQUALS, AssetQueryOperator.NOT_EQUALS, AssetQueryOperator.CONTAINS, AssetQueryOperator.NOT_CONTAINS, AssetQueryOperator.STARTS_WITH, AssetQueryOperator.NOT_STARTS_WITH, AssetQueryOperator.ENDS_WITH, AssetQueryOperator.NOT_ENDS_WITH, AssetQueryOperator.VALUE_EMPTY, AssetQueryOperator.VALUE_NOT_EMPTY]],+ [ValueType.NUMBER, [AssetQueryOperator.EQUALS, AssetQueryOperator.NOT_EQUALS, AssetQueryOperator.GREATER_THAN, AssetQueryOperator.GREATER_EQUALS, AssetQueryOperator.LESS_THAN, AssetQueryOperator.LESS_EQUALS, AssetQueryOperator.BETWEEN, AssetQueryOperator.NOT_BETWEEN, AssetQueryOperator.VALUE_EMPTY, AssetQueryOperator.VALUE_NOT_EMPTY]],+ [ValueType.BOOLEAN, [AssetQueryOperator.IS_TRUE, AssetQueryOperator.IS_FALSE, AssetQueryOperator.VALUE_EMPTY, AssetQueryOperator.VALUE_NOT_EMPTY]],+ [ValueType.ARRAY, [AssetQueryOperator.CONTAINS, AssetQueryOperator.NOT_CONTAINS, AssetQueryOperator.INDEX_CONTAINS, AssetQueryOperator.NOT_INDEX_CONTAINS, AssetQueryOperator.LENGTH_EQUALS, AssetQueryOperator.NOT_LENGTH_EQUALS, AssetQueryOperator.LENGTH_LESS_THAN, AssetQueryOperator.LENGTH_GREATER_THAN, AssetQueryOperator.VALUE_EMPTY, AssetQueryOperator.VALUE_NOT_EMPTY]],+ [ValueType.OBJECT, [AssetQueryOperator.CONTAINS_KEY, AssetQueryOperator.NOT_CONTAINS_KEY, AssetQueryOperator.VALUE_EMPTY, AssetQueryOperator.VALUE_NOT_EMPTY]]+ ]);++ protected attributePredicateEditorTemplate(assetDescriptor: AssetDescriptor | undefined, attributePredicate: AttributePredicate) {++ const attribute = attributePredicate && attributePredicate.name ? attributePredicate.name.value : undefined;+ const valuePredicate = attributePredicate.value;++ if (!assetDescriptor || !valuePredicate) {+ return ``;+ }++ switch (valuePredicate.predicateType) {+ case "string":+ const descriptor = assetDescriptor && assetDescriptor.attributeDescriptors ? assetDescriptor.attributeDescriptors.find((ad) => ad.attributeName === attribute) : undefined;+ return html`+ <or-input required type="${InputType.TEXT}" @or-input-changed="${(e: OrInputChangedEvent) => this.setValuePredicateProperty(valuePredicate, "value", e.detail.value)}" .assetType="${getAssetTypeFromQuery(this.query)}" .attributeName="${this.attribute}" .attributeDescriptor="${descriptor}" .value="${valuePredicate.value ? valuePredicate.value : null}" ?readonly="${this.readonly}"></or-input>+ `;+ break;+ case "boolean":+ return html `<span>NOT IMPLEMENTED</span>`;+ case "datetime":+ return html `<span>NOT IMPLEMENTED</span>`;+ case "number":+ if (valuePredicate.operator === BaseAssetQueryOperator.BETWEEN) {+ return html`+ <or-input required type="${InputType.NUMBER}" @or-input-changed="${(e: OrInputChangedEvent) => this.setValuePredicateProperty(valuePredicate, "value", e.detail.value)}" .assetType="${getAssetTypeFromQuery(this.query)}" .attributeName="${this.attribute}" .attributeDescriptor="${descriptor}" .value="${valuePredicate.value ? valuePredicate.value : null}" ?readonly="${this.readonly}"></or-input>+ <span style="display: inline-flex; align-items: center;">&</span>+ <or-input required type="${InputType.NUMBER}" @or-input-changed="${(e: OrInputChangedEvent) => this.setValuePredicateProperty(valuePredicate, "rangeValue", e.detail.value)}" .assetType="${getAssetTypeFromQuery(this.query)}" .attributeName="${this.attribute}" .attributeDescriptor="${descriptor}" .value="${valuePredicate.rangeValue ? valuePredicate.rangeValue : null}" ?readonly="${this.readonly}"></or-input>+ `;+ }+ return html`+ <or-input required type="${InputType.NUMBER}" @or-input-changed="${(e: OrInputChangedEvent) => this.setValuePredicateProperty(valuePredicate, "value", e.detail.value)}" .assetType="${getAssetTypeFromQuery(this.query)}" .attributeName="${this.attribute}" .attributeDescriptor="${descriptor}" .value="${valuePredicate.value ? valuePredicate.value : null}" ?readonly="${this.readonly}"></or-input>+ `;+ case "string-array":+ return html `<span>NOT IMPLEMENTED</span>`;+ case "radial":+ return html `<span>NOT IMPLEMENTED</span>`;+ case "rect":+ return html `<span>NOT IMPLEMENTED</span>`;+ case "object-value-key":+ return html `<span>NOT IMPLEMENTED</span>`;+ case "value-empty":+ return ``;+ case "value-not-empty":+ return ``;+ case "array":+ // TODO: Update once we can determine inner type of array+ // Assume string array+ return html`<or-input required type="${InputType.TEXT}" @or-input-changed="${(e: OrInputChangedEvent) => this.setValuePredicateProperty(valuePredicate, "value", e.detail.value)}" .assetType="${getAssetTypeFromQuery(this.query)}" .attributeName="${this.attribute}" .attributeDescriptor="${descriptor}" .value="${valuePredicate.value ? valuePredicate.value : null}" ?readonly="${this.readonly}"></or-input>`;+ default:+ return html `<span>NOT IMPLEMENTED</span>`;+ }+ }++ static get styles() {+ return assetQueryEditorStyle;+ }++ protected render() {+ if (!this.query) {+ return;+ }++ const assetType = getAssetTypeFromQuery(this.query);++ if (!assetType) {+ return;+ }++ const assetDescriptor = this.assetDescriptors ? this.assetDescriptors.find((ad) => ad.type === assetType) : undefined;++ if (!assetDescriptor) {+ return;+ }++ const operator = this.operator;+ const attributePredicate = this.attributePredicate;+ const attribute = attributePredicate && attributePredicate.name ? attributePredicate.name.value : undefined;+ const attributes = this.getAttributes(assetDescriptor).map((a) => [a, i18next.t(a)]);++ return html`+ <or-select @or-select-changed="${(e: OrSelectChangedEvent) => this.attribute = e.detail.value}" ?readonly="${this.readonly}" .options="${attributes}" .value="${attribute}"></or-select>++ ${attribute ? html`<or-select @or-select-changed="${(e: OrSelectChangedEvent) => this.setOperator(assetDescriptor, e.detail.value)}" ?readonly="${this.readonly}" .options="${this.getOperators(assetDescriptor, attribute)}" .value="${operator}"></or-select>` : ``}++ ${attributePredicate ? this.attributePredicateEditorTemplate(assetDescriptor, attributePredicate) : ``}+ `;+ }++ protected getAttributes(descriptor?: AssetDescriptor) {+ let attributes: string[] = [];++ if (descriptor && descriptor.attributeDescriptors) {+ attributes = descriptor.attributeDescriptors.map((ad) => ad.attributeName!);+ }++ return attributes;+ }++ protected get attribute(): string | undefined {+ const attributePredicate = this.attributePredicate;+ return attributePredicate && attributePredicate.name ? attributePredicate.name.value : undefined;+ }++ protected set attribute(attributeName: string | undefined) {+ const attributePredicate: AttributePredicate = {};+ this.attributePredicate = attributePredicate;++ if (!attributePredicate!.name) {+ attributePredicate!.name = {+ predicateType: "string"+ };+ }++ attributePredicate!.name.match = BaseAssetQueryMatch.EXACT;+ attributePredicate!.name.value = attributeName;+ this.dispatchEvent(new OrRuleChangedEvent());+ this.requestUpdate();+ }++ protected getOperatorMapValue(operatorMap: Map<AssetTypeAttributeName | AttributeDescriptor | AttributeValueDescriptor | ValueType, AssetQueryOperator[]>, assetType?: string, attributeName?: string, attributeDescriptor?: AttributeDescriptor, valueDescriptor?: AttributeValueDescriptor, valueType?: ValueType) {++ let assetAttributeMatch: AssetQueryOperator[] | undefined;+ let attributeDescriptorMatch: AssetQueryOperator[] | undefined;+ let attributeValueDescriptorMatch: AssetQueryOperator[] | undefined;+ let valueTypeMatch: AssetQueryOperator[] | undefined;++ operatorMap.forEach((v, k) => {++ if ((k as AssetTypeAttributeName).assetType && assetType && attributeName) {+ if ((k as AssetTypeAttributeName).assetType === assetType && (k as AssetTypeAttributeName).attributeName === attributeName) {+ assetAttributeMatch = v;+ }+ } else if ((k as AttributeDescriptor).attributeName && (k as AttributeDescriptor).valueDescriptor && attributeDescriptor && attributeDescriptor.valueDescriptor) {+ if ((k as AttributeDescriptor).attributeName === attributeDescriptor.attributeName && (k as AttributeDescriptor).valueDescriptor!.name === attributeDescriptor.valueDescriptor.name) {+ attributeDescriptorMatch = v;+ }+ } else if ((k as AttributeValueDescriptor).valueType && valueDescriptor) {+ if ((k as AttributeValueDescriptor).name === valueDescriptor.name && (k as AttributeValueDescriptor).valueType === valueDescriptor.valueType) {+ attributeValueDescriptorMatch = v;+ }+ } else if ((k as ValueType).length && valueType) {+ if ((k as ValueType) === valueType) {+ valueTypeMatch = v;+ }+ }+ });++ if (assetAttributeMatch) {+ return assetAttributeMatch;+ }+ if (attributeDescriptorMatch) {+ return attributeDescriptorMatch;+ }+ if (attributeValueDescriptorMatch) {+ return attributeValueDescriptorMatch;+ }+ return valueTypeMatch;+ }++ protected getOperators(assetDescriptor: AssetDescriptor, attributeName: string | undefined) {+ if (!attributeName) {+ return [];+ }++ const descriptor = assetDescriptor.attributeDescriptors ? assetDescriptor.attributeDescriptors.find((ad) => ad.attributeName === attributeName) : undefined;+ const valueType = getDescriptorValueType(descriptor);+ let operators: AssetQueryOperator[] | undefined;++ if (this.config && this.config.controls && this.config.controls.allowedAssetQueryOperators) {+ operators = this.getOperatorMapValue(this.config.controls.allowedAssetQueryOperators, getAssetTypeFromQuery(this.query), attributeName, descriptor, descriptor ? descriptor.valueDescriptor : undefined, valueType);+ }++ if (!operators) {+ operators = this.getOperatorMapValue(this._queryOperatorsMap, getAssetTypeFromQuery(this.query), attributeName, descriptor, descriptor ? descriptor.valueDescriptor : undefined, valueType);+ }++ return operators ? operators.map((v) => [v, i18next.t(v)]) : [];+ }++ protected get operator(): string | undefined {++ const attribtePredicate = this.attributePredicate;+ if (!attribtePredicate || !attribtePredicate.value) {+ return;+ }++ const valuePredicate = attribtePredicate.value;++ switch (valuePredicate.predicateType) {+ case "string":+ switch (valuePredicate.match) {+ case BaseAssetQueryMatch.EXACT:+ return valuePredicate.negate ? AssetQueryOperator.NOT_EQUALS : AssetQueryOperator.EQUALS;+ case BaseAssetQueryMatch.BEGIN:+ return valuePredicate.negate ? AssetQueryOperator.NOT_STARTS_WITH : AssetQueryOperator.STARTS_WITH;+ case BaseAssetQueryMatch.END:+ return valuePredicate.negate ? AssetQueryOperator.NOT_ENDS_WITH : AssetQueryOperator.ENDS_WITH;+ case BaseAssetQueryMatch.CONTAINS:+ return valuePredicate.negate ? AssetQueryOperator.NOT_CONTAINS : AssetQueryOperator.CONTAINS;+ }+ return;+ case "boolean":+ return valuePredicate.value ? AssetQueryOperator.IS_TRUE : AssetQueryOperator.IS_FALSE;+ case "string-array":+ return;+ case "datetime":+ case "number":+ switch (valuePredicate.operator) {+ case BaseAssetQueryOperator.EQUALS:+ return valuePredicate.negate ? AssetQueryOperator.NOT_EQUALS : AssetQueryOperator.EQUALS;+ case BaseAssetQueryOperator.GREATER_THAN:+ return valuePredicate.negate ? AssetQueryOperator.LESS_EQUALS : AssetQueryOperator.GREATER_THAN;+ case BaseAssetQueryOperator.GREATER_EQUALS:+ return valuePredicate.negate ? AssetQueryOperator.LESS_THAN : AssetQueryOperator.GREATER_EQUALS;+ case BaseAssetQueryOperator.LESS_THAN:+ return valuePredicate.negate ? AssetQueryOperator.GREATER_EQUALS : AssetQueryOperator.LESS_THAN;+ case BaseAssetQueryOperator.LESS_EQUALS:+ return valuePredicate.negate ? AssetQueryOperator.GREATER_THAN : AssetQueryOperator.LESS_EQUALS;+ case BaseAssetQueryOperator.BETWEEN:+ return valuePredicate.negate ? AssetQueryOperator.NOT_BETWEEN : AssetQueryOperator.BETWEEN;+ }+ return;+ case "radial":+ return valuePredicate.negated ? AssetQueryOperator.OUTSIDE_RADIUS : AssetQueryOperator.WITHIN_RADIUS;+ case "rect":+ return valuePredicate.negated ? AssetQueryOperator.OUTSIDE_RECTANGLE : AssetQueryOperator.WITHIN_RECTANGLE;+ case "object-value-key":+ return valuePredicate.negated ? AssetQueryOperator.NOT_CONTAINS_KEY : AssetQueryOperator.CONTAINS_KEY;+ case "array":+ if (valuePredicate.value && valuePredicate.index) {+ return valuePredicate.negated ? AssetQueryOperator.NOT_INDEX_CONTAINS : AssetQueryOperator.INDEX_CONTAINS;+ }+ if (valuePredicate.lengthEquals) {+ return valuePredicate.negated ? AssetQueryOperator.NOT_LENGTH_EQUALS : AssetQueryOperator.LENGTH_EQUALS;+ }+ if (valuePredicate.lengthGreaterThan) {+ return valuePredicate.negated ? AssetQueryOperator.LENGTH_LESS_THAN : AssetQueryOperator.LENGTH_GREATER_THAN;+ }+ if (valuePredicate.lengthLessThan) {+ return valuePredicate.negated ? AssetQueryOperator.LENGTH_GREATER_THAN : AssetQueryOperator.LENGTH_LESS_THAN;+ }+ return valuePredicate.negated ? AssetQueryOperator.NOT_CONTAINS : AssetQueryOperator.CONTAINS;+ case "value-empty":+ return AssetQueryOperator.VALUE_EMPTY;+ case "value-not-empty":+ return AssetQueryOperator.VALUE_NOT_EMPTY;+ }+ }++ protected setOperator(assetDescriptor: AssetDescriptor, operator: string | undefined) {++ if (!this.query+ || !this.query.attributes+ || !this.query.attributes.items+ || this.query.attributes.items.length === 0) {+ return;+ }++ const attributePredicate = this.query.attributes.items[0];++ if (!operator) {+ attributePredicate.value = undefined;+ this.dispatchEvent(new OrRuleChangedEvent());+ this.requestUpdate();+ return;+ }++ const attributeDescriptor = assetDescriptor.attributeDescriptors ? assetDescriptor.attributeDescriptors.find((ad) => ad.attributeName === this.attribute) : undefined;+ const valueType = getDescriptorValueType(attributeDescriptor);+ const value = operator as AssetQueryOperator;++ if (!valueType || !value) {+ attributePredicate.value = undefined;+ this.dispatchEvent(new OrRuleChangedEvent());+ this.requestUpdate();+ return;+ }++ let predicate: ValuePredicateUnion | undefined;++ switch (value) {++ // object+ case AssetQueryOperator.NOT_CONTAINS_KEY:+ case AssetQueryOperator.CONTAINS_KEY:+ if (valueType === ValueType.OBJECT) {+ predicate = {+ predicateType: "object-value-key",+ negated: value === AssetQueryOperator.NOT_CONTAINS_KEY+ };+ }+ break;++ // array+ case AssetQueryOperator.INDEX_CONTAINS:+ case AssetQueryOperator.NOT_INDEX_CONTAINS:+ case AssetQueryOperator.LENGTH_EQUALS:+ case AssetQueryOperator.NOT_LENGTH_EQUALS:+ case AssetQueryOperator.LENGTH_LESS_THAN:+ case AssetQueryOperator.LENGTH_GREATER_THAN:+ if (valueType === ValueType.ARRAY) {+ predicate = {+ predicateType: "array",+ negated: value === AssetQueryOperator.NOT_INDEX_CONTAINS || value === AssetQueryOperator.NOT_LENGTH_EQUALS,+ index: value === AssetQueryOperator.INDEX_CONTAINS || value === AssetQueryOperator.NOT_INDEX_CONTAINS ? 0 : undefined,+ lengthEquals: value === AssetQueryOperator.LENGTH_EQUALS || value === AssetQueryOperator.NOT_LENGTH_EQUALS ? 0 : undefined,+ lengthGreaterThan: value === AssetQueryOperator.LENGTH_GREATER_THAN ? 0 : undefined,+ lengthLessThan: value === AssetQueryOperator.LENGTH_GREATER_THAN ? 0 : undefined,+ };+ }+ break;++ // geo point+ case AssetQueryOperator.WITHIN_RADIUS:+ case AssetQueryOperator.OUTSIDE_RADIUS:+ predicate = {+ predicateType: "radial",+ negated: value === AssetQueryOperator.OUTSIDE_RADIUS,+ lat: 0,+ lng: 0,+ radius: 50+ };+ break;+ case AssetQueryOperator.WITHIN_RECTANGLE:+ case AssetQueryOperator.OUTSIDE_RECTANGLE:+ predicate = {+ predicateType: "rect",+ negated: value === AssetQueryOperator.OUTSIDE_RECTANGLE,+ latMin: -0.1,+ lngMin: -0.1,+ latMax: 0.1,+ lngMax: 0.1+ };+ break;++ // boolean+ case AssetQueryOperator.IS_TRUE:+ case AssetQueryOperator.IS_FALSE:+ if (valueType === ValueType.BOOLEAN) {+ predicate = {+ predicateType: "boolean",+ value: value === AssetQueryOperator.IS_TRUE+ };+ break;+ }++ // string+ case AssetQueryOperator.STARTS_WITH:+ case AssetQueryOperator.NOT_STARTS_WITH:+ if (valueType === ValueType.STRING) {+ predicate = {+ predicateType: "string",+ negate: value === AssetQueryOperator.NOT_STARTS_WITH,+ match: BaseAssetQueryMatch.BEGIN+ };+ }+ break;+ case AssetQueryOperator.ENDS_WITH:+ case AssetQueryOperator.NOT_ENDS_WITH:+ if (valueType === ValueType.STRING) {+ predicate = {+ predicateType: "string",+ negate: value === AssetQueryOperator.NOT_ENDS_WITH,+ match: BaseAssetQueryMatch.END+ };+ }+ break;++ // number or datetime+ case AssetQueryOperator.NOT_BETWEEN:+ if (valueType === ValueType.NUMBER) {+ predicate = {+ predicateType: "number",+ operator: BaseAssetQueryOperator.BETWEEN,+ negate: true+ };+ } else {+ // Assume datetime+ predicate = {+ predicateType: "datetime",+ operator: BaseAssetQueryOperator.BETWEEN,+ negate: true+ };+ }+ break;+ case AssetQueryOperator.GREATER_THAN:+ case AssetQueryOperator.GREATER_EQUALS:+ case AssetQueryOperator.LESS_THAN:+ case AssetQueryOperator.LESS_EQUALS:+ case AssetQueryOperator.BETWEEN:+ const key = getEnumKeyAsString(AssetQueryOperator, value);++ if (valueType === ValueType.NUMBER) {+ predicate = {+ predicateType: "number",+ operator: key as BaseAssetQueryOperator+ };+ } else {+ // Assume datetime+ predicate = {+ predicateType: "datetime",+ operator: key as BaseAssetQueryOperator+ };+ }+ break;++ // multiple+ case AssetQueryOperator.EQUALS:+ case AssetQueryOperator.NOT_EQUALS:+ if (attributeDescriptor && attributeDescriptor.valueDescriptor && attributeDescriptor.valueDescriptor.name === AttributeValueType.DATETIME.name) {+ predicate = {+ predicateType: "datetime",+ negate: value === AssetQueryOperator.NOT_EQUALS,+ operator: BaseAssetQueryOperator.EQUALS+ };+ } else if (valueType === ValueType.NUMBER) {+ predicate = {+ predicateType: "number",+ negate: value === AssetQueryOperator.NOT_EQUALS,+ operator: BaseAssetQueryOperator.EQUALS+ };+ } else if (valueType === ValueType.STRING) {+ predicate = {+ predicateType: "string",+ negate: value === AssetQueryOperator.NOT_EQUALS,+ match: BaseAssetQueryMatch.EXACT+ };+ }+ break;+ case AssetQueryOperator.VALUE_EMPTY:+ predicate = {+ predicateType: "value-empty"+ };+ break;+ case AssetQueryOperator.VALUE_NOT_EMPTY:+ predicate = {+ predicateType: "value-not-empty"+ };+ break;+ case AssetQueryOperator.CONTAINS:+ case AssetQueryOperator.NOT_CONTAINS:+ if (valueType === ValueType.ARRAY) {+ predicate = {+ predicateType: "array",+ negated: value === AssetQueryOperator.NOT_CONTAINS+ };+ } else if (valueType === ValueType.STRING) {+ predicate = {+ predicateType: "string",+ negate: value === AssetQueryOperator.NOT_CONTAINS,+ match: BaseAssetQueryMatch.CONTAINS+ };+ }+ }++ attributePredicate.value = predicate;+ this.dispatchEvent(new OrRuleChangedEvent());+ this.requestUpdate();+ }++ protected get attributePredicate(): AttributePredicate | undefined {+ return this.query+ && this.query.attributes+ && this.query.attributes.items+ && this.query.attributes.items.length > 0+ ? this.query.attributes.items[0] : undefined;+ }++ protected set attributePredicate(attributePredicate: AttributePredicate | undefined) {+ if (!this.query || !attributePredicate) {+ return;+ }++ if (!this.query.attributes) {+ this.query.attributes = {};+ }++ if (!this.query.attributes.items) {+ this.query.attributes.items = [];+ }++ if (this.query.attributes.items.length === 0) {+ this.query.attributes.items.push(attributePredicate);+ } else {+ this.query.attributes.items[0] = attributePredicate;+ }+ this.dispatchEvent(new OrRuleChangedEvent());+ this.requestUpdate();+ }++ protected setValuePredicateProperty(valuePredicate: ValuePredicateUnion, propertyName: string, value: any) {+ (valuePredicate as any)[propertyName] = value;+ this.dispatchEvent(new OrRuleChangedEvent());+ this.requestUpdate();+ }+}diff --git a/ui/component/or-rules-editor/src/or-rule-condition.ts b/ui/component/or-rules-editor/src/or-rule-condition.tsnew file mode 100644index 000000000..ccafa7437--- /dev/null+++ b/ui/component/or-rules-editor/src/or-rule-condition.ts@@ -0,0 +1,175 @@+import {customElement, html, LitElement, TemplateResult, property} from "lit-element";+import {+ BaseAssetQueryMatch,+ RuleCondition,+ AssetDescriptor,+} from "@openremote/model";+import {+ RulesConfig,+ ConditionType,+ getAssetTypeFromQuery, OrRuleChangedEvent+} from "./index";+import "./or-rule-asset-query";+import {OrSelectChangedEvent} from "@openremote/or-select";+import {OrInputChangedEvent} from "@openremote/or-input";+import {conditionEditorStyle} from "./style";+import i18next from "i18next";++@customElement("or-rule-condition")+class OrRuleCondition extends LitElement {++ @property({type: Object})+ public ruleCondition?: RuleCondition;++ public readonly: boolean = false;++ public config?: RulesConfig;++ public assetDescriptors?: AssetDescriptor[];++ static get styles() {+ return conditionEditorStyle;+ }++ protected render() {++ if (!this.ruleCondition) {+ return;+ }++ const showTypeSelect = !this.config || !this.config.controls || this.config.controls.hideConditionTypeOptions !== true;+ const type = this.type;++ if (!type && !showTypeSelect) {+ return html`<span>INVALID CONFIG - NO TYPE SPECIFIED AND TYPE SELECTOR DISABLED</span>`;+ }++ let template: TemplateResult | string = ``;++ if (type) {+ switch (type) {+ case ConditionType.DATE_TIME:+ template = html`<span>DATE TIME NOT IMPLEMENTED</span>`;+ break;+ case ConditionType.TIMER:+ template = html`<span>TIMER NOT IMPLEMENTED</span>`;+ break;+ default:+ template = html`<or-rule-asset-query .config="${this.config}" .assetDescriptors="${this.assetDescriptors}" .readonly="${this.readonly}" .query="${this.ruleCondition.assets}"></or-rule-asset-query>`;+ break;+ }+ }++ return html`+ ${showTypeSelect ? html`<or-select @or-select-changed="${(e: OrSelectChangedEvent) => this.type = e.detail.value}" .options="${this.getTypes()}" .value="${type}" ?readonly="${this.readonly}"></or-select>` : ``}++ ${template}+ `;+ }++ protected getTypes() {++ let addAssetTypes = true;+ let addDatetime = true;+ let addTimer = true;++ if (this.config && this.config.controls && this.config.controls.allowedConditionTypes) {+ addAssetTypes = this.config.controls.allowedConditionTypes.indexOf(ConditionType.ASSET_QUERY) >= 0;+ addDatetime = this.config.controls.allowedConditionTypes.indexOf(ConditionType.DATE_TIME) >= 0;+ addTimer = this.config.controls.allowedConditionTypes.indexOf(ConditionType.TIMER) >= 0;+ }++ const types: [string, string][] = [];++ if (addAssetTypes && this.assetDescriptors) {+ this.assetDescriptors.forEach((ad) => types.push([ad.type!, ad.name!]));+ }++ if (types.length > 0 && (addDatetime || addTimer)) {+ types.push(["", "---"]); // Empty spacer+ }++ if (addDatetime) {+ types.push([ConditionType.DATE_TIME, i18next.t(ConditionType.DATE_TIME)]);+ }+ if (addTimer) {+ types.push([ConditionType.TIMER, i18next.t(ConditionType.TIMER)]);+ }++ return types;+ }++ protected get type(): string | undefined {+ if (!this.ruleCondition) {+ return;+ }++ const assetType = getAssetTypeFromQuery(this.ruleCondition.assets);+ if (assetType) {+ return assetType;+ }++ if (this.ruleCondition.timer) {+ return ConditionType.TIMER;+ }++ if (this.ruleCondition.datetime) {+ return ConditionType.DATE_TIME;+ }+ }++ protected set type(value: string | undefined) {+ if (!this.ruleCondition) {+ return;+ }++ if (!value || value === "") {+ this.ruleCondition.assets = undefined;+ this.ruleCondition.timer = undefined;+ this.ruleCondition.datetime = undefined;+ this.dispatchEvent(new OrRuleChangedEvent());+ this.requestUpdate();+ return;+ }++ if (value === ConditionType.TIMER) {+ this.ruleCondition.assets = undefined;+ this.ruleCondition.datetime = undefined;+ this.ruleCondition.timer = "1h";+ this.dispatchEvent(new OrRuleChangedEvent());+ this.requestUpdate();+ return;+ }++ if (value === ConditionType.DATE_TIME) {+ this.ruleCondition.assets = undefined;+ this.ruleCondition.timer = undefined;+ this.ruleCondition.datetime = {+ predicateType: "datetime"+ };+ this.dispatchEvent(new OrRuleChangedEvent());+ this.requestUpdate();+ return;+ }++ this.ruleCondition.timer = undefined;+ this.ruleCondition.datetime = undefined;++ if (this.config && this.config.templates && this.config.templates.whenAssetQuery) {+ this.ruleCondition.assets = JSON.parse(JSON.stringify(this.config.templates.whenAssetQuery));+ } else {+ this.ruleCondition.assets = {};+ }++ if (!this.ruleCondition!.assets!.types || this.ruleCondition!.assets!.types.length === 0) {+ this.ruleCondition!.assets!.types = [{+ predicateType: "string",+ match: BaseAssetQueryMatch.EXACT+ }];+ }++ this.ruleCondition!.assets!.types[0].value = value;+ this.dispatchEvent(new OrRuleChangedEvent());+ this.requestUpdate();+ }+}diff --git a/ui/component/or-rules-editor/src/or-rule-header.ts b/ui/component/or-rules-editor/src/or-rule-header.tsnew file mode 100644index 000000000..1b4280c40--- /dev/null+++ b/ui/component/or-rules-editor/src/or-rule-header.ts@@ -0,0 +1,73 @@+import {html, LitElement, property, customElement} from "lit-element";+import "@openremote/or-translate";+import "@openremote/or-input";+import "@openremote/or-select";+import "@openremote/or-icon";+import {TenantRuleset, Rule} from "@openremote/model";++import {headerStyle} from "./style";+import {OrRuleChangedEvent} from "./index";++@customElement("or-rule-header")+class OrRuleHeader extends LitElement {++ static get styles() {+ return headerStyle;+ }++ @property({type: Object})+ public ruleset?: TenantRuleset;++ @property({type: Boolean})+ public saveEnabled: boolean = false;++ public readonly: boolean = false;++ public changeName(e: any) {+ const value = e.target.value;+ if (this.ruleset) {+ this.ruleset.name = value;+ this.dispatchEvent(new OrRuleChangedEvent());+ }+ }++ public saveRuleset() {+ const event = new CustomEvent("rules:save-ruleset", {+ bubbles: true,+ composed: true+ });+ this.dispatchEvent(event);+ }++ public toggleEnabled() {+ if (this.ruleset) {+ this.ruleset.enabled = !this.ruleset.enabled;+ this.dispatchEvent(new OrRuleChangedEvent());+ }+ }++ 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>++ ${this.ruleset ? html`+ <button ?disabled="${!this.saveEnabled}" @click="${this.saveRuleset}"><or-translate value="save"></or-translate></button>+ ` : ``}+ </div>++ </div>+ </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.tsdeleted file mode 100644index 95446534c..000000000--- a/ui/component/or-rules-editor/src/or-rule-header/index.ts+++ /dev/null@@ -1,98 +0,0 @@-import {html, LitElement, property, customElement, PropertyValues} from 'lit-element';-import '../selects/or-select-operator';-import '../selects/or-select-asset-attribute';--import '@openremote/or-input';-import '@openremote/or-select';-import '@openremote/or-icon';-import {TenantRuleset, Rule} from '@openremote/model';-import openremote from '@openremote/core';--import {style} from './style';--@customElement('or-rule-header')-class OrRuleHeader extends LitElement {- @property({type: Object})- public ruleset?: TenantRuleset;-- @property({type: Object})- public rule?: Rule;-- @property({type: Boolean})- public valid: boolean = false;-- static get styles() {- return [- style- ];- }-- protected render() {-- return html`- <div class="rule-container">-- <div class="layout horizontal">- <input ?disabled="${!openremote.hasRole("write:rules")}" @change="${this.changeName}" type="text" .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}">Actief</span>- <label class="switch" ?data-disabled="${!this.ruleset!.id}">- <input @change="${this.toggleEnabled}" ?disabled="${!this.ruleset!.id || !openremote.hasRole("write:rules")}" ?checked="${this.ruleset!.enabled}" type="checkbox">- <span class="slider round"></span>- </label>-- ${openremote.hasRole("write:rules") ? html`- ${this.ruleset && this.ruleset.id ? html`- <button ?disabled="${!this.valid}" @click="${this.updateRule}">opslaan</button>- ` : html`- <button ?disabled="${!this.valid}" @click="${this.createRule}">opslaan</button>- `}- ` : ``}- </div>-- </div>- </div>- `;- }-- constructor() {- super();- }-- changeName(e:any) {- const value = e.target.value;- if (this.ruleset) {- this.ruleset.name = value;- }- }-- 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},- bubbles: true,- composed: true- });- this.dispatchEvent(event);- }-- toggleEnabled () {- if(this.ruleset){- this.ruleset.enabled = !this.ruleset.enabled;-- this.updateRule();- this.requestUpdate();- }- }--}-diff --git a/ui/component/or-rules-editor/src/or-rule-header/style.ts b/ui/component/or-rules-editor/src/or-rule-header/style.tsdeleted file mode 100644index fdbc94851..000000000--- a/ui/component/or-rules-editor/src/or-rule-header/style.ts+++ /dev/null@@ -1,139 +0,0 @@-import {css} from 'lit-element';--// language=CSS-export const style = css`- :host {- display: block;- width: 100%;-- z-index: 1;- }-- .rule-container {- padding: 20px;- }-- .layout.horizontal {- display: flex;- flex-direction: row;- }-- input {- font-size: 18px;- font-weight: bold;- border: none;- background-color: transparent;- border-bottom: 2px solid transparent;-- transition: all 150ms ease-in;- }-- input:hover {- border-bottom: 2px solid #d5d5d5;- }-- button {- padding: 0 20px;- font-size: 14px;- height: 40px;-- border-radius: 5px;- border: none;- background-color: var(--app-primary-color);- margin-left: auto;- color: var(--app-white-color, #FFF);- font-weight: bold;- cursor: pointer;- }-- button[disabled] {- background-color: #e4e4e4;- }-- .button-simple {- border: none;- color: var(--app-primary-color);- background-color: var(--app-white-color);- }-- or-input {- padding: 10px;- }--- /* The switch - the box around the slider */- .switch {- position: relative;- display: inline-block;- width: 36px;- height: 14px;- margin: 13px 30px 13px 10px;- }-- /* Hide default HTML checkbox */- .switch input {- opacity: 0;- width: 0;- height: 0;- }-- /* The slider */- .slider {- position: absolute;- cursor: pointer;- top: 0;- left: 0;- right: 0;- bottom: 0;- background-color: #ccc;- -webkit-transition: .4s;- transition: .4s;- }-- .switch[data-disabled] {- cursor: auto;- }-- .toggle-label[data-disabled] {- color: #e4e4e4;- }-- .switch[data-disabled] .slider::before {- background-color: #e4e4e4;- }-- .slider:before {- position: absolute;- content: "";- height: 20px;- width: 20px;- left: 0;- top: -3px;- background-color: white;- -webkit-transition: .4s;- transition: .4s;- box-shadow: 0 1px 5px 0 rgba(0, 0, 0, 0.6);- }-- input:checked + .slider:before {- background-color: var(--app-primary-color);- }-- input:focus + .slider {- }-- input:checked + .slider:before {- -webkit-transform: translateX(20px);- -ms-transform: translateX(20px);- transform: translateX(20px);- }-- /* Rounded sliders */- .slider.round {- border-radius: 34px;- }-- .slider.round:before {- border-radius: 50%;- }-`;\ No newline at end of filediff --git a/ui/component/or-rules-editor/src/or-rule-list.ts b/ui/component/or-rules-editor/src/or-rule-list.tsnew file mode 100644index 000000000..26d0b541b--- /dev/null+++ b/ui/component/or-rules-editor/src/or-rule-list.ts@@ -0,0 +1,46 @@+import {html, LitElement, property} from "lit-element";+import {TenantRuleset} from "@openremote/model";+import {ruleListStyle} from "./style";++class OrRulesList extends LitElement {+ @property({type: Array})+ public rulesets: TenantRuleset[] = [];++ @property({type: Object})+ public ruleset?: TenantRuleset;++ static get styles() {+ return ruleListStyle;+ }++ public setActiveRule(ruleset: TenantRuleset) {+ const event = new CustomEvent("rules:set-active-rule", {+ detail: {ruleset: JSON.parse(JSON.stringify(ruleset))},+ bubbles: true,+ composed: true+ });+ this.dispatchEvent(event);+ }++ protected render() {++ return html`+ <div class="list-container">+ <strong class="list-title">Profielen</strong>+ ${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>+ <div class="flex">+ <span>${ruleset.name}<span style="color: var(--app-grey-color);">${!ruleset.id ? " [concept]" : ""}</span></span>+ </div>+ </a>+ `;+ })}+ </div>+ `;+ }++}++window.customElements.define("or-rule-list", OrRulesList);diff --git a/ui/component/or-rules-editor/src/or-rule-list/index.ts b/ui/component/or-rules-editor/src/or-rule-list/index.tsdeleted file mode 100644index aeb2545a8..000000000--- a/ui/component/or-rules-editor/src/or-rule-list/index.ts+++ /dev/null@@ -1,117 +0,0 @@-import {html, LitElement, property, PropertyValues} from 'lit-element';-import {TenantRuleset} from '@openremote/model';--class OrRulesList extends LitElement {- @property({type: Array})- rulesets: TenantRuleset[] = [];-- @property({type: Object})- ruleset?: TenantRuleset;-- protected render() {-- return html`- <style>- .d-flex {- display: -webkit-box;- display: -moz-box;- display: -ms-flexbox;- display: -webkit-flex;- display: flex;- }-- .flex {- -webkit-box-flex: 1;- -moz-box-flex: 1;- -webkit-flex: 1;- -ms-flex: 1;- flex: 1;- }-- .list-container {- }-- .list-title {- display: block;- padding: 17px 33px 10px 33px;- text-transform: uppercase;- color: var(--app-grey-color);- opacity: 0.87;- }-- .list-item {- text-decoration: none;- height: 24px;- font-size: 15px;- padding: 17px 0;- border-left: 5px solid transparent;- color: var(--app-grey-color);- cursor: pointer;-- transition: all 300ms ease-in;- }-- .list-item[selected],- .list-item:hover {- border-left-color: var(--app-primary-color);- background-color: #f7f7f7;- color: #000000;- }-- .list-item:hover {- opacity: 0.77;- }-- .list-item > span {- font-size: 18px;- }-- .rule-status {- width: 8px;- height: 8px;- border-radius: 8px;- margin: 8px 10px;- }-- .bg-green {- background-color: green;- }-- .bg-red {- background-color: red- }- </style>- <div class="list-container">- <strong class="list-title">Profielen</strong>- ${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>- <div class="flex">- <span>${ruleset.name}<span style="color: var(--app-grey-color);">${!ruleset.id ? " [concept]" : ""}</span></span>- </div>- </a>- `;- })}- </div>- `;- }-- setActiveRule (ruleset:TenantRuleset) {- this.requestUpdate();- let event = new CustomEvent('rules:set-active-rule', {- detail: {ruleset: ruleset},- bubbles: true,- composed: true- });- this.dispatchEvent(event);- }-- constructor() {- super();- }---}--window.customElements.define('or-rule-list', OrRulesList);diff --git a/ui/component/or-rules-editor/src/or-rule-section.ts b/ui/component/or-rules-editor/src/or-rule-section.tsnew file mode 100644index 000000000..8e470fff3--- /dev/null+++ b/ui/component/or-rules-editor/src/or-rule-section.ts@@ -0,0 +1,22 @@+import {html, property, LitElement, customElement} from "lit-element";+import {ruleSectionStyle} from "./style";++@customElement("or-rule-section")+class OrRuleSection extends LitElement {++ @property({type: String})+ public heading?: string;++ static get styles() {+ return ruleSectionStyle;+ }++ public render() {+ return html`+ <div>+ <strong>${this.heading}</strong>+ <slot></slot>+ </div>+ `;+ }+}\ No newline at end of filediff --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.tsdeleted file mode 100644index 1c232bcce..000000000--- a/ui/component/or-rules-editor/src/or-rule-then-condition/index.ts+++ /dev/null@@ -1,74 +0,0 @@-import {html, LitElement, property, customElement, TemplateResult} from "lit-element";-import "../selects/or-select-operator";-import "../selects/or-select-asset-attribute";--import "@openremote/or-input";-import "@openremote/or-select";-import "@openremote/or-icon";-import handler from "../index";-import {style} from "./style";-import set from "lodash/set";--import {RuleActionWriteAttribute} from "@openremote/model";--@customElement("or-rule-then-condition")-class OrRuleThenCondition extends LitElement {-- static get styles() {- return [- style- ];- }-- @property({type: Object})- public condition?: RuleActionWriteAttribute;-- @property({type: Number})- private value: number = 0;-- constructor() {- super();-- this.addEventListener("or-input:changed", this.setValue);- }-- public setValue(e: any) {- const value = e.detail.value;- const name = e.detail.name;- if (this.condition && this.condition.value) {- this.condition.value = set(this.condition.value, name, value);- this.requestUpdate();- }- }-- protected render() {-- return html`- <div class="rule-container">- ${this.condition ? html`- <or-select-asset-action>- <or-icon icon="numeric-1-circle"></or-icon>- </or-select-asset-action>- <or-select-asset-attribute type="then" disabled value="${this.condition.attributeName}"></or-select-asset-attribute>- <or-select-operator hidden disabled value="EQUAL"></or-select-operator>- ${this.createInputControl(this.condition!)}- ` : ``}- </div>- `;- }-- protected createInputControl(condition: RuleActionWriteAttribute): TemplateResult {- for (const h of handler.handlers) {-- const result = h(this.condition!);- if (result) {- const response = html`${result}`;- return response;- }- }-- return html`<or-input type="text" value="${this.condition!.value}"></or-input>`;- }--}-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.tsdeleted file mode 100644index 6a644256a..000000000--- a/ui/component/or-rules-editor/src/or-rule-then-condition/style.ts+++ /dev/null@@ -1,39 +0,0 @@-import {css} from 'lit-element';--// language=CSS-export const style = css`- :host {- display: block;- width: 100%;- }-- .rule-container {- display: flex;- margin: 10px 0;- width: 100%;- border-radius: 0;- padding: 0 0 20px 0;- border-bottom: 1px solid var(--app-lightgrey-color, #F5F5F5);- }-- .rule-container > * {- margin-right: 20px;- }-- .rule-container > [hidden] {- display: none;- }-- .rule-container > or-select-asset-action {- margin-right: 10px;- }-- .rule-container > or-select-asset-action or-icon {- margin-top: 7px;- }-- .rule-container > *:last-child {- margin-right: 0;- }--`;\ No newline at end of filediff --git a/ui/component/or-rules-editor/src/or-rule-then/index.ts b/ui/component/or-rules-editor/src/or-rule-then/index.tsdeleted file mode 100644index 815a31425..000000000--- a/ui/component/or-rules-editor/src/or-rule-then/index.ts+++ /dev/null@@ -1,77 +0,0 @@-import {html, LitElement, property, customElement, PropertyValues} from "lit-element";--import {style} from "./style";-import {Rule, RuleActionUnion,- AttributeDescriptor} from "@openremote/model";--import "../or-rule-then-condition";-import {rulesEditorConfig, defaultThen, defaultThenCondition} from "../const/rule-config";--import cloneDeep from "lodash-es/cloneDeep";--@customElement("or-rule-then")-class OrRuleThen extends LitElement {-- static get styles() {- return [- style- ];- }-- @property({type: Object})- public rule?: Rule;-- @property({type: Array})- public attributeDescriptors?: AttributeDescriptor[];-- constructor() {- super();- }-- protected render() {-- return html`- <div class="rule-content-section">- <div class="rule-then-container bg-white shadow">- <strong>Dan...</strong>-- ${this.rule && this.rule.then ? this.rule.then.map((then: RuleActionUnion) => {- return html`- <or-rule-then-condition .condition="${then}" .attributeDescriptors="${this.attributeDescriptors}"></or-rule-then-condition>-- ${rulesEditorConfig.controls.addThenCondition ? html`- <span class="rule-additional">&</span>- ` : ``}-- `; }) : ``}-- ${rulesEditorConfig.controls.addThenCondition ? html`- <a class="button-add" @click="${this.addThenCondition}">+</a>- ` : ``}- </div>- </div>- `;- }-- protected updated(_changedProperties: PropertyValues): void {- super.updated(_changedProperties);- if (this.rule && !this.rule.then) {- this.rule.then = cloneDeep(defaultThen);- this.requestUpdate();- }- }-- private addThenCondition() {- if (this.rule && !this.rule.then) {- this.rule.then = cloneDeep(defaultThen);-- }-- if (this.rule && this.rule.then) {- this.rule.then.push(cloneDeep(defaultThenCondition));- this.requestUpdate();- }-- }--}diff --git a/ui/component/or-rules-editor/src/or-rule-then/style.ts b/ui/component/or-rules-editor/src/or-rule-then/style.tsdeleted file mode 100644index abb732810..000000000--- a/ui/component/or-rules-editor/src/or-rule-then/style.ts+++ /dev/null@@ -1,41 +0,0 @@-import {css} from 'lit-element';--// language=CSS-export const style = css`---- .rule-content-section {- flex-grow: 1;- flex-basis: 1;- margin: 20px 10px;- }-- .rule-then-container {- display: flex;- padding: 20px;-- flex-wrap: wrap;- background-color: var(--app-white-color, #FFF);- box-shadow: rgba(0, 0, 0, 0.11) 0px 1px 2px 0px;- }-- .button-add {- display: block;- cursor: pointer;- padding: 10px 40px;- font-size: 20px;- font-weight: bold;- height: 32px;- box-sizing: content-box;- border: 3px dashed var(--app-lightgrey-color, #e4e4e4);- }-- .rule-additional {- height: 38px;- line-height: 38px;- padding: 10px 20px;- font-size: 20px;- font-weight: bold;- }-`;\ No newline at end of filediff --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.tsdeleted file mode 100644index e383a85a6..000000000--- a/ui/component/or-rules-editor/src/or-rule-when-condition/index.ts+++ /dev/null@@ -1,196 +0,0 @@-import {customElement, html, LitElement, property, PropertyValues} from "lit-element";-import "../selects/or-select-asset-attribute";-import "../selects/or-select-operator";--import "@openremote/or-input";-import "@openremote/or-select";-import "@openremote/or-icon";-import openremote, {AssetModelUtil} from "@openremote/core";--import {style} from "./style";-import {AttributeDescriptor, AttributePredicate, AssetDescriptor} from "@openremote/model";--import {attributeDescriptors} from "../const/attribute-descriptors";-import {rulesEditorConfig} from "../const/rule-config";--@customElement("or-rule-when-condition")-class OrRuleWhenCondition extends LitElement {-- static get styles() {- return [- style- ];- }-- protected assetDescriptor?: AssetDescriptor;-- @property({type: Object})- public predicate?: AttributePredicate;-- @property({type: Number})- public index?: number;-- @property({type: String})- public assetType?: string;-- @property({type: Array})- public attributeDescriptors?: AttributeDescriptor[] = attributeDescriptors;-- @property({type: Boolean})- public isValidRule: boolean = false;-- constructor() {- super();-- this.addEventListener("asset-attribute:changed", this.setAssetAttribute);- this.addEventListener("operator:changed", this.setOperator);- this.addEventListener("or-input:changed", this.setValue);- }-- protected shouldUpdate(_changedProperties: Map<PropertyKey, unknown>): boolean {- if (_changedProperties.has("assetType")) {- this.assetDescriptor = AssetModelUtil.getAssetDescriptor(this.assetType) || {attributeDescriptors: []};- }- return super.shouldUpdate(_changedProperties);- }-- protected render() {-- return html`- <div class="rule-container">- ${this.predicate ? html`- <or-select-asset-type>- <or-icon icon="${this.predicate.name ? "airplane" : "airplane"}">- </or-icon>- </or-select-asset-type>-- ${this.predicate.name ? html`- <or-select-asset-attribute type="when" value="${this.predicate.name.value}"></or-select-asset-attribute>-- ${this.predicate.value && this.predicate.value.predicateType === "string" ? html`- ${this.predicate.name.value ? html`- <or-select-operator type="${this.getAttributeDescriptor(this.predicate.name.value)!.valueDescriptor!.valueType}" .value="${this.predicate.value.match}"></or-select-operator>- ` : ``}-- ${this.predicate.name.value && this.predicate.value.match ? html`- ${this.getAttributeConfig(this.predicate.name.value)!.options ? html`- <or-select .options="${this.getAttributeConfig(this.predicate.name.value).options}" .value="${this.predicate.value.value ? this.predicate.value.value : ""}"></or-select>- ` : html`- <or-input required type="${this.getAttributeDescriptor(this.predicate.name.value)!.valueDescriptor!.valueType}" .value="${this.predicate.value.value ? this.predicate.value.value : null}"></or-input>- `}- ` : ``}-- ${openremote.hasRole("write:rules") ? html`-- ${this.predicate.value.value ? html`- <a style="margin-left: auto;" @click="${this.deleteCondition}">- <or-icon class="small-icon" icon="close-circle"></or-icon>- </a>- ` : ``}-- ` : ``}-- ` : ``}-- ` : ``}-- ` : ``}- </div>- `;- }-- protected updated(_changedProperties: PropertyValues): void {- super.updated(_changedProperties);- if (_changedProperties.has("predicate")) {- this.validateRule();- }- }-- private validateRule() {-- if (this.predicate && this.predicate.value && this.predicate.value.predicateType === "string" && this.predicate.value.value) {- this.isValidRule = true;- } else {- this.isValidRule = false;- }- const event = new CustomEvent("rules:validated", {- detail: { isValidRule: this.isValidRule },- bubbles: true,- composed: true });-- this.dispatchEvent(event);-- }-- // setAssetType(value:string) {- // const assetType = {- // "predicateType": "string",- // "match": "EXACT",- // "value": value- // };- //- // // TODO how does this work with multiple assetTypes?- // if(this.predicate && this.when.asset && this.when.asset.types) {- // this.when.asset.types.push(assetType);- // }- // }-- private getAttributeDescriptor(attributeName: string) {- if (!this.assetDescriptor) {- return;- }-- return AssetModelUtil.getAssetAttributeDescriptor(this.assetDescriptor, attributeName);- }-- private getAttributeConfig(name: string) {- const attributeValueDescriptors: any = rulesEditorConfig.options.when.attributeValueDescriptors;-- if (attributeValueDescriptors) {- const attributeConfig = attributeValueDescriptors[name];- return attributeConfig;- }-- }-- private setAssetAttribute(e: any) {- const value = e.detail.value;-- if (this.predicate && this.predicate.name) {- this.predicate.name.value = value;-- this.requestUpdate();- }- }-- private setOperator(e: any) {- const value = e.detail.value;- if (this.predicate && this.predicate.value && this.predicate.value.predicateType === "string") {- this.predicate.value.match = value;- this.requestUpdate();- }- }-- private setValue(e: any) {- const value = e.detail.value;-- if (this.predicate && this.predicate.value && this.predicate.value.predicateType === "string") {- this.predicate.value.value = value;- this.validateRule();- this.requestUpdate();- }- }-- private deleteCondition() {-- const event = new CustomEvent("when-condition:delete", {- detail: { index: this.index },- bubbles: true,- composed: true });-- this.dispatchEvent(event);-- 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.tsdeleted file mode 100644index 7db4ff230..000000000--- a/ui/component/or-rules-editor/src/or-rule-when-condition/style.ts+++ /dev/null@@ -1,48 +0,0 @@-import {css} from 'lit-element';--// language=CSS-export const style = css`- :host {- display: block;- width: 100%;- }-- .rule-container {- display: flex;- margin: 10px 0;- width: 100%;- border-radius: 0;- padding: 0 0 20px 0;- border-bottom: 1px solid var(--app-lightgrey-color, #F5F5F5);- }-- .rule-container > * {- margin-right: 20px;- }-- .rule-container > or-select-asset-type {- margin-right: 10px;- }-- .rule-container > or-select-asset-type or-icon {- margin-top: 7px;- }-- .rule-container > *:last-child {- margin-right: 0;- }-- or-icon {- margin-top: 5px;- }-- .small-icon {- cursor: pointer;- fill: rgb(213, 213, 213);- }-- .small-icon:hover {- fill: var(--app-primary-color);- }--`;\ No newline at end of filediff --git a/ui/component/or-rules-editor/src/or-rule-when.ts b/ui/component/or-rules-editor/src/or-rule-when.tsnew file mode 100644index 000000000..4e52bb055--- /dev/null+++ b/ui/component/or-rules-editor/src/or-rule-when.ts@@ -0,0 +1,235 @@+import {customElement, html, LitElement, TemplateResult, property} from "lit-element";+import {LogicGroup, Rule, RuleCondition, RuleOperator, AssetDescriptor} from "@openremote/model";+import {OrRuleChangedEvent, RulesConfig} from "./index";+import {whenStyle} from "./style";+import "./or-rule-condition";+import i18next from "i18next";++// TODO: Update to properly support LogicGroup<RuleCondition>+@customElement("or-rule-when")+class OrRuleWhen extends LitElement {++ static get styles() {+ return whenStyle;+ }++ @property({type: Object})+ public rule?: Rule;++ public readonly?: boolean;++ public config?: RulesConfig;++ public assetDescriptors?: AssetDescriptor[];++ protected groupAddTemplate(parent: Rule | LogicGroup<RuleCondition>) {+ return html`<button class="button-clear add-button" @click="${() => this.addGroup(parent)}"><or-icon icon="plus-circle"></or-icon><or-translate value="rulesEditorAddGroup"></or-translate></button>`;+ }++ protected ruleGroupTemplate(group: LogicGroup<RuleCondition>): TemplateResult | string {+ if (!group) {+ return ``;+ }++ const showAddCondition = !this.config || !this.config.controls || this.config.controls.hideWhenAddCondition !== true;+ const showAddgroup = !this.config || !this.config.controls || this.config.controls.hideWhenAddGroup !== true;+ const showGroupOutline = !this.config || !this.config.controls || this.config.controls.hideWhenGroupOutline !== true;++ return html`+ <div class="rule-group ${showGroupOutline ? "visible" : "hidden"}">+ ${!this.readonly && showAddgroup ? html`+ <button class="button-clear remove-button" @click="${() => this.removeGroup(group)}">+ <div></div>+ <or-icon icon="close-circle"></or-icon>+ </button>+ ` : ``}++ <div class="rule-group-items">+ ${group.items && group.items.length > 0 ? group.items.map((condition: RuleCondition) => {+ return html `+ <div class="rule-group-item">+ <button @click="${() => this.toggleGroup(group)}" class="button-clear operator"><span>${i18next.t(!group.operator || group.operator === RuleOperator.AND ? "and" : "or")}</span></button>+ <div class="rule-condition">+ <or-rule-condition .config="${this.config}" .assetDescriptors="${this.assetDescriptors}" .ruleCondition="${condition}" .readonly="${this.readonly}" ></or-rule-condition>+ ${!this.readonly ? html`+ <button class="button-clear" @click="${() => this.removeCondition(condition)}"><or-icon icon="close-circle"></or-icon></input>+ ` : ``}+ </div>+ </div>+ `;+ }) : ``}++ ${group.groups && group.groups.length > 0 ? html`+ ${group.groups.map((childGroup: LogicGroup<RuleCondition>) => html`+ <div class="rule-group-item">+ <button @click="${() => this.toggleGroup(group)}" class="button-clear operator"><span>${i18next.t(!group.operator || group.operator === RuleOperator.AND ? "and" : "or")}</span></button>+ ${this.ruleGroupTemplate(childGroup)}+ </div>+ `)}+ ` : ``}+ </div>++ ${showAddCondition || showAddgroup ? html`+ <div class="add-buttons-container">+ ${showAddCondition ? html`<button class="button-clear add-button" @click="${() => this.addCondition(group)}"><or-icon icon="plus-circle"></or-icon><or-translate value="rulesEditorAddCondition"></or-translate></button>` : ``}+ ${showAddgroup ? this.groupAddTemplate(group) : ``}+ </div>+ ` : ``}+ </div>+ `;+ }++ protected dateTimePredicateTemplate() {+ return html`<span>DATE TIME PREDICATE NOT IMPLEMENTED</span>`;+ }++ protected render() {+ if (!this.rule) {+ return;+ }++ return html`${this.rule.when ? this.ruleGroupTemplate(this.rule.when) : this.groupAddTemplate(this.rule)}`;+ }++ private toggleGroup(group: LogicGroup<RuleCondition>) {+ if (group.operator === RuleOperator.OR) {+ group.operator = RuleOperator.AND;+ } else {+ group.operator = RuleOperator.OR;+ }+ this.requestUpdate();+ }++ private addGroup(parent: Rule | LogicGroup<RuleCondition>) {+ if (!parent) {+ return;+ }++ let newGroup: LogicGroup<RuleCondition> = {};++ if (this.config && this.config.templates && this.config.templates.whenGroup) {+ newGroup = JSON.parse(JSON.stringify(this.config.templates.whenGroup)) as LogicGroup<RuleCondition>;+ }++ if ((parent as Rule).name !== undefined) {+ const rule = parent as Rule;+ rule.when = newGroup;+ } else {+ const condition = parent as LogicGroup<RuleCondition>;+ if (!condition.groups) {+ condition.groups = [];+ }+ condition.groups.push(newGroup);+ }++ this.dispatchEvent(new OrRuleChangedEvent());+ this.requestUpdate();+ }++ private removeGroup(group: LogicGroup<RuleCondition>) {+ if (!this.rule || !this.rule.when || !group) {+ return;+ }++ if (this.rule.when === group) {+ this.rule.when = undefined;+ this.dispatchEvent(new OrRuleChangedEvent());+ this.requestUpdate();+ return;+ }++ const parent = this.getGroupParent(group, this.rule.when);+ if (parent) {+ const index = parent.groups!.indexOf(group);+ parent.groups!.splice(index, 1);+ this.dispatchEvent(new OrRuleChangedEvent());+ this.requestUpdate();+ }+ }++ private addCondition(parent: LogicGroup<RuleCondition>) {+ if (!parent) {+ return;+ }++ if (!parent.items) {+ parent.items = [];+ }++ let newTrigger: RuleCondition = {};++ if (this.config && this.config.templates && this.config.templates.whenCondition) {+ newTrigger = JSON.parse(JSON.stringify(this.config.templates.whenCondition)) as RuleCondition;+ }++ parent.items.push(newTrigger);+ this.dispatchEvent(new OrRuleChangedEvent());+ this.requestUpdate();+ }++ private removeCondition(condition: RuleCondition) {+ if (!this.rule || !this.rule.when || !condition) {+ return;+ }++ const parent = this.getConditionParent(condition, this.rule.when);++ if (parent) {+ const index = parent.items!.indexOf(condition);+ parent.items!.splice(index, 1);+ this.dispatchEvent(new OrRuleChangedEvent());+ this.requestUpdate();+ }+ }++ private getConditionParent(condition: RuleCondition, start: LogicGroup<RuleCondition>) {+ if (!condition || !start) {+ return;+ }++ if (start.items) {+ const index = start.items.indexOf(condition);+ if (index >= 0) {+ return start;+ }+ }++ if (start.groups) {+ for (const group of start.groups) {+ const result = this.getConditionParent(condition, group);+ if (result) {+ return group;+ }+ }+ }+ }++ private getGroupParent(group: LogicGroup<RuleCondition>, start: LogicGroup<RuleCondition>) {+ if (!group || !start || !start.groups) {+ return;+ }++ const index = start.groups.indexOf(group);+ if (index >= 0) {+ return start;+ }++ for (const childGroup of start.groups) {+ const result = this.getGroupParent(group, childGroup);+ if (result) {+ return childGroup;+ }+ }+ }++ private deleteWhenCondition(e: any) {++ const index = e.detail.index;++ if (this.rule && this.rule.when && this.rule.when.items && this.rule.when.items.length > 0 && this.rule.when.items[0].assets && this.rule.when.items[0].assets.attributes && this.rule.when.items[0].assets.attributes.items) {+ this.rule.when.items[0].assets.attributes.items.splice(index, 1);+ this.dispatchEvent(new OrRuleChangedEvent());+ this.requestUpdate();+ }+ }+}diff --git a/ui/component/or-rules-editor/src/or-rule-when/index.ts b/ui/component/or-rules-editor/src/or-rule-when/index.tsdeleted file mode 100644index 8954deab2..000000000--- a/ui/component/or-rules-editor/src/or-rule-when/index.ts+++ /dev/null@@ -1,95 +0,0 @@-import {html, LitElement, property, customElement, PropertyValues} from "lit-element";--import {style} from "./style";-import openremote from "@openremote/core";-import {Rule, AttributePredicate} from "@openremote/model";--import "../or-rule-when-condition";-import {defaultPredicate, defaultWhenCondition, rulesEditorConfig} from "../const/rule-config";--import cloneDeep from "lodash-es/cloneDeep";--@customElement("or-rule-when")-class OrRuleWhen extends LitElement {-- static get styles() {- return [- style- ];- }-- @property({type: Object})- public rule?: Rule;-- @property({type: Array})- public predicates?: AttributePredicate[] = [];-- constructor() {- super();- this.addEventListener("when-condition:delete", this.deleteWhenCondition);-- }-- // TODO: cleanup hacked asset type pass through- protected render() {- return html`- <div class="rule-content-section">- <div class="rule-when-container bg-white shadow">- <strong>Als...</strong>- ${this.rule && this.rule.when && this.rule.when.predicates && this.rule.when.predicates.length > 0 && this.rule.when.predicates[0].assets && this.rule.when.predicates[0].assets.types && this.rule.when.predicates[0].assets.attributes && this.rule.when.predicates[0].assets.attributes.predicates ? html`- ${this.rule.when.predicates[0].assets.attributes.predicates.map((predicate: AttributePredicate, index) => {- return html`- <or-rule-when-condition index="${index}" .assetType="${this.rule!.when!.predicates![0]!.assets!.types![0].value}" .predicate="${predicate}"></or-rule-when-condition>- `; })}- ` : ``}-- ${openremote.hasRole("write:rules") ? html`- ${rulesEditorConfig.controls.addWhenCondition ? html`- <a class="button-add" @click="${this.addWhenCondition}">+ voeg nog een voorwaarde toe</a>- ` : ``}-- ` : ``}- </div>- </div>- `;- }-- protected updated(_changedProperties: PropertyValues): void {- super.updated(_changedProperties);- if (this.rule && !this.rule.when) {- this.rule.when = cloneDeep(defaultWhenCondition);- if (this.rule.when.predicates![0].assets!.attributes!.predicates!.length === 0) {- this.addPredicate();- }- this.requestUpdate();- }- }-- private addWhenCondition() {- if (this.rule && !this.rule.when) {- this.rule.when = cloneDeep(defaultWhenCondition);- }-- this.addPredicate();- this.requestUpdate();-- }-- private addPredicate() {- if (this.rule && this.rule.when && this.rule.when.predicates && this.rule.when.predicates.length > 0 && this.rule.when.predicates[0].assets && this.rule.when.predicates[0].assets.attributes && this.rule.when.predicates[0].assets.attributes.predicates) {- const newPredicate = cloneDeep(defaultPredicate);-- this.rule.when.predicates[0].assets.attributes.predicates.push(newPredicate);- }- }-- private deleteWhenCondition(e: any) {-- const index = e.detail.index;-- if (this.rule && this.rule.when && this.rule.when.predicates && this.rule.when.predicates.length > 0 && this.rule.when.predicates[0].assets && this.rule.when.predicates[0].assets.attributes && this.rule.when.predicates[0].assets.attributes.predicates) {- this.rule.when.predicates[0].assets.attributes.predicates.splice(index, 1);- this.requestUpdate();- }- }-}diff --git a/ui/component/or-rules-editor/src/or-rule-when/style.ts b/ui/component/or-rules-editor/src/or-rule-when/style.tsdeleted file mode 100644index c33df188f..000000000--- a/ui/component/or-rules-editor/src/or-rule-when/style.ts+++ /dev/null@@ -1,41 +0,0 @@-import {css} from 'lit-element';--// language=CSS-export const style = css`- .rule-content-section {- flex-grow: 1;- flex-basis: 1;- margin: 20px 10px;- }-- .rule-when-container {- display: flex;- padding: 20px;-- background-color: var(--app-white-color, #FFF);- flex-wrap: wrap;- box-shadow: rgba(0, 0, 0, 0.11) 0px 1px 2px 0px;- }-- .button-add {- display: block;- cursor: pointer;- font-weight: bold;- height: 32px;- box-sizing: content-box;-- padding: 0;- border: none;- font-size: 15px;- color: var(--app-primary-color);-- }-- .rule-additional {- height: 38px;- line-height: 38px;- padding: 10px 20px;- font-size: 20px;- font-weight: bold;- }-`;\ No newline at end of filediff --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.tsdeleted file mode 100644index 3455d61e2..000000000--- a/ui/component/or-rules-editor/src/selects/or-select-asset-attribute/index.ts+++ /dev/null@@ -1,93 +0,0 @@-import {html, LitElement, customElement, property, PropertyValues} from "lit-element";-import openremote from "@openremote/core";-import {AttributeDescriptor, AttributeValueType, AttributeValueDescriptor, ValueType} from "@openremote/model";-import {selectStyle} from "@openremote/or-select/dist/style";-import i18next from "i18next";--import {attributeDescriptors} from "../../const/attribute-descriptors";-import {rulesEditorConfig} from "../../const/rule-config";--@customElement("or-select-asset-attribute")-class OrSelectAssetAttribute extends LitElement {-- @property({type: String})- public assetType: string = "";-- @property({type: String})- public type: "when" | "then" = "when";-- @property({type: Array})- public attributeDescriptors?: AttributeDescriptor[] = attributeDescriptors;-- // TODO replace with type from rulesEditor config?- @property({type: Array})- public options?: any[];-- @property({type: String})- public value: any;-- @property({type: Boolean})- public disabled: boolean = false;-- @property({type: Function})- private changed: any;-- constructor() {- super();- }-- static get styles() {- return [- selectStyle- ];- }-- public onChange() {- if (this.shadowRoot) {- const value = (this.shadowRoot.getElementById("or-select-asset-attribute") as HTMLInputElement).value;-- const event = new CustomEvent("asset-attribute:changed", {- detail: { value: value },- bubbles: true,- composed: true });-- this.dispatchEvent(event);- }- }-- protected render() {-- // TODO types should be based on rules-config- return html`- <select ?disabled="${this.disabled}" id="or-select-asset-attribute" @change="${this.onChange}">- ${this.options ? this.options.map((attribute: AttributeDescriptor) => {- return html`- <option ?selected="${attribute.attributeName === this.value}" value="${attribute.attributeName}">${i18next.t(attribute.attributeName || "")}</option>- `;- }) : ``}- </select>- `;- }-- protected firstUpdated(_changedProperties: PropertyValues): void {- super.firstUpdated(_changedProperties);- if (!this.attributeDescriptors) {- return;- }-- this.options = this.attributeDescriptors.filter((attributeDescriptor) => {- if (this.type === "when") {- return attributeDescriptor.attributeName && rulesEditorConfig.options.when.attributeValueDescriptors.hasOwnProperty(attributeDescriptor.attributeName);- }-- if (this.type === "then") {- return attributeDescriptor.attributeName && rulesEditorConfig.options.then.attributeValueDescriptors.hasOwnProperty(attributeDescriptor.attributeName);- }- });--- this.disabled = !openremote.hasRole("write:rules");-- }--}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.tsdeleted file mode 100644index fc503ce40..000000000--- a/ui/component/or-rules-editor/src/selects/or-select-operator/index.ts+++ /dev/null@@ -1,65 +0,0 @@-import {html, LitElement, property, customElement, PropertyValues} from "lit-element";-import openremote from "@openremote/core";-import {AttributeValueType, BaseAssetQueryMatch, BaseAssetQueryOperator, AttributeValueDescriptor, ValueType} from "@openremote/model";--import {selectStyle} from "@openremote/or-select/dist/style";-import {AssetModelUtil} from "@openremote/core/dist";--@customElement("or-select-operator")-class OrRuleWhen extends LitElement {-- @property({type: String})- type?: ValueType;-- @property({type: String})- 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 === BaseAssetQueryOperator.EQUALS}" value="${BaseAssetQueryOperator.EQUALS}">=</option>- <option ?selected="${this.value === BaseAssetQueryOperator.NOT_EQUALS}" value="${BaseAssetQueryOperator.NOT_EQUALS}">!=</option>- ${this.type === ValueType.NUMBER ? html`- <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>- ` : ``}- `;- }-- onChange() {- if (this.shadowRoot) {- const value = (<HTMLInputElement>this.shadowRoot.getElementById('or-select-operator')).value;-- const event = new CustomEvent('operator:changed', {- detail: { value: value },- bubbles: true,- composed: true });-- this.dispatchEvent(event);- }- }-- constructor() {- super();- }-- protected firstUpdated(_changedProperties: PropertyValues): void {- super.firstUpdated(_changedProperties);- this.disabled = !openremote.hasRole("write:rules");- }-}diff --git a/ui/component/or-rules-editor/src/style.ts b/ui/component/or-rules-editor/src/style.tsindex 4fba50083..4180a4ab3 100644--- a/ui/component/or-rules-editor/src/style.ts+++ b/ui/component/or-rules-editor/src/style.ts@@ -1,26 +1,19 @@-import {css} from 'lit-element';+import {css} from "lit-element";// language=CSS-export const style = css`- :host {- display: block;- height: 100%;- width: 100%;+export const rulesEditorStyle = css`- --bg-white: #FFFFFF;- --bg-grey: #F5F5F5;- --app-lightgrey-color: #f2f2f2;- }-- .rule-editor-container {+ :host {display: flex;- position: relative;height: 100%;width: 100%;- }-- .bg-white {- background-color: var(--bg-white);++ --internal-or-rule-section-background-color: var(--or-rule-section-background-color, white);+ --internal-or-rule-list-background-color: var(--or-rule-list-background-color, white);+ --internal-or-rule-header-background-color: var(--or-rule-header-background-color, white);+ --internal-or-rule-toolbar-background-color: var(--or-rule-toolbar-background-color, white);+ --internal-or-rule-editor-background-color: var(--or-rule-editor-background-color, #f5f5f5);+ --internal-or-rule-foreground-color: var(--or-rule-foreground-color, green);}.shadow {@@ -32,7 +25,6 @@ export const style = css`side-menu {min-width: 300px;width: 300px;-z-index: 2;display: flex;flex-direction: column;@@ -40,12 +32,17 @@ export const style = css`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 {display: flex;-border-top: 1px solid var(--app-lightgrey-color);+ background-color: var(--internal-or-rule-toolbar-background-color);}icon {@@ -61,69 +58,462 @@ export const style = css`color: var(--app-white-color, #FFF);}- or-body,- .content {+ .rule-container {display: flex;+ flex-direction: column;flex-grow: 1;}++ .rule-editor-panel {+ display: flex;+ flex-grow: 1;+ background-color: var(--internal-or-rule-editor-background-color);+ }++ .rule-editor-panel > * {+ display: flex;+ flex: 1 1 0;+ }- or-body {+ or-rule-section {+ margin: 10px;+ flex-grow: 1;+ flex-shrink: 1;+ }++ .center-center {+ display: flex;+ justify-content: center;+ align-items: center;+flex-direction: column;+ text-align: center;+ margin: auto;+ }++ @media only screen+ and (min-device-width : 768px)+ and (max-device-width : 1024px) {+ side-menu {+ min-width: 150px;+ width: 150px;+ }}+`;- .content {- flex-direction: row;+// language=CSS+export const invalidStyle = css`+ *:invalid {+ border-bottom: 2px solid red;}+`;- or-rule-then,- or-rule-when {- display: flex;- flex: 1 1 0;- background-color: var(--app-lightgrey-color);+// language=CSS+export const buttonStyle = css`+ .button-clear {+ background: none;+ color: var(--internal-or-rule-foreground-color);+ border: none;+ padding: 0;+ display: inline-block;+ cursor: pointer;}- or-rule-when {- padding-left: 10px;+ .button-clear:focus {+ outline: 0;}- or-rule-then {- padding-right: 10px;+ .button-clear > or-icon {+ fill: var(--internal-or-rule-foreground-color);+ }++ .add-button {+ display: inline-block;+ font-weight: bold;+ font-size: 15px;+ line-height: 24px;+ }++ .add-buttons-container {+ display: flex;+ flex-direction: column;+ margin-top: 10px;+ padding-top: 5px;+ border-top-width: 1px;+ border-top-style: solid;+ border-color: var(--internal-or-rule-foreground-color);+ }++ .add-buttons-container > button {+ display: inline-flex;+ }++ .add-buttons-container > button > or-icon {+ margin-right: 5px;+ }+`;++// language=CSS+export const ruleSectionStyle = css`+ :host > div {+ padding: 20px;+ display: flex;+ flex-direction: column;+ background-color: var(--internal-or-rule-section-background-color);+ box-shadow: rgba(0, 0, 0, 0.11) 0 1px 2px 0;}- .small-icon {- --or-icon-height: 16px;+ strong {+ text-transform: capitalize;+ padding-bottom: 5px;+ }+`;++// language=CSS+export const ruleListStyle = css`+ .d-flex {+ display: -webkit-box;+ display: -moz-box;+ display: -ms-flexbox;+ display: -webkit-flex;+ display: flex;+ }++ .flex {+ -webkit-box-flex: 1;+ -moz-box-flex: 1;+ -webkit-flex: 1;+ -ms-flex: 1;+ flex: 1;+ }++ .list-container {+ }++ .list-title {+ display: block;+ padding: 17px 33px 10px 33px;+ text-transform: uppercase;+ color: var(--app-grey-color);+ opacity: 0.87;+ }++ .list-item {+ text-decoration: none;+ height: 24px;+ font-size: 15px;+ padding: 17px 0;+ border-left: 5px solid transparent;+ color: var(--app-grey-color);+ cursor: pointer;++ transition: all 300ms ease-in;+ }++ .list-item[selected],+ .list-item:hover {+ border-left-color: var(--app-primary-color);+ background-color: #f7f7f7;+ color: #000000;+ }++ .list-item:hover {+ opacity: 0.77;+ }++ .list-item > span {+ font-size: 18px;+ }++ .rule-status {+ width: 8px;+ height: 8px;+ border-radius: 8px;+ margin: 8px 10px;+ }++ .bg-green {+ background-color: green;+ }++ .bg-red {+ background-color: red}+`;++// language=CSS+export const headerStyle = css`++ ${invalidStyle}+ :host {+ display: block;+ width: 100%;++ z-index: 1;+ }++ .rule-container {+ padding: 20px;+ }++ .layout.horizontal {+ display: flex;+ flex-direction: row;+ }++ input {+ font-size: 18px;+ font-weight: bold;+ border: none;+ background-color: transparent;+ border-bottom: 2px solid transparent;+ transition: all 150ms ease-in;+ }++ input:hover {+ border-bottom: 2px solid #d5d5d5;+ }+button {padding: 0 20px;font-size: 14px;height: 40px;- border: none;+border-radius: 5px;- background-color: var(--app-primary-color);+ border: none;+ background-color: var(--internal-or-rule-foreground-color);margin-left: auto;color: var(--app-white-color, #FFF);font-weight: bold;cursor: pointer;}- .center-center {+ 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;+ }+++ /* The switch - the box around the slider */+ .switch {+ position: relative;+ display: inline-block;+ width: 36px;+ height: 14px;+ margin: 13px 30px 13px 10px;+ }++ /* Hide default HTML checkbox */+ .switch input {+ opacity: 0;+ width: 0;+ height: 0;+ }++ /* The slider */+ .slider {+ position: absolute;+ cursor: pointer;+ top: 0;+ left: 0;+ right: 0;+ bottom: 0;+ background-color: #ccc;+ -webkit-transition: .4s;+ transition: .4s;+ }++ .switch[data-disabled] {+ cursor: auto;+ }++ .toggle-label[data-disabled] {+ color: #e4e4e4;+ }++ .switch[data-disabled] .slider::before {+ background-color: #e4e4e4;+ }++ .slider:before {+ position: absolute;+ content: "";+ height: 20px;+ width: 20px;+ left: 0;+ top: -3px;+ background-color: white;+ -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 {+ }++ input:checked + .slider:before {+ -webkit-transform: translateX(20px);+ -ms-transform: translateX(20px);+ transform: translateX(20px);+ }++ /* Rounded sliders */+ .slider.round {+ border-radius: 34px;+ }++ .slider.round:before {+ border-radius: 50%;+ }+`;++// language=CSS+export const whenStyle = css`++ ${buttonStyle}++ .rule-group {display: flex;- justify-content: center;- align-items: center;+ flex-direction: column;+ align-items: stretch;+ position: relative;+ }++ .rule-group.visible {+ padding: 20px 20px 10px 20px;+ border-width: 2px;+ border-style: solid;+ border-color: var(--internal-or-rule-foreground-color);+ }+ .rule-group > .remove-button {+ position: absolute;+ right: 0;+ top: 0;+ width: 24px;+ height: 24px;+ transform: translate(50%, -50%);+ }++ .rule-group > .remove-button > div {+ position: absolute;+ left: 2px;+ right: 2px;+ bottom: 2px;+ top: 2px;+ background-color: #FFF;+ }++ .rule-group-items {+ display: flex;flex-direction: column;- text-align: center;- margin: auto;}- @media only screen- and (min-device-width : 768px)- and (max-device-width : 1024px) {- side-menu {- min-width: 150px;- width: 150px;- }+ .rule-group .rule-group-items > div {+ margin: 10px 0;}-`;\ No newline at end of file+ .rule-group-item {+ position: relative;+ padding-left: 40px;+ }++ .rule-condition {+ display: flex;+ }++ .operator {+ text-transform: uppercase;+ position: absolute;+ left: 0;+ top: 100%;+ padding: 2px;+ border: 2px solid var(--internal-or-rule-foreground-color);+ border-radius: 3px;+ font-weight: bold;+ }++ .operator * {+ font-size: small;+ color: var(--internal-or-rule-foreground-color);+ }++ .rule-condition > * {+ flex-grow: 0;+ }++ .rule-condition > or-rule-condition {+ flex-grow: 1;+ }++ .rule-group .rule-group-items div:last-child > .operator {+ display: none;+ }+`;++// language=CSS+export const actionStyle = css`++ ${buttonStyle}++ :host {+ display: flex;+ width: 100%;+ flex-direction: column;+ }++ .rule-action {+ display: flex;+ margin: 10px 0;+ }++ .rule-action-action {+ flex-grow: 1;+ }++ .rule-action-action > * {+ margin-right: 20px;+ }++ .rule-action > button {+ flex-grow: 0;+ }+`;++// language=CSS+export const conditionEditorStyle = css`+ :host {+ display: flex;+ flex-direction: row;+ }++ :host > * {+ margin-right: 20px;+ }+`;++// language=CSS+export const assetQueryEditorStyle = css`+ :host {+ display: flex;+ flex-direction: row;+ }++ :host > * {+ margin-right: 20px;+ }+`;