diff --git a/src/Gateway.Api/Services/GatewayStore.BulkMappings.cs b/src/Gateway.Api/Services/GatewayStore.BulkMappings.cs index cfb3342..2abcc5b 100644 --- a/src/Gateway.Api/Services/GatewayStore.BulkMappings.cs +++ b/src/Gateway.Api/Services/GatewayStore.BulkMappings.cs @@ -20,9 +20,9 @@ public sealed partial class GatewayStore { public BulkMappingResult CreateBulkMappings(BulkMappingRequest request) { - if (request.SourcePointIds is not { Length: >= 1 and <= 500 } || request.SourcePointIds.Distinct().Count() != request.SourcePointIds.Length || + if (request.SourcePointIds is not { Length: > 0 } || request.SourcePointIds.Distinct().Count() != request.SourcePointIds.Length || !Enum.IsDefined(request.Target)) - throw new DomainValidationException("Bitte 1 bis 500 verschiedene Datenpunkte und ein gültiges Ziel auswählen."); + throw new DomainValidationException("Bitte Datenpunkte ohne Duplikate und ein gültiges Ziel auswählen."); using var connection = _database.OpenConnection(); using var transaction = connection.BeginTransaction(); diff --git a/src/Gateway.Api/wwwroot/index.html b/src/Gateway.Api/wwwroot/index.html index 95af058..3a3a36a 100644 --- a/src/Gateway.Api/wwwroot/index.html +++ b/src/Gateway.Api/wwwroot/index.html @@ -20,7 +20,7 @@ - + diff --git a/src/Gateway.Api/wwwroot/mapping-batch.js b/src/Gateway.Api/wwwroot/mapping-batch.js index 1053149..67046c7 100644 --- a/src/Gateway.Api/wwwroot/mapping-batch.js +++ b/src/Gateway.Api/wwwroot/mapping-batch.js @@ -156,7 +156,6 @@ function bindMappingBatch() { form.addEventListener('submit', async event => { event.preventDefault(); if (running || selected.size === 0) return; - if (selected.size > 500) { message.textContent = 'Maximal 500 Datenpunkte pro Sammelmapping.'; return; } const fields = new FormData(form); const mqtt = target.value === 'Mqtt'; const monitoring = mqtt && fields.has('seMonitoring'); diff --git a/tests/Gateway.SmokeTests/Program.cs b/tests/Gateway.SmokeTests/Program.cs index 3fc1fe6..74f44a6 100644 --- a/tests/Gateway.SmokeTests/Program.cs +++ b/tests/Gateway.SmokeTests/Program.cs @@ -361,6 +361,13 @@ Assert(store.ListPoints().All(point => point.Id != sampledSourcePoint.Id) && store.ListTrendRecords(sampledLog.Id, 10).Count == 2, "Removing a point must stop logging and preserve the history."); await LtdFeatureTests.RunAsync(store, database, options, authenticatedAdmin!); + +var bulkSources = Enumerable.Range(1, 501).Select(index => store.CreatePoint(new( + $"Bulk source {index}", PointProtocol.Internal, PointScope.Internal, "Boolean", true, false, null, JsonElementFor("{}"))).Id).ToArray(); +var largeMapping = store.CreateBulkMappings(new(bulkSources, BulkMappingTarget.OpcUa)); +Assert(largeMapping is { Created: 501, Existing: 0 } && largeMapping.Assignments.Count == 501, + "A single bulk mapping must accept a selection beyond the former 500-point limit."); + Console.WriteLine("Gateway smoke tests passed."); if (args.Contains("--preview", StringComparer.Ordinal)) Console.WriteLine($"Preview data: {dataDirectory}");