Skip to content

Commit 4e89c24

Browse files
solving merge conflict on dev - feature
2 parents a8ec127 + 0c28487 commit 4e89c24

File tree

7 files changed

+52
-130
lines changed

7 files changed

+52
-130
lines changed

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.13.2
1+
5.13.3

src/Moryx.AbstractionLayer.Products.Endpoints/HubMiddlewareExtension.cs

-88
This file was deleted.

src/Moryx.AbstractionLayer.Products.Endpoints/ProductManagementController.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
using System.Net;
1515
using Moryx.AbstractionLayer.Properties;
1616
using Moryx.Asp.Extensions.Exception;
17-
17+
using Moryx.Configuration;
1818
namespace Moryx.AbstractionLayer.Products.Endpoints
1919
{
2020
/// <summary>
@@ -45,7 +45,7 @@ public ActionResult<ProductCustomization> GetProductCustomization()
4545
Importers = _productManagement.Importers.Select(i => new ProductImporter
4646
{
4747
Name = i.Key,
48-
Parameters = EntryConvert.EncodeObject(i.Value)
48+
Parameters = EntryConvert.EncodeObject(i.Value, new PossibleValuesSerialization(null, new ValueProviderExecutor(new ValueProviderExecutorSettings().AddDefaultValueProvider())))
4949
}).ToArray()
5050
};
5151
}

src/Moryx.AbstractionLayer.Products.Endpoints/ProductManagementHub.cs

-30
This file was deleted.

src/Moryx.Products.UI.Interaction/Products/Import/ImporterViewModel.cs

+48-1
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
// Copyright (c) 2020, Phoenix Contact GmbH & Co. KG
22
// Licensed under the Apache License, Version 2.0
33

4+
using System;
45
using System.ComponentModel;
6+
using System.Configuration;
57
using System.Linq;
68
using System.Threading.Tasks;
79
using Caliburn.Micro;
810
using Moryx.Controls;
911
using Moryx.Products.UI.ProductService;
1012
using Moryx.Tools;
13+
using EntryValueType = Moryx.Serialization.EntryValueType;
1114

1215
namespace Moryx.Products.UI.Interaction
1316
{
@@ -81,8 +84,52 @@ public EntryViewModel Parameters
8184

8285
public bool ValidateInput()
8386
{
84-
return Parameters.SubEntries.All(se => !se.Entry.Validation.IsRequired || !string.IsNullOrWhiteSpace(se.Value));
87+
foreach (var subEntry in Parameters.SubEntries)
88+
{
89+
if (!ValidateEntry(subEntry))
90+
return false;
91+
}
92+
return true;
93+
}
94+
95+
private bool ValidateEntry(EntryViewModel entryViewModel)
96+
{
97+
if (!entryViewModel.Entry.Validation.IsRequired)
98+
return true;
99+
100+
switch (entryViewModel.ValueType)
101+
{
102+
case EntryValueType.Class:
103+
case EntryValueType.Collection:
104+
case EntryValueType.Exception:
105+
case EntryValueType.Stream:
106+
foreach (var subEntry in entryViewModel.SubEntries)
107+
{
108+
if (!ValidateEntry(subEntry))
109+
return false;
110+
}
111+
break;
112+
default: // all value types
113+
if (string.IsNullOrWhiteSpace(entryViewModel.Value))
114+
return false;
115+
116+
if (entryViewModel.Entry.Validation.Regex != null)
117+
{
118+
var validator = new RegexStringValidator(entryViewModel.Entry.Validation.Regex);
119+
try
120+
{
121+
validator.Validate(entryViewModel.Value);
122+
}
123+
catch (ArgumentException exception)
124+
{
125+
return false;
126+
}
127+
}
128+
break;
129+
}
130+
return true;
85131
}
132+
86133

87134
/// <summary>
88135
/// Import product using the current values

src/StartProject.Asp/StartProject.Asp.csproj

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
</PropertyGroup>
77

88
<ItemGroup>
9-
<PackageReference Include="Microsoft.AspNetCore.SignalR.Core" Version="1.1.0" />
109
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.2.3" />
1110
<PackageReference Include="Moryx.Runtime.Kernel" />
1211
<PackageReference Include="Moryx.Asp.Extensions" />

src/StartProject.Asp/Startup.cs

+1-7
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ public void ConfigureServices(IServiceCollection services)
3535
.AllowCredentials());
3636
});
3737

38-
services.AddSignalR();
39-
// Add MORYX SignalR hubs
40-
services.AddMoryxProductManagementHub();
4138
services.AddControllers()
4239
.AddJsonOptions(jo => jo.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()));
4340

@@ -69,10 +66,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
6966
if (env.IsDevelopment())
7067
app.UseCors("CorsPolicy");
7168
app.UseAuthorization();
72-
73-
// Add MORYX SignalR hubs
74-
app.UseMoryxProductManagementHub();
75-
69+
7670
app.UseEndpoints(endpoints =>
7771
{
7872
endpoints.MapControllers();

0 commit comments

Comments
 (0)