diff --git a/application/pom.xml b/application/pom.xml index 86d50604e7..7d304226ad 100644 --- a/application/pom.xml +++ b/application/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC thingsboard application diff --git a/common/actor/pom.xml b/common/actor/pom.xml index 92b174ea61..1ce65906da 100644 --- a/common/actor/pom.xml +++ b/common/actor/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC common org.thingsboard.common diff --git a/common/cache/pom.xml b/common/cache/pom.xml index fcf52e01b7..bc2fbd8bda 100644 --- a/common/cache/pom.xml +++ b/common/cache/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC common org.thingsboard.common diff --git a/common/cluster-api/pom.xml b/common/cluster-api/pom.xml index 1f4b5ff41b..cbb082d26a 100644 --- a/common/cluster-api/pom.xml +++ b/common/cluster-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC common org.thingsboard.common diff --git a/common/coap-server/pom.xml b/common/coap-server/pom.xml index 27ff645a0f..d2c5ffc7ab 100644 --- a/common/coap-server/pom.xml +++ b/common/coap-server/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC common org.thingsboard.common diff --git a/common/dao-api/pom.xml b/common/dao-api/pom.xml index 160351d55d..6904d69aa3 100644 --- a/common/dao-api/pom.xml +++ b/common/dao-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC common org.thingsboard.common diff --git a/common/data/pom.xml b/common/data/pom.xml index 3afd7cf779..921135f811 100644 --- a/common/data/pom.xml +++ b/common/data/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC common org.thingsboard.common diff --git a/common/discovery-api/pom.xml b/common/discovery-api/pom.xml index 3ae12c1bdb..667c140615 100644 --- a/common/discovery-api/pom.xml +++ b/common/discovery-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC common org.thingsboard.common diff --git a/common/edge-api/pom.xml b/common/edge-api/pom.xml index 7c2967cf3d..87068df36c 100644 --- a/common/edge-api/pom.xml +++ b/common/edge-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC common org.thingsboard.common diff --git a/common/edqs/pom.xml b/common/edqs/pom.xml index f7616d5b37..aec29584e4 100644 --- a/common/edqs/pom.xml +++ b/common/edqs/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC common org.thingsboard.common diff --git a/common/message/pom.xml b/common/message/pom.xml index 757c5de251..7d4487f74a 100644 --- a/common/message/pom.xml +++ b/common/message/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC common org.thingsboard.common diff --git a/common/pom.xml b/common/pom.xml index a9195e49d4..72ec1ee9a6 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC thingsboard common diff --git a/common/proto/pom.xml b/common/proto/pom.xml index 09f9596d0c..7230d20ce1 100644 --- a/common/proto/pom.xml +++ b/common/proto/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC common org.thingsboard.common diff --git a/common/queue/pom.xml b/common/queue/pom.xml index fca9dc59ce..9885975417 100644 --- a/common/queue/pom.xml +++ b/common/queue/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC common org.thingsboard.common diff --git a/common/script/pom.xml b/common/script/pom.xml index d0a3b47218..efa5efafca 100644 --- a/common/script/pom.xml +++ b/common/script/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC common org.thingsboard.common diff --git a/common/script/remote-js-client/pom.xml b/common/script/remote-js-client/pom.xml index b1547d2e4b..189d86d3bf 100644 --- a/common/script/remote-js-client/pom.xml +++ b/common/script/remote-js-client/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 4.3.0-SNAPSHOT + 4.3.0-RC script org.thingsboard.common.script diff --git a/common/script/script-api/pom.xml b/common/script/script-api/pom.xml index b0fcf1c4ae..c80e51a60f 100644 --- a/common/script/script-api/pom.xml +++ b/common/script/script-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 4.3.0-SNAPSHOT + 4.3.0-RC script org.thingsboard.common.script diff --git a/common/stats/pom.xml b/common/stats/pom.xml index e44e098a39..d1bb0a80c3 100644 --- a/common/stats/pom.xml +++ b/common/stats/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC common org.thingsboard.common diff --git a/common/transport/coap/pom.xml b/common/transport/coap/pom.xml index 37f33470b2..dbabba721e 100644 --- a/common/transport/coap/pom.xml +++ b/common/transport/coap/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 4.3.0-SNAPSHOT + 4.3.0-RC transport org.thingsboard.common.transport diff --git a/common/transport/http/pom.xml b/common/transport/http/pom.xml index e49af5b0a2..475effe638 100644 --- a/common/transport/http/pom.xml +++ b/common/transport/http/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 4.3.0-SNAPSHOT + 4.3.0-RC transport org.thingsboard.common.transport diff --git a/common/transport/lwm2m/pom.xml b/common/transport/lwm2m/pom.xml index 1787c851cd..d0831647e8 100644 --- a/common/transport/lwm2m/pom.xml +++ b/common/transport/lwm2m/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 4.3.0-SNAPSHOT + 4.3.0-RC transport org.thingsboard.common.transport diff --git a/common/transport/mqtt/pom.xml b/common/transport/mqtt/pom.xml index 9df8cf918e..3ba19f00e5 100644 --- a/common/transport/mqtt/pom.xml +++ b/common/transport/mqtt/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 4.3.0-SNAPSHOT + 4.3.0-RC transport org.thingsboard.common.transport diff --git a/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/TbMqttSslTransportComponent.java b/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/TbMqttSslTransportComponent.java index 2a0e8ef42f..9f55d40919 100644 --- a/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/TbMqttSslTransportComponent.java +++ b/common/transport/mqtt/src/main/java/org/thingsboard/server/transport/mqtt/TbMqttSslTransportComponent.java @@ -27,5 +27,5 @@ import java.lang.annotation.RetentionPolicy; @Inherited @Retention(RetentionPolicy.RUNTIME) -@ConditionalOnExpression("'${service.type:null}'=='tb-transport' || ('${service.type:null}'=='monolith' && '${transport.api_enabled:true}'=='true' && '${transport.mqtt.enabled:true}'=='true' && '${transport.mqtt.ssl.enabled:false}'=='true')") +@ConditionalOnExpression("'${transport.mqtt.ssl.enabled:false}'=='true' && ('${service.type:null}'=='tb-transport' || ('${service.type:null}'=='monolith' && '${transport.api_enabled:true}'=='true' && '${transport.mqtt.enabled:true}'=='true'))") public @interface TbMqttSslTransportComponent {} diff --git a/common/transport/pom.xml b/common/transport/pom.xml index 3bd21c96de..b56fbbc428 100644 --- a/common/transport/pom.xml +++ b/common/transport/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC common org.thingsboard.common diff --git a/common/transport/snmp/pom.xml b/common/transport/snmp/pom.xml index 1286073a5f..b858b8ff5f 100644 --- a/common/transport/snmp/pom.xml +++ b/common/transport/snmp/pom.xml @@ -21,7 +21,7 @@ org.thingsboard.common - 4.3.0-SNAPSHOT + 4.3.0-RC transport diff --git a/common/transport/transport-api/pom.xml b/common/transport/transport-api/pom.xml index 19b075cb61..db34b1d21f 100644 --- a/common/transport/transport-api/pom.xml +++ b/common/transport/transport-api/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.common - 4.3.0-SNAPSHOT + 4.3.0-RC transport org.thingsboard.common.transport diff --git a/common/util/pom.xml b/common/util/pom.xml index 804ed0de38..83febcaef7 100644 --- a/common/util/pom.xml +++ b/common/util/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC common org.thingsboard.common diff --git a/common/version-control/pom.xml b/common/version-control/pom.xml index 58c059915c..6207dc3e72 100644 --- a/common/version-control/pom.xml +++ b/common/version-control/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC common org.thingsboard.common diff --git a/dao/pom.xml b/dao/pom.xml index fd6af62330..f0aa6b833f 100644 --- a/dao/pom.xml +++ b/dao/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC thingsboard dao diff --git a/edqs/pom.xml b/edqs/pom.xml index 4a4c05be71..546da5902f 100644 --- a/edqs/pom.xml +++ b/edqs/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC thingsboard edqs diff --git a/monitoring/pom.xml b/monitoring/pom.xml index 6dbcf85f07..dbac99d9c4 100644 --- a/monitoring/pom.xml +++ b/monitoring/pom.xml @@ -21,7 +21,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC thingsboard diff --git a/msa/black-box-tests/pom.xml b/msa/black-box-tests/pom.xml index 358c524e06..30873c4c50 100644 --- a/msa/black-box-tests/pom.xml +++ b/msa/black-box-tests/pom.xml @@ -21,7 +21,7 @@ org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC msa org.thingsboard.msa diff --git a/msa/edqs/pom.xml b/msa/edqs/pom.xml index 2dd4a9a584..1b0084d471 100644 --- a/msa/edqs/pom.xml +++ b/msa/edqs/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC msa org.thingsboard.msa diff --git a/msa/js-executor/pom.xml b/msa/js-executor/pom.xml index 9730e7f33b..50ab2286bb 100644 --- a/msa/js-executor/pom.xml +++ b/msa/js-executor/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC msa org.thingsboard.msa diff --git a/msa/monitoring/pom.xml b/msa/monitoring/pom.xml index cb5b609e43..2e85f02671 100644 --- a/msa/monitoring/pom.xml +++ b/msa/monitoring/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC msa diff --git a/msa/pom.xml b/msa/pom.xml index 6ec4ffe1b9..f41f7f0fc0 100644 --- a/msa/pom.xml +++ b/msa/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC thingsboard msa diff --git a/msa/tb-node/pom.xml b/msa/tb-node/pom.xml index 8df294260b..29ea35dba5 100644 --- a/msa/tb-node/pom.xml +++ b/msa/tb-node/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC msa org.thingsboard.msa diff --git a/msa/tb/pom.xml b/msa/tb/pom.xml index 1cbbf9d1ec..fd562fc692 100644 --- a/msa/tb/pom.xml +++ b/msa/tb/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC msa org.thingsboard.msa diff --git a/msa/transport/coap/pom.xml b/msa/transport/coap/pom.xml index 256220078d..6a08c8154c 100644 --- a/msa/transport/coap/pom.xml +++ b/msa/transport/coap/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 4.3.0-SNAPSHOT + 4.3.0-RC transport org.thingsboard.msa.transport diff --git a/msa/transport/http/pom.xml b/msa/transport/http/pom.xml index 7e5871729d..680863481a 100644 --- a/msa/transport/http/pom.xml +++ b/msa/transport/http/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 4.3.0-SNAPSHOT + 4.3.0-RC transport org.thingsboard.msa.transport diff --git a/msa/transport/lwm2m/pom.xml b/msa/transport/lwm2m/pom.xml index ca6977eac6..1226a9d549 100644 --- a/msa/transport/lwm2m/pom.xml +++ b/msa/transport/lwm2m/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 4.3.0-SNAPSHOT + 4.3.0-RC transport org.thingsboard.msa.transport diff --git a/msa/transport/mqtt/pom.xml b/msa/transport/mqtt/pom.xml index 172c4facb0..cfe624c69d 100644 --- a/msa/transport/mqtt/pom.xml +++ b/msa/transport/mqtt/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard.msa - 4.3.0-SNAPSHOT + 4.3.0-RC transport org.thingsboard.msa.transport diff --git a/msa/transport/pom.xml b/msa/transport/pom.xml index a6cff4fd0b..b63aec5c68 100644 --- a/msa/transport/pom.xml +++ b/msa/transport/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC msa org.thingsboard.msa diff --git a/msa/transport/snmp/pom.xml b/msa/transport/snmp/pom.xml index 79734822aa..b6a72efa58 100644 --- a/msa/transport/snmp/pom.xml +++ b/msa/transport/snmp/pom.xml @@ -21,7 +21,7 @@ org.thingsboard.msa transport - 4.3.0-SNAPSHOT + 4.3.0-RC org.thingsboard.msa.transport diff --git a/msa/vc-executor-docker/pom.xml b/msa/vc-executor-docker/pom.xml index 85634d8688..eba717cb36 100644 --- a/msa/vc-executor-docker/pom.xml +++ b/msa/vc-executor-docker/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC msa org.thingsboard.msa diff --git a/msa/vc-executor/pom.xml b/msa/vc-executor/pom.xml index 0acd863612..0635e69bd5 100644 --- a/msa/vc-executor/pom.xml +++ b/msa/vc-executor/pom.xml @@ -21,7 +21,7 @@ org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC msa org.thingsboard.msa diff --git a/msa/web-ui/pom.xml b/msa/web-ui/pom.xml index db7ed1424a..1eb47413d7 100644 --- a/msa/web-ui/pom.xml +++ b/msa/web-ui/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC msa org.thingsboard.msa diff --git a/netty-mqtt/pom.xml b/netty-mqtt/pom.xml index a09d1e2409..01bc357127 100644 --- a/netty-mqtt/pom.xml +++ b/netty-mqtt/pom.xml @@ -19,11 +19,11 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC thingsboard netty-mqtt - 4.3.0-SNAPSHOT + 4.3.0-RC jar Netty MQTT Client diff --git a/pom.xml b/pom.xml index 7966bb1253..99108196aa 100755 --- a/pom.xml +++ b/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC pom Thingsboard diff --git a/rest-client/pom.xml b/rest-client/pom.xml index c3cf2460dd..fd5783227b 100644 --- a/rest-client/pom.xml +++ b/rest-client/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC thingsboard rest-client diff --git a/rule-engine/pom.xml b/rule-engine/pom.xml index 7abb7be3a3..dce202bc94 100644 --- a/rule-engine/pom.xml +++ b/rule-engine/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC thingsboard rule-engine diff --git a/rule-engine/rule-engine-api/pom.xml b/rule-engine/rule-engine-api/pom.xml index 0c1bb2e362..ef6904b24c 100644 --- a/rule-engine/rule-engine-api/pom.xml +++ b/rule-engine/rule-engine-api/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC rule-engine org.thingsboard.rule-engine diff --git a/rule-engine/rule-engine-components/pom.xml b/rule-engine/rule-engine-components/pom.xml index 9824974311..78e6b5e684 100644 --- a/rule-engine/rule-engine-components/pom.xml +++ b/rule-engine/rule-engine-components/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC rule-engine org.thingsboard.rule-engine diff --git a/tools/pom.xml b/tools/pom.xml index f691913c43..d76b19ba2d 100644 --- a/tools/pom.xml +++ b/tools/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC thingsboard tools diff --git a/transport/coap/pom.xml b/transport/coap/pom.xml index 67f16917d3..4a30c5d2bb 100644 --- a/transport/coap/pom.xml +++ b/transport/coap/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC transport org.thingsboard.transport diff --git a/transport/http/pom.xml b/transport/http/pom.xml index 371ecb84ca..bc1c7a845d 100644 --- a/transport/http/pom.xml +++ b/transport/http/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC transport org.thingsboard.transport diff --git a/transport/lwm2m/pom.xml b/transport/lwm2m/pom.xml index 66a3066a88..8871a2b2b3 100644 --- a/transport/lwm2m/pom.xml +++ b/transport/lwm2m/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC transport org.thingsboard.transport diff --git a/transport/mqtt/pom.xml b/transport/mqtt/pom.xml index 57a73b1bbe..2fe1cb91b2 100644 --- a/transport/mqtt/pom.xml +++ b/transport/mqtt/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC transport org.thingsboard.transport diff --git a/transport/pom.xml b/transport/pom.xml index a8658bbf40..ad394b46f9 100644 --- a/transport/pom.xml +++ b/transport/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC thingsboard transport diff --git a/transport/snmp/pom.xml b/transport/snmp/pom.xml index d5c3d1fe02..528538bd03 100644 --- a/transport/snmp/pom.xml +++ b/transport/snmp/pom.xml @@ -21,7 +21,7 @@ org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC transport diff --git a/ui-ngx/pom.xml b/ui-ngx/pom.xml index 56fc4ed628..f83c914409 100644 --- a/ui-ngx/pom.xml +++ b/ui-ngx/pom.xml @@ -20,7 +20,7 @@ 4.0.0 org.thingsboard - 4.3.0-SNAPSHOT + 4.3.0-RC thingsboard org.thingsboard diff --git a/ui-ngx/src/app/core/http/calculated-fields.service.ts b/ui-ngx/src/app/core/http/calculated-fields.service.ts index 0fba704277..f3bab62cd2 100644 --- a/ui-ngx/src/app/core/http/calculated-fields.service.ts +++ b/ui-ngx/src/app/core/http/calculated-fields.service.ts @@ -15,17 +15,13 @@ /// import { Injectable } from '@angular/core'; -import { - createDefaultHttpOptions, - defaultHttpOptionsFromConfig, - defaultHttpOptionsFromParams, - RequestConfig -} from './http-utils'; +import { defaultHttpOptionsFromConfig, defaultHttpOptionsFromParams, RequestConfig } from './http-utils'; import { Observable } from 'rxjs'; import { HttpClient } from '@angular/common/http'; import { PageData } from '@shared/models/page/page-data'; import { CalculatedField, + CalculatedFieldInfo, CalculatedFieldsQuery, CalculatedFieldTestScriptInputParams, CalculatedFieldType @@ -56,11 +52,11 @@ export class CalculatedFieldsService { return this.http.delete(`/api/calculatedField/${calculatedFieldId}`, defaultHttpOptionsFromConfig(config)); } - public getCalculatedFieldsFilter(pageLink: PageLink, query: CalculatedFieldsQuery, config?: RequestConfig): Observable> { - return this.http.get>(`/api/calculatedFields${pageLink.toQuery()}`, defaultHttpOptionsFromParams(query, config)); + public getCalculatedFields(pageLink: PageLink, query: CalculatedFieldsQuery, config?: RequestConfig): Observable> { + return this.http.get>(`/api/calculatedFields${pageLink.toQuery()}`, defaultHttpOptionsFromParams(query, config)); } - public getCalculatedFields({ entityType, id }: EntityId, pageLink: PageLink, type?: CalculatedFieldType, config?: RequestConfig): Observable> { + public getCalculatedFieldsByEntityId({ entityType, id }: EntityId, pageLink: PageLink, type?: CalculatedFieldType, config?: RequestConfig): Observable> { return this.http.get>(`/api/${entityType}/${id}/calculatedFields${pageLink.toQuery()}`, defaultHttpOptionsFromParams({type} , config)); } @@ -72,7 +68,7 @@ export class CalculatedFieldsService { return this.http.get(`/api/calculatedField/${id}/debug`, defaultHttpOptionsFromConfig(config)); } - public getAlarmRuleNames(pageLink: PageLink, type: CalculatedFieldType, config?: RequestConfig): Observable> { + public getCalculatedFieldNames(pageLink: PageLink, type: CalculatedFieldType, config?: RequestConfig): Observable> { return this.http.get>(`/api/calculatedFields/names${pageLink.toQuery()}`, defaultHttpOptionsFromParams({type}, config)); } } diff --git a/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rules-table-config.ts b/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rules-table-config.ts index f1bd30d853..46d43f2921 100644 --- a/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rules-table-config.ts +++ b/ui-ngx/src/app/modules/home/components/alarm-rules/alarm-rules-table-config.ts @@ -43,6 +43,7 @@ import { CalculatedField, CalculatedFieldAlarmRule, CalculatedFieldEventArguments, + CalculatedFieldInfo, CalculatedFieldsQuery, CalculatedFieldType, getCalculatedFieldArgumentsEditorCompleter, @@ -67,12 +68,14 @@ import { CalculatedFieldTestScriptDialogData } from "@home/components/calculated-fields/components/test-dialog/calculated-field-script-test-dialog.component"; -export class AlarmRulesTableConfig extends EntityTableConfig { +type AlarmRuleTableEntity = CalculatedField | CalculatedFieldInfo; + +export class AlarmRulesTableConfig extends EntityTableConfig { readonly tenantId = getCurrentAuthUser(this.store).tenantId; additionalDebugActionConfig = { title: this.translate.instant('action.see-debug-events'), - action: (calculatedField: CalculatedField) => this.openDebugEventsDialog.call(this, calculatedField), + action: (calculatedField: AlarmRuleTableEntity) => this.openDebugEventsDialog.call(this, calculatedField), }; alarmRuleFilterConfig: CalculatedFieldsQuery; @@ -81,11 +84,11 @@ export class AlarmRulesTableConfig extends EntityTableConfig { private translate: TranslateService, private dialog: MatDialog, private datePipe: DatePipe, - public entityId: EntityId = null, + private entityId: EntityId = null, private store: Store, private destroyRef: DestroyRef, private renderer: Renderer2, - public entityName: string, + private entityName: string, private ownerId: EntityId = null, private importExportService: ImportExportService, private entityDebugSettingsService: EntityDebugSettingsService, @@ -118,7 +121,7 @@ export class AlarmRulesTableConfig extends EntityTableConfig { this.entitiesFetchFunction = (pageLink: PageLink) => this.fetchCalculatedFields(pageLink); this.addEntity = this.getCalculatedAlarmDialog.bind(this); - this.deleteEntityTitle = (field: CalculatedField) => this.translate.instant('alarm-rule.delete-title', {title: field.name}); + this.deleteEntityTitle = (field) => this.translate.instant('alarm-rule.delete-title', {title: field.name}); this.deleteEntityContent = () => this.translate.instant('alarm-rule.delete-text'); this.deleteEntitiesTitle = count => this.translate.instant('alarm-rule.delete-multiple-title', {count}); this.deleteEntitiesContent = () => this.translate.instant('alarm-rule.delete-multiple-text'); @@ -143,10 +146,10 @@ export class AlarmRulesTableConfig extends EntityTableConfig { this.columns.push(new EntityTableColumn('name', 'alarm-rule.alarm-type', '33%', entity => this.utilsService.customTranslation(entity.name, entity.name))); if (this.pageMode) { - this.columns.push(new EntityTableColumn('entityType', 'entity.entity-type', '10%', + this.columns.push(new EntityTableColumn('entityType', 'entity.entity-type', '10%', entity => this.translate.instant(entityTypeTranslations.get(entity.entityId.entityType).type))); - this.columns.push(new EntityLinkTableColumn('entityName', 'entity.entity', '33%', - entity => this.utilsService.customTranslation(entity['entityName'], entity['entityName']), + this.columns.push(new EntityLinkTableColumn('entityName', 'entity.entity', '33%', + entity => this.utilsService.customTranslation(entity.entityName, entity.entityName), entity => getEntityDetailsPageURL(entity.entityId?.id, entity.entityId?.entityType as EntityType), false)); } this.columns.push(new EntityTableColumn('createRule', 'alarm-rule.severities', this.pageMode ? '23%' : '67%', @@ -193,13 +196,13 @@ export class AlarmRulesTableConfig extends EntityTableConfig { ); } - fetchCalculatedFields(pageLink: PageLink): Observable> { + fetchCalculatedFields(pageLink: PageLink): Observable> { return this.pageMode ? - this.calculatedFieldsService.getCalculatedFieldsFilter(pageLink, {types: [CalculatedFieldType.ALARM], ...this.alarmRuleFilterConfig}) : - this.calculatedFieldsService.getCalculatedFields(this.entityId, pageLink, CalculatedFieldType.ALARM); + this.calculatedFieldsService.getCalculatedFields(pageLink, {types: [CalculatedFieldType.ALARM], ...this.alarmRuleFilterConfig}) : + this.calculatedFieldsService.getCalculatedFieldsByEntityId(this.entityId, pageLink, CalculatedFieldType.ALARM); } - onOpenDebugConfig($event: Event, calculatedField: CalculatedField): void { + onOpenDebugConfig($event: Event, calculatedField: AlarmRuleTableEntity): void { $event?.stopPropagation(); const { debugSettings = {}, id } = calculatedField; const additionalActionConfig = { @@ -224,7 +227,7 @@ export class AlarmRulesTableConfig extends EntityTableConfig { }, $event.target as Element); } - private editCalculatedField($event: Event, calculatedField: CalculatedField, isDirty = false): void { + private editCalculatedField($event: Event, calculatedField: AlarmRuleTableEntity, isDirty = false): void { $event?.stopPropagation(); this.getCalculatedAlarmDialog(calculatedField, 'action.apply', isDirty) .subscribe((res) => { @@ -234,11 +237,12 @@ export class AlarmRulesTableConfig extends EntityTableConfig { }); } - private copyCalculatedField($event: Event, calculatedField: CalculatedField, isDirty = false): void { + private copyCalculatedField($event: Event, calculatedField: AlarmRuleTableEntity, isDirty = false): void { $event?.stopPropagation(); const copyCalculatedAlarmRule = deepClone(calculatedField); if (this.pageMode) { copyCalculatedAlarmRule.entityId = null; + delete (copyCalculatedAlarmRule as CalculatedFieldInfo).entityName; } delete copyCalculatedAlarmRule.id; this.getCalculatedAlarmDialog(copyCalculatedAlarmRule, 'action.apply', isDirty) @@ -249,8 +253,9 @@ export class AlarmRulesTableConfig extends EntityTableConfig { }); } - private getCalculatedAlarmDialog(value?: CalculatedField, buttonTitle = 'action.add', isDirty = false): Observable { + private getCalculatedAlarmDialog(value?: AlarmRuleTableEntity, buttonTitle = 'action.add', isDirty = false): Observable { const entityId = this.entityId || value?.entityId; + const entityName = this.entityName || (value as CalculatedFieldInfo)?.entityName; return this.dialog.open(AlarmRuleDialogComponent, { disableClose: true, panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], @@ -258,8 +263,8 @@ export class AlarmRulesTableConfig extends EntityTableConfig { value, buttonTitle, entityId, + entityName, tenantId: this.tenantId, - entityName: this.entityName, ownerId: this.ownerId ?? {entityType: EntityType.TENANT, id: this.tenantId}, additionalDebugActionConfig: this.additionalDebugActionConfig, isDirty, @@ -271,7 +276,7 @@ export class AlarmRulesTableConfig extends EntityTableConfig { .pipe(filter(Boolean)); } - private openDebugEventsDialog($event: Event, calculatedField: CalculatedField): void { + private openDebugEventsDialog($event: Event, calculatedField: AlarmRuleTableEntity): void { $event?.stopPropagation(); this.dialog.open(EventsDialogComponent, { disableClose: true, @@ -290,7 +295,7 @@ export class AlarmRulesTableConfig extends EntityTableConfig { .subscribe(); } - private exportAlarmRule($event: Event, calculatedField: CalculatedField): void { + private exportAlarmRule($event: Event, calculatedField: AlarmRuleTableEntity): void { $event?.stopPropagation(); this.importExportService.exportCalculatedField(calculatedField.id.id); } @@ -343,7 +348,7 @@ export class AlarmRulesTableConfig extends EntityTableConfig { ).subscribe(() => this.updateData()); } - private getTestScriptDialog(calculatedField: CalculatedField, expression: string, argumentsObj?: CalculatedFieldEventArguments, openCalculatedFieldEdit = true): Observable { + private getTestScriptDialog(calculatedField: AlarmRuleTableEntity, expression: string, argumentsObj?: CalculatedFieldEventArguments, openCalculatedFieldEdit = true): Observable { if (calculatedField.type === CalculatedFieldType.ALARM) { const resultArguments = Object.keys(calculatedField.configuration.arguments).reduce((acc, key) => { const type = calculatedField.configuration.arguments[key].refEntityKey.type; diff --git a/ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-rule-condition-dialog.component.html b/ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-rule-condition-dialog.component.html index e5c94ce881..90ae6f7c4b 100644 --- a/ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-rule-condition-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/alarm-rules/cf-alarm-rule-condition-dialog.component.html @@ -55,9 +55,7 @@ } @else {
-
- {{ 'alarm-rule.script' | translate }} -
+
{{ 'alarm-rule.script' | translate }}
close -
- -
+
+
+ audit-log.action-data +
- - -
+
+ audit-log.failure-details +
diff --git a/ui-ngx/src/app/modules/home/components/audit-log/audit-log-details-dialog.component.scss b/ui-ngx/src/app/modules/home/components/audit-log/audit-log-details-dialog.component.scss index 57bd26c8ba..5f029ce4f1 100644 --- a/ui-ngx/src/app/modules/home/components/audit-log/audit-log-details-dialog.component.scss +++ b/ui-ngx/src/app/modules/home/components/audit-log/audit-log-details-dialog.component.scss @@ -13,13 +13,27 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + +@import '../../../../../scss/constants'; + :host { - .tb-audit-log-action-data, - .tb-audit-log-failure-details { - width: 100%; - min-width: 400px; - height: 100%; - min-height: 50px; + display: grid; + height: 100%; + max-width: 100%; + max-height: 100vh; + grid-template-rows: min-content minmax(auto, 1fr) min-content; + + @media #{$mat-gt-xs} { + .mat-mdc-dialog-content { + max-height: 80vh; + } + } + + .tb-audit-log { + min-width: max(400px, 100%); border: 1px solid #c0c0c0; + @media #{$mat-xs} { + min-width: 100%; + } } } diff --git a/ui-ngx/src/app/modules/home/components/audit-log/audit-log-details-dialog.component.ts b/ui-ngx/src/app/modules/home/components/audit-log/audit-log-details-dialog.component.ts index c888fafebc..e3d8bbc582 100644 --- a/ui-ngx/src/app/modules/home/components/audit-log/audit-log-details-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/audit-log/audit-log-details-dialog.component.ts @@ -22,7 +22,11 @@ import { ActionStatus, AuditLog } from '@shared/models/audit-log.models'; import { Ace } from 'ace-builds'; import { DialogComponent } from '@shared/components/dialog.component'; import { Router } from '@angular/router'; -import { getAce } from '@shared/models/ace/ace.models'; +import { getAce, updateEditorSize } from '@shared/models/ace/ace.models'; +import { Observable, of } from 'rxjs'; +import { isObject } from '@core/utils'; +import { ContentType, contentTypesMap } from '@shared/models/constants'; +import { beautifyJs } from '@shared/models/beautify.models'; export interface AuditLogDetailsDialogData { auditLog: AuditLog; @@ -41,11 +45,10 @@ export class AuditLogDetailsDialogComponent extends DialogComponent, protected router: Router, @@ -58,12 +61,10 @@ export class AuditLogDetailsDialogComponent extends DialogComponent = { - mode: 'ace/mode/java', - theme: 'ace/theme/github', - showGutter: false, - showPrintMargin: false, - readOnly: true - }; - - const advancedOptions = { - enableSnippets: false, - enableBasicAutocompletion: false, - enableLiveAutocompletion: false - }; - - editorOptions = {...editorOptions, ...advancedOptions}; - getAce().subscribe( - (ace) => { - const editor = ace.edit(editorElement, editorOptions); - this.aceEditors.push(editor); - editor.session.setUseWrapMode(false); - editor.setValue(content, -1); - this.updateEditorSize(editorElement, content, editor); - } - ); - } - - updateEditorSize(editorElement: any, content: string, editor: Ace.Editor) { - let newHeight = 200; - let newWidth = 600; - if (content && content.length > 0) { - const lines = content.split('\n'); - newHeight = 18 * lines.length + 16; - let maxLineLength = 0; - lines.forEach((row) => { - const line = row.replace(/\t/g, ' ').replace(/\n/g, ''); - const lineLength = line.length; - maxLineLength = Math.max(maxLineLength, lineLength); - }); - newWidth = 9 * maxLineLength + 16; + let mode = 'java'; + let content$: Observable = null; + let contentType = ContentType.TEXT; + if (content && isObject(content)) { + contentType = ContentType.JSON; + mode = contentTypesMap.get(contentType).code; + content$ = beautifyJs(JSON.stringify(content), {indent_size: 2}); + } + if (!content$) { + content$ = of(content as string); } - // newHeight = Math.min(400, newHeight); - this.renderer.setStyle(editorElement, 'minHeight', newHeight.toString() + 'px'); - this.renderer.setStyle(editorElement, 'height', newHeight.toString() + 'px'); - this.renderer.setStyle(editorElement, 'width', newWidth.toString() + 'px'); - editor.resize(); + content$.subscribe((processedContent) => { + const isJSON = contentType === ContentType.JSON + const editorOptions: Partial = { + mode: `ace/mode/${mode}`, + theme: 'ace/theme/github', + showGutter: isJSON, + showFoldWidgets: true, + foldStyle: 'markbeginend', + showPrintMargin: false, + readOnly: true, + enableSnippets: false, + enableBasicAutocompletion: false, + enableLiveAutocompletion: false, + }; + getAce().subscribe( + (ace) => { + const editor = ace.edit(editorElement, editorOptions); + this.aceEditors.push(editor); + editor.session.setUseWrapMode(false); + editor.setValue(processedContent, -1); + updateEditorSize(editorElement, processedContent, editor, this.renderer, {showGutter: isJSON}); + } + ) + }); } } diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts b/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts index e5c57aae2e..8385b5cb45 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table-config.ts @@ -40,8 +40,8 @@ import { ArgumentEntityType, ArgumentType, CalculatedField, - CalculatedFieldAlarmRule, CalculatedFieldEventArguments, + CalculatedFieldInfo, CalculatedFieldScriptConfiguration, CalculatedFieldsQuery, CalculatedFieldType, @@ -68,12 +68,14 @@ import { CalculatedFieldsHeaderComponent } from '@home/components/calculated-fields/table-header/calculated-fields-header.component'; -export class CalculatedFieldsTableConfig extends EntityTableConfig { +type CalculatedFieldsTableEntity = CalculatedField | CalculatedFieldInfo; + +export class CalculatedFieldsTableConfig extends EntityTableConfig { readonly tenantId = getCurrentAuthUser(this.store).tenantId; additionalDebugActionConfig = { title: this.translate.instant('action.see-debug-events'), - action: (calculatedField: CalculatedField) => this.openDebugEventsDialog.call(this, null, calculatedField), + action: (calculatedField: CalculatedFieldsTableEntity) => this.openDebugEventsDialog.call(this, null, calculatedField), }; calculatedFieldFilterConfig: CalculatedFieldsQuery; @@ -82,11 +84,11 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig, private destroyRef: DestroyRef, private renderer: Renderer2, - public entityName: string, + private entityName: string, private ownerId: EntityId = null, private importExportService: ImportExportService, private entityDebugSettingsService: EntityDebugSettingsService, @@ -110,7 +112,7 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig this.fetchCalculatedFields(pageLink); this.addEntity = this.getCalculatedFieldDialog.bind(this); - this.deleteEntityTitle = (field: CalculatedField) => this.translate.instant('calculated-fields.delete-title', {title: field.name}); + this.deleteEntityTitle = (field) => this.translate.instant('calculated-fields.delete-title', {title: field.name}); this.deleteEntityContent = () => this.translate.instant('calculated-fields.delete-text'); this.deleteEntitiesTitle = count => this.translate.instant('calculated-fields.delete-multiple-title', {count}); this.deleteEntitiesContent = () => this.translate.instant('calculated-fields.delete-multiple-text'); @@ -136,10 +138,10 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig('name', 'common.name', this.pageMode ? '33%' : '60%', entity => this.utilsService.customTranslation(entity.name, entity.name))); if (this.pageMode) { - this.columns.push(new EntityTableColumn('entityType', 'entity.entity-type', '10%', + this.columns.push(new EntityTableColumn('entityType', 'entity.entity-type', '10%', entity => this.translate.instant(entityTypeTranslations.get(entity.entityId.entityType).type))); - this.columns.push(new EntityLinkTableColumn('entityName', 'entity.entity', '33%', - entity => this.utilsService.customTranslation(entity['entityName'], entity['entityName']), + this.columns.push(new EntityLinkTableColumn('entityName', 'entity.entity', '33%', + entity => this.utilsService.customTranslation(entity.entityName, entity.entityName), entity => getEntityDetailsPageURL(entity.entityId?.id, entity.entityId?.entityType as EntityType), false)); } this.columns.push(new EntityTableColumn('type', 'common.type', this.pageMode ? '23%' : '40%', entity => this.translate.instant(CalculatedFieldTypeTranslations.get(entity.type).name), () => ({whiteSpace: 'nowrap' }))); @@ -180,13 +182,13 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig> { + fetchCalculatedFields(pageLink: PageLink): Observable> { return this.pageMode ? - this.calculatedFieldsService.getCalculatedFieldsFilter(pageLink, this.calculatedFieldFilterConfig): - this.calculatedFieldsService.getCalculatedFields(this.entityId, pageLink); + this.calculatedFieldsService.getCalculatedFields(pageLink, this.calculatedFieldFilterConfig): + this.calculatedFieldsService.getCalculatedFieldsByEntityId(this.entityId, pageLink); } - onOpenDebugConfig($event: Event, calculatedField: CalculatedField): void { + onOpenDebugConfig($event: Event, calculatedField: CalculatedFieldsTableEntity): void { $event?.stopPropagation(); const { debugSettings = {}, id } = calculatedField; const additionalActionConfig = { @@ -210,7 +212,7 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig { @@ -220,8 +222,9 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig { + private getCalculatedFieldDialog(value?: CalculatedFieldsTableEntity, buttonTitle = 'action.add', isDirty = false): Observable { const entityId = this.entityId || value?.entityId; + const entityName = this.entityName || (value as CalculatedFieldInfo)?.entityName; return this.dialog.open(CalculatedFieldDialogComponent, { disableClose: true, panelClass: ['tb-dialog', 'tb-fullscreen-dialog'], @@ -229,8 +232,8 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig { return (calculatedField.type === CalculatedFieldType.SCRIPT || @@ -274,19 +277,20 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig { if (res) { this.updateData(); @@ -350,7 +354,7 @@ export class CalculatedFieldsTableConfig extends EntityTableConfig this.updateData()); } - private getTestScriptDialog(calculatedField: CalculatedField, argumentsObj?: CalculatedFieldEventArguments, openCalculatedFieldEdit = true, expression?: string): Observable { + private getTestScriptDialog(calculatedField: CalculatedFieldsTableEntity, argumentsObj?: CalculatedFieldEventArguments, openCalculatedFieldEdit = true, expression?: string): Observable { if ( calculatedField.type === CalculatedFieldType.SCRIPT || calculatedField.type === CalculatedFieldType.RELATED_ENTITIES_AGGREGATION || diff --git a/ui-ngx/src/app/modules/home/components/calculated-fields/components/propagation-configuration/propagation-configuration.component.html b/ui-ngx/src/app/modules/home/components/calculated-fields/components/propagation-configuration/propagation-configuration.component.html index 8abbfb2056..5e6726219f 100644 --- a/ui-ngx/src/app/modules/home/components/calculated-fields/components/propagation-configuration/propagation-configuration.component.html +++ b/ui-ngx/src/app/modules/home/components/calculated-fields/components/propagation-configuration/propagation-configuration.component.html @@ -59,9 +59,7 @@ [isScript]="this.propagateConfiguration.get('applyExpressionToResolvedArguments').value"/>
-
- {{ 'calculated-fields.script' | translate }} -
+
{{ 'calculated-fields.script' | translate }}
-
- {{ (isScript ? 'calculated-fields.type.script' : 'calculated-fields.expression') | translate }} -
+
{{ (isScript ? 'calculated-fields.type.script' : 'calculated-fields.expression') | translate }}
diff --git a/ui-ngx/src/app/modules/home/components/event/event-content-dialog.component.html b/ui-ngx/src/app/modules/home/components/event/event-content-dialog.component.html index 27280bfd9e..aa1f8754a5 100644 --- a/ui-ngx/src/app/modules/home/components/event/event-content-dialog.component.html +++ b/ui-ngx/src/app/modules/home/components/event/event-content-dialog.component.html @@ -24,8 +24,8 @@ close -
-
+
+
diff --git a/ui-ngx/src/app/modules/home/components/event/event-content-dialog.component.scss b/ui-ngx/src/app/modules/home/components/event/event-content-dialog.component.scss index 2dd61e2722..ee1ca74151 100644 --- a/ui-ngx/src/app/modules/home/components/event/event-content-dialog.component.scss +++ b/ui-ngx/src/app/modules/home/components/event/event-content-dialog.component.scss @@ -13,11 +13,28 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +@import '../../../../../scss/constants'; + :host { + display: grid; + height: 100%; + max-width: 100%; + max-height: 100vh; + grid-template-rows: min-content minmax(auto, 1fr) min-content; + + @media #{$mat-gt-xs} { + .mat-mdc-dialog-content { + max-height: 80vh; + } + } + .tb-event-content { - width: 100%; min-width: 400px; - height: 100%; - min-height: 50px; + &.border { + border: 1px solid #c0c0c0; + } + @media #{$mat-xs} { + min-width: 100%; + } } } diff --git a/ui-ngx/src/app/modules/home/components/event/event-content-dialog.component.ts b/ui-ngx/src/app/modules/home/components/event/event-content-dialog.component.ts index 2ae62dd890..9ca6ad8b43 100644 --- a/ui-ngx/src/app/modules/home/components/event/event-content-dialog.component.ts +++ b/ui-ngx/src/app/modules/home/components/event/event-content-dialog.component.ts @@ -23,7 +23,7 @@ import { Ace } from 'ace-builds'; import { DialogComponent } from '@shared/components/dialog.component'; import { Router } from '@angular/router'; import { ContentType, contentTypesMap } from '@shared/models/constants'; -import { getAce } from '@shared/models/ace/ace.models'; +import { getAce, updateEditorSize } from '@shared/models/ace/ace.models'; import { Observable } from 'rxjs/internal/Observable'; import { beautifyJs } from '@shared/models/beautify.models'; import { of } from 'rxjs'; @@ -40,40 +40,38 @@ export interface EventContentDialogData { templateUrl: './event-content-dialog.component.html', styleUrls: ['./event-content-dialog.component.scss'] }) -export class EventContentDialogComponent extends DialogComponent implements OnInit, OnDestroy { +export class EventContentDialogComponent extends DialogComponent implements OnInit, OnDestroy { @ViewChild('eventContentEditor', {static: true}) eventContentEditorElmRef: ElementRef; - content: string; title: string; - contentType: ContentType; - aceEditor: Ace.Editor; + showBorder = false; + + private contentType: ContentType; + private aceEditor: Ace.Editor; constructor(protected store: Store, protected router: Router, @Inject(MAT_DIALOG_DATA) public data: EventContentDialogData, - public dialogRef: MatDialogRef, + protected dialogRef: MatDialogRef, private renderer: Renderer2) { super(store, router, dialogRef); } ngOnInit(): void { - this.content = this.data.content; this.title = this.data.title; this.contentType = this.data.contentType; - this.createEditor(this.eventContentEditorElmRef, this.content); + this.createEditor(this.eventContentEditorElmRef, this.data.content); } ngOnDestroy(): void { - if (this.aceEditor) { - this.aceEditor.destroy(); - } + this.aceEditor?.destroy(); super.ngOnDestroy(); } - isJson(str) { + private isJson(str: string) { try { return isLiteralObject(JSON.parse(str)); } catch (e) { @@ -81,78 +79,53 @@ export class EventContentDialogComponent extends DialogComponent = null; if (this.contentType) { mode = contentTypesMap.get(this.contentType).code; if (this.contentType === ContentType.JSON && content) { - content$ = beautifyJs(content, {indent_size: 4}); + content$ = beautifyJs(content, {indent_size: 2}); } else if (this.contentType === ContentType.BINARY && content) { try { const decodedData = base64toString(content); if (this.isJson(decodedData)) { mode = 'json'; - content$ = beautifyJs(decodedData, {indent_size: 4}); + content$ = beautifyJs(decodedData, {indent_size: 2}); } else { content$ = of(decodedData); } - } catch (e) {} + } catch (e) {/**/} } } if (!content$) { content$ = of(content); } - content$.subscribe( - (processedContent) => { - let editorOptions: Partial = { - mode: `ace/mode/${mode}`, - theme: 'ace/theme/github', - showGutter: false, - showPrintMargin: false, - readOnly: true - }; - - const advancedOptions = { - enableSnippets: false, - enableBasicAutocompletion: false, - enableLiveAutocompletion: false - }; - - editorOptions = {...editorOptions, ...advancedOptions}; - getAce().subscribe( - (ace) => { - this.aceEditor = ace.edit(editorElement, editorOptions); - this.aceEditor.session.setUseWrapMode(false); - this.aceEditor.setValue(processedContent, -1); - this.updateEditorSize(editorElement, processedContent, this.aceEditor); - } - ); - } - ); - } - - updateEditorSize(editorElement: any, content: string, editor: Ace.Editor) { - let newHeight = 400; - let newWidth = 600; - if (content && content.length > 0) { - const lines = content.split('\n'); - newHeight = 17 * lines.length + 16; - let maxLineLength = 0; - lines.forEach((row) => { - const line = row.replace(/\t/g, ' ').replace(/\n/g, ''); - const lineLength = line.length; - maxLineLength = Math.max(maxLineLength, lineLength); - }); - newWidth = 9 * maxLineLength + 16; - } - // newHeight = Math.min(400, newHeight); - this.renderer.setStyle(editorElement, 'minHeight', newHeight.toString() + 'px'); - this.renderer.setStyle(editorElement, 'height', newHeight.toString() + 'px'); - this.renderer.setStyle(editorElement, 'width', newWidth.toString() + 'px'); - editor.resize(); + content$.subscribe((processedContent) => { + const isJSON = mode === 'json' && processedContent !== '{}'; + this.showBorder = isJSON; + const editorOptions: Partial = { + mode: `ace/mode/${mode}`, + theme: 'ace/theme/github', + showGutter: isJSON, + showFoldWidgets: true, + foldStyle: 'markbeginend', + showPrintMargin: false, + readOnly: true, + enableSnippets: false, + enableBasicAutocompletion: false, + enableLiveAutocompletion: false, + }; + getAce().subscribe( + (ace) => { + this.aceEditor = ace.edit(editorElement, editorOptions); + this.aceEditor.session.setUseWrapMode(false); + this.aceEditor.setValue(processedContent, -1); + updateEditorSize(editorElement, processedContent, this.aceEditor, this.renderer, {showGutter: isJSON}); + } + ) + }); } - } diff --git a/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts b/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts index dc89f05fde..05511095cf 100644 --- a/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts +++ b/ui-ngx/src/app/shared/components/entity/entity-subtype-list.component.ts @@ -14,7 +14,7 @@ /// limitations under the License. /// -import { AfterViewInit, Component, ElementRef, forwardRef, Input, OnDestroy, OnInit, ViewChild } from '@angular/core'; +import { Component, ElementRef, forwardRef, Input, OnDestroy, OnInit, ViewChild } from '@angular/core'; import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR, Validators } from '@angular/forms'; import { Observable, ReplaySubject, Subscription, throwError } from 'rxjs'; import { debounceTime, map, mergeMap, share } from 'rxjs/operators'; @@ -46,7 +46,7 @@ import { CalculatedFieldsService } from "@core/http/calculated-fields.service"; } ] }) -export class EntitySubTypeListComponent implements ControlValueAccessor, OnInit, AfterViewInit, OnDestroy { +export class EntitySubTypeListComponent implements ControlValueAccessor, OnInit, OnDestroy { entitySubtypeListFormGroup: FormGroup; @@ -119,7 +119,7 @@ export class EntitySubTypeListComponent implements ControlValueAccessor, OnInit, private dirty = false; - private propagateChange = (v: any) => { }; + private propagateChange = (_v: any) => { }; private hasPageDataEntitySubTypes = new Set([ EntityType.ALARM, @@ -225,9 +225,6 @@ export class EntitySubTypeListComponent implements ControlValueAccessor, OnInit, ); } - ngAfterViewInit(): void { - } - ngOnDestroy(): void { if (this.broadcastSubscription) { this.broadcastSubscription.unsubscribe(); @@ -335,7 +332,7 @@ export class EntitySubTypeListComponent implements ControlValueAccessor, OnInit, subTypesPagesObservable = this.alarmService.getAlarmTypes(pageLink, {ignoreLoading: true}); break; case EntityType.CALCULATED_FIELD: - subTypesCfPagesObservable = this.calculatedFieldsService.getAlarmRuleNames(pageLink, CalculatedFieldType.ALARM, {ignoreLoading: true}); + subTypesCfPagesObservable = this.calculatedFieldsService.getCalculatedFieldNames(pageLink, CalculatedFieldType.ALARM, {ignoreLoading: true}); } if (subTypesPagesObservable) { this.entitySubtypes = subTypesPagesObservable.pipe( diff --git a/ui-ngx/src/app/shared/components/hint-tooltip-icon.component.scss b/ui-ngx/src/app/shared/components/hint-tooltip-icon.component.scss index 2abc704ece..8b1a9ef4d7 100644 --- a/ui-ngx/src/app/shared/components/hint-tooltip-icon.component.scss +++ b/ui-ngx/src/app/shared/components/hint-tooltip-icon.component.scss @@ -17,7 +17,6 @@ display: flex; flex-direction: row; align-items: center; - gap: 4px; } :host { diff --git a/ui-ngx/src/app/shared/components/json-object-view.component.ts b/ui-ngx/src/app/shared/components/json-object-view.component.ts index e549dd03c1..20f8660279 100644 --- a/ui-ngx/src/app/shared/components/json-object-view.component.ts +++ b/ui-ngx/src/app/shared/components/json-object-view.component.ts @@ -15,14 +15,11 @@ /// import { Component, ElementRef, forwardRef, Input, OnDestroy, OnInit, Renderer2, ViewChild } from '@angular/core'; -import { NG_VALUE_ACCESSOR } from '@angular/forms'; +import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { Ace } from 'ace-builds'; -import { coerceBooleanProperty } from '@angular/cdk/coercion'; -import { Store } from '@ngrx/store'; -import { AppState } from '@core/core.state'; -import { RafService } from '@core/services/raf.service'; import { isDefinedAndNotNull, isUndefined } from '@core/utils'; -import { getAce } from '@shared/models/ace/ace.models'; +import { getAce, updateEditorSize } from '@shared/models/ace/ace.models'; +import { coerceBoolean } from '@shared/decorators/coercion'; @Component({ selector: 'tb-json-object-view', @@ -36,7 +33,7 @@ import { getAce } from '@shared/models/ace/ace.models'; } ] }) -export class JsonObjectViewComponent implements OnInit, OnDestroy { +export class JsonObjectViewComponent implements OnInit, OnDestroy, ControlValueAccessor { @ViewChild('jsonViewer', {static: true}) jsonViewerElmRef: ElementRef; @@ -55,96 +52,54 @@ export class JsonObjectViewComponent implements OnInit, OnDestroy { @Input() sort: (key: string, value: any) => any; - private widthValue: boolean; - - get autoWidth(): boolean { - return this.widthValue; - } - @Input() - set autoWidth(value: boolean) { - this.widthValue = coerceBooleanProperty(value); - } - - private heigthValue: boolean; - - get autoHeight(): boolean { - return this.heigthValue; - } + @coerceBoolean() + autoWidth: boolean @Input() - set autoHeight(value: boolean) { - this.heigthValue = coerceBooleanProperty(value); - } + @coerceBoolean() + autoHeight: boolean - constructor(public elementRef: ElementRef, - protected store: Store, - private raf: RafService, - private renderer: Renderer2) { + constructor(private renderer: Renderer2) { } ngOnInit(): void { this.viewerElement = this.jsonViewerElmRef.nativeElement; - let editorOptions: Partial = { + const editorOptions: Partial = { mode: 'ace/mode/java', theme: 'ace/theme/github', showGutter: false, showPrintMargin: false, - readOnly: true - }; - - const advancedOptions = { + readOnly: true, enableSnippets: false, enableBasicAutocompletion: false, enableLiveAutocompletion: false }; - editorOptions = {...editorOptions, ...advancedOptions}; getAce().subscribe( (ace) => { this.jsonViewer = ace.edit(this.viewerElement, editorOptions); this.jsonViewer.session.setUseWrapMode(false); this.jsonViewer.setValue(this.contentValue ? this.contentValue : '', -1); - if (this.contentValue && (this.widthValue || this.heigthValue)) { - this.updateEditorSize(this.viewerElement, this.contentValue, this.jsonViewer); + if (this.contentValue && (this.autoWidth || this.autoHeight)) { + updateEditorSize(this.viewerElement, this.contentValue, this.jsonViewer, this.renderer, { + ignoreHeight: !this.autoHeight, + ignoreWidth: !this.autoWidth + }); } } ); } ngOnDestroy(): void { - if (this.jsonViewer) { - this.jsonViewer.destroy(); - } + this.jsonViewer?.destroy(); } - updateEditorSize(editorElement: any, content: string, editor: Ace.Editor) { - let newHeight = 200; - let newWidth = 600; - if (content && content.length > 0) { - const lines = content.split('\n'); - newHeight = 17 * lines.length + 17; - let maxLineLength = 0; - lines.forEach((row) => { - const line = row.replace(/\t/g, ' ').replace(/\n/g, ''); - const lineLength = line.length; - maxLineLength = Math.max(maxLineLength, lineLength); - }); - newWidth = 8 * maxLineLength + 16; - } - if (this.heigthValue) { - this.renderer.setStyle(editorElement, 'height', newHeight.toString() + 'px'); - } - if (this.widthValue) { - this.renderer.setStyle(editorElement, 'width', newWidth.toString() + 'px'); - } - editor.resize(); - } registerOnChange(fn: any): void { this.propagateChange = fn; } - registerOnTouched(fn: any): void { + registerOnTouched(_fn: any): void { } writeValue(value: any): void { @@ -162,8 +117,11 @@ export class JsonObjectViewComponent implements OnInit, OnDestroy { } if (this.jsonViewer) { this.jsonViewer.setValue(this.contentValue ? this.contentValue : '', -1); - if (this.contentValue && (this.widthValue || this.heigthValue)) { - this.updateEditorSize(this.viewerElement, this.contentValue, this.jsonViewer); + if (this.contentValue && (this.autoWidth || this.autoHeight)) { + updateEditorSize(this.viewerElement, this.contentValue, this.jsonViewer, this.renderer, { + ignoreHeight: !this.autoHeight, + ignoreWidth: !this.autoWidth + }); } } } diff --git a/ui-ngx/src/app/shared/import-export/import-dialog-csv.component.ts b/ui-ngx/src/app/shared/import-export/import-dialog-csv.component.ts index a3d82952cc..90bd9f30ec 100644 --- a/ui-ngx/src/app/shared/import-export/import-dialog-csv.component.ts +++ b/ui-ngx/src/app/shared/import-export/import-dialog-csv.component.ts @@ -39,7 +39,7 @@ import { import { ImportExportService } from '@shared/import-export/import-export.service'; import { TableColumnsAssignmentComponent } from '@shared/import-export/table-columns-assignment.component'; import { Ace } from 'ace-builds'; -import { getAce } from '@shared/models/ace/ace.models'; +import { getAce, updateEditorSize } from '@shared/models/ace/ace.models'; export interface ImportDialogCsvData { entityType: EntityType; @@ -283,21 +283,9 @@ export class ImportDialogCsvComponent extends DialogComponent 0) { - const lines = content.split('\n'); - newHeight = 16 * lines.length + 24; - } - const minHeight = Math.min(200, newHeight); - this.renderer.setStyle(editorElement, 'minHeight', minHeight.toString() + 'px'); - this.renderer.setStyle(editorElement, 'height', newHeight.toString() + 'px'); - editor.resize(); - } - } diff --git a/ui-ngx/src/app/shared/models/ace/ace.models.ts b/ui-ngx/src/app/shared/models/ace/ace.models.ts index 49cf670989..31b97ff144 100644 --- a/ui-ngx/src/app/shared/models/ace/ace.models.ts +++ b/ui-ngx/src/app/shared/models/ace/ace.models.ts @@ -19,6 +19,7 @@ import { Observable } from 'rxjs/internal/Observable'; import { forkJoin, from, of } from 'rxjs'; import { map, mergeMap, tap } from 'rxjs/operators'; import { unwrapModule } from '@core/utils'; +import { Renderer2 } from '@angular/core'; let aceDependenciesLoaded = false; let aceModule: any; @@ -98,6 +99,46 @@ export function getAceDiff(): Observable { } } +export function updateEditorSize(editorElement: any, content: string, editor: Ace.Editor, renderer: Renderer2, options?: { + showGutter?: boolean, + ignoreHeight?: boolean, + ignoreWidth?: boolean, + setMinHeight?: boolean +}): void { + let newHeight = 200; + let newWidth = 600; + if (content && content.length > 0) { + if (editor.renderer.lineHeight <= 0) { + editor.renderer.updateFull(true); + } + const lines = content.split('\n'); + newHeight = editor.renderer.lineHeight * lines.length + 16; + let maxLineLength = 0; + lines.forEach((row) => { + const line = row.replace(/\t/g, ' ').replace(/\n/g, ''); + const lineLength = line.length; + maxLineLength = Math.max(maxLineLength, lineLength); + }); + if (options?.showGutter) { + maxLineLength += lines.length.toString().length; + } + newWidth = 10 * maxLineLength + 16; + if (options?.showGutter) { + newWidth += 32; + } + } + if (!options.ignoreHeight) { + renderer.setStyle(editorElement, 'height', newHeight.toString() + 'px'); + } + if (options.setMinHeight) { + renderer.setStyle(editorElement, 'minHeight', newHeight.toString() + 'px'); + } + if (!options.ignoreWidth) { + renderer.setStyle(editorElement, 'width', newWidth.toString() + 'px'); + } + editor.resize(); +} + export class Range implements Ace.Range { public start: Ace.Point; diff --git a/ui-ngx/src/app/shared/models/calculated-field.models.ts b/ui-ngx/src/app/shared/models/calculated-field.models.ts index 5f07374cf8..825c08a69f 100644 --- a/ui-ngx/src/app/shared/models/calculated-field.models.ts +++ b/ui-ngx/src/app/shared/models/calculated-field.models.ts @@ -79,6 +79,8 @@ export type CalculatedField = | CalculatedFieldRelatedEntityAggregation | CalculatedFieldAlarmRule; +export type CalculatedFieldInfo = CalculatedField & {entityName: string}; + export enum CalculatedFieldType { SIMPLE = 'SIMPLE', SCRIPT = 'SCRIPT', diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index a85c490c62..e023179dd3 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -1108,9 +1108,9 @@ "geofencing" : "Geofencing", "propagation": "Propagation", "related-entities-aggregation": "Related entities aggregation", - "related-entities-aggregation-hint": "Aggregation of data from related entities", + "related-entities-aggregation-hint": "Aggregation of data from related entities.", "time-series-data-aggregation": "Time series data aggregation", - "time-series-data-aggregation-hint": "Aggregation of historical data from a current entity" + "time-series-data-aggregation-hint": "Aggregation of historical data from a current entity." }, "arguments": "Arguments", "decimals-by-default": "Decimals by default", @@ -1287,9 +1287,9 @@ }, "aggregate-interval-type": "Aggregate interval type", "aggregate-interval-value": "Aggregate interval value", - "aggregate-interval-value-required": "Aggregate interval value is required", - "aggregate-interval-value-min": "Aggregate interval value should be at least { sec, plural, =0 {0 second} =1 {1 second} other {# seconds} }", - "aggregate-interval-value-step-multiple-of": "Aggregate interval value must be a divisor or multiple of 1 day", + "aggregate-interval-value-required": "Aggregate interval value is required.", + "aggregate-interval-value-min": "Aggregate interval value should be at least { sec, plural, =0 {0 second} =1 {1 second} other {# seconds} }.", + "aggregate-interval-value-step-multiple-of": "Aggregate interval value must be a divisor or multiple of 1 day.", "aggregate-period": { "hour": "Hour", "day": "Day", @@ -1301,23 +1301,23 @@ "custom": "Custom" }, "aggregate-period-hint-offset": "Your aggregation interval will be: {{ interval }}", - "aggregate-period-hint-offset-and-so-on": "Your aggregation interval will be: {{ interval }} and so on", + "aggregate-period-hint-offset-and-so-on": "Your aggregation interval will be: {{ interval }} and so on.", "entity-aggregation": { - "argument-hint": "Data will be fetched from current entity", + "argument-hint": "Data will be fetched from current entity.", "argument-setting-hint": "Latest telemetry is the only available argument type for this calculated field.", "aggregation-interval": "Aggregation interval", "aggregation-interval-hint": "Defines how often to perform aggregation. Example: every 1 hour aggregates data at 00:00, 01:00, 02:00, etc.", "apply-offset": "Apply offset to aggregation interval", "apply-offset-hint": "Defines how much to shift the start of each aggregation period (e.g., +10 minutes - 00:10, 01:10).", "offset-value": "Offset value", - "offset-value-required": "Offset value is required", - "offset-value-min": "Offset value must be a positive integer", - "offset-value-max": "Offset value should be less than the aggregate interval value", + "offset-value-required": "Offset value is required.", + "offset-value-min": "Offset value must be a positive integer.", + "offset-value-max": "Offset value should be less than the aggregate interval value.", "wait-delay": "Apply await timeout for delayed telemetry", "wait-delay-hint": "Defines how long to wait for delayed telemetry after the interval ends. If such telemetry arrives, the result for that interval will be recalculated.", "duration": "Duration", - "duration-required": "Duration is required", - "duration-min": "Duration should be at least 1 minute", + "duration-required": "Duration is required.", + "duration-min": "Duration should be at least 1 minute.", "duration-hint": "How long to wait for delayed data after the interval ends.", "produce-intermediate-result": "Produce intermediate result", "produce-intermediate-result-hint": "Calculates metrics during the current interval to produce an intermediate result. Updates occur no more often than once every {{ time }}." @@ -1488,7 +1488,7 @@ "alarm-rule-additional-info-hint": "Hint: use ${Argument name} to substitute values of the arguments that are used in alarm rule condition.", "alarm-rule-additional-info-icon-hint": "Use Argument name to substitute values of the arguments that are used in alarm rule condition.", "alarm-rule-mobile-dashboard": "Mobile dashboard", - "alarm-rule-mobile-dashboard-hint": "Used by mobile application as an alarm details dashboard", + "alarm-rule-mobile-dashboard-hint": "Used by mobile application as an alarm details dashboard.", "alarm-rule-no-mobile-dashboard": "No dashboard selected", "alarm-rule-condition": "Alarm rule condition", "enter-alarm-rule-condition-prompt": "Add condition", diff --git a/ui-ngx/src/form.scss b/ui-ngx/src/form.scss index f300b5e42b..517fc535fb 100644 --- a/ui-ngx/src/form.scss +++ b/ui-ngx/src/form.scss @@ -178,10 +178,11 @@ } &.tb-required::after { - font-size: 13px; - color: rgba(0, 0, 0, .54); + font-size: inherit; + color: inherit; vertical-align: top; - content: " *"; + content: "*"; + margin-left: 1px; } } .tb-form-panel-hint { @@ -298,10 +299,11 @@ margin: 8px 0; } .tb-required::after { - font-size: 13px; - color: rgba(0, 0, 0, .54); + font-size: inherit; + color: inherit; vertical-align: top; - content: " *"; + content: "*"; + margin-left: 1px; } }