fix(adminui): canonicalize Modbus driver-type string on "Modbus" (was ModbusTcp)
This commit is contained in:
+1
-1
@@ -52,7 +52,7 @@ else
|
||||
private static readonly IReadOnlyDictionary<string, Type> _componentMap =
|
||||
new Dictionary<string, Type>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["ModbusTcp"] = typeof(ModbusDriverPage),
|
||||
["Modbus"] = typeof(ModbusDriverPage),
|
||||
["AbCip"] = typeof(AbCipDriverPage),
|
||||
["AbLegacy"] = typeof(AbLegacyDriverPage),
|
||||
["S7"] = typeof(S7DriverPage),
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@
|
||||
|
||||
private static readonly IReadOnlyList<DriverTypeEntry> _types = new[]
|
||||
{
|
||||
new DriverTypeEntry("ModbusTcp", "modbustcp", "[M]", "Modbus/TCP — generic registers/coils via port 502."),
|
||||
new DriverTypeEntry("Modbus TCP", "modbustcp", "[M]", "Modbus/TCP — generic registers/coils via port 502."),
|
||||
new DriverTypeEntry("AbCip", "abcip", "[CIP]", "Allen-Bradley CompactLogix/ControlLogix via CIP."),
|
||||
new DriverTypeEntry("AbLegacy", "ablegacy", "[AB]", "Allen-Bradley PLC-5/SLC-500/MicroLogix via DF1."),
|
||||
new DriverTypeEntry("S7", "s7", "[S7]", "Siemens S7-300/400/1200/1500 via ISO-on-TCP."),
|
||||
|
||||
+1
-1
@@ -321,7 +321,7 @@ else
|
||||
[Parameter] public string ClusterId { get; set; } = "";
|
||||
[Parameter] public string? DriverInstanceId { get; set; }
|
||||
|
||||
private const string DriverTypeKey = "ModbusTcp";
|
||||
private const string DriverTypeKey = "Modbus";
|
||||
|
||||
private bool IsNew => string.IsNullOrEmpty(DriverInstanceId);
|
||||
|
||||
|
||||
+2
-2
@@ -28,7 +28,7 @@
|
||||
<label class="form-label" for="dtype">Driver type</label>
|
||||
<InputSelect id="dtype" @bind-Value="Model.DriverType" disabled="@(!IsNew)"
|
||||
class="form-select form-select-sm">
|
||||
<option value="ModbusTcp">ModbusTcp</option>
|
||||
<option value="Modbus">Modbus TCP</option>
|
||||
<option value="AbCip">AbCip</option>
|
||||
<option value="AbLegacy">AbLegacy</option>
|
||||
<option value="S7">S7</option>
|
||||
@@ -73,7 +73,7 @@
|
||||
[Required, RegularExpression("^[A-Za-z0-9_-]+$", ErrorMessage = "Use letters, digits, dash, underscore.")]
|
||||
public string DriverInstanceId { get; set; } = "";
|
||||
[Required] public string Name { get; set; } = "";
|
||||
[Required] public string DriverType { get; set; } = "ModbusTcp";
|
||||
[Required] public string DriverType { get; set; } = "Modbus";
|
||||
[Required] public string NamespaceId { get; set; } = "";
|
||||
public bool Enabled { get; set; } = true;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ public static class TagConfigEditorMap
|
||||
private static readonly IReadOnlyDictionary<string, Type> Map =
|
||||
new Dictionary<string, Type>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["ModbusTcp"] = typeof(Components.Shared.Uns.TagEditors.ModbusTagConfigEditor),
|
||||
["Modbus"] = typeof(Components.Shared.Uns.TagEditors.ModbusTagConfigEditor),
|
||||
["S7"] = typeof(Components.Shared.Uns.TagEditors.S7TagConfigEditor),
|
||||
["AbCip"] = typeof(Components.Shared.Uns.TagEditors.AbCipTagConfigEditor),
|
||||
["AbLegacy"] = typeof(Components.Shared.Uns.TagEditors.AbLegacyTagConfigEditor),
|
||||
|
||||
@@ -12,7 +12,7 @@ public static class TagConfigValidator
|
||||
private static readonly IReadOnlyDictionary<string, Func<string?, string?>> Validators =
|
||||
new Dictionary<string, Func<string?, string?>>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["ModbusTcp"] = j => ModbusTagConfigModel.FromJson(j).Validate(),
|
||||
["Modbus"] = j => ModbusTagConfigModel.FromJson(j).Validate(),
|
||||
["S7"] = j => S7TagConfigModel.FromJson(j).Validate(),
|
||||
["AbCip"] = j => AbCipTagConfigModel.FromJson(j).Validate(),
|
||||
["AbLegacy"] = j => AbLegacyTagConfigModel.FromJson(j).Validate(),
|
||||
|
||||
Reference in New Issue
Block a user