Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

UI update: Minor fix for or-rules config includeAssets

Rich Turner8da313bdad96
diff --git a/manager/src/main/java/org/openremote/manager/rules/RulesService.java b/manager/src/main/java/org/openremote/manager/rules/RulesService.java
index fc3d2fd25..2d7373e09 100644
--- a/manager/src/main/java/org/openremote/manager/rules/RulesService.java
+++ b/manager/src/main/java/org/openremote/manager/rules/RulesService.java
@@ -409,7 +409,7 @@ public class RulesService extends RouteBuilder implements ContainerService, Asse
// Nothing to do here
return;
}
-
+i
if (wasEnabled) {
// Remove tenant rules engine for this tenant if it exists
RulesEngine<TenantRuleset> tenantRulesEngine = tenantEngines.get(tenant.getRealm());
diff --git a/ui/component/or-rules/src/index.ts b/ui/component/or-rules/src/index.ts
index e9a8dede0..e6a5db645 100644
--- a/ui/component/or-rules/src/index.ts
+++ b/ui/component/or-rules/src/index.ts
@@ -226,17 +226,21 @@ export function getAssetInfos(config: RulesConfig | undefined, useActionConfig:
const section = useActionConfig ? config.descriptors.action : config.descriptors.when;
- if (section && section.includeAssets) {
- allowedAssetTypes = allowedAssetTypes.concat(section.includeAssets);
- }
+ if ((section && section.includeAssets) || (config.descriptors.all && config.descriptors.all.includeAssets)) {
+ allowedAssetTypes = [];
+
+ if (section && section.includeAssets) {
+ allowedAssetTypes = [...section.includeAssets];
+ }
- if (config.descriptors.all && config.descriptors.all.includeAssets) {
- allowedAssetTypes = allowedAssetTypes.concat(config.descriptors.all.includeAssets);
+ if (config.descriptors.all && config.descriptors.all.includeAssets) {
+ allowedAssetTypes = [...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);
}