fix(adminui): Heidenhain authoring UX — CSV preview runs the save-path row rule, dictated data type is locked, credential error shown once (#830)
- RawTagRowRules: the ONE driver-dispatched authority on Tag-ROW rules (access level / Tag.DataType). RawTreeService's save path, the CSV import's staged review grid (RawTagCsvMapper) and the manual-entry grid all call it; no call site names a driver. A ReadWrite or mistyped Heidenhain row is now invalid IN THE PREVIEW instead of only at Commit. - Manual-entry grid + tag modal: when the driver dictates the data type for the row's address (RawTagRowDefaults.DictatedDataType), the field is a locked read-only value instead of a select that commit silently replaced; the grid runs the row rule client-side and no longer rewrites the row at commit. - Driver/device modals: the credential refusal is shown once (the modal's save-gate notice); HeidenhainDriverFormModel / HeidenhainDeviceModel.Validate report only ranges / endpoint. - docs/drivers/Heidenhain.md: #831 alarm conditions + rediscovery, #830 authoring behaviour. Tests: HeidenhainAuthoringUxTests (CSV preview == ImportTagsAsync row-for-row, dictated type is what the save path accepts, single credential surface, ALARM: seeding, CSV alarm rows, AlarmMs round-trip); HeidenhainAuthoringTests updated for the single-notice rule.
This commit is contained in:
+6
-4
@@ -42,12 +42,14 @@ public sealed class HeidenhainDeviceModel
|
||||
return TagConfigJson.Serialize(_bag);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The endpoint's verdict (host / port). Credential fields are deliberately NOT reported here (lmxopcua#830):
|
||||
/// the hosting <c>DeviceModal</c> shows the save gate's refusal (<c>DriverConfigSaveGate</c>, which covers every
|
||||
/// password field) once and disables Save — reporting it here too printed the same error twice.
|
||||
/// </summary>
|
||||
public string? Validate()
|
||||
{
|
||||
var errors = HeidenhainOptionsParser.ValidateDevice(new HeidenhainDeviceOptions { Host = Host.Trim(), Port = Port }).ToList();
|
||||
foreach (var (name, v) in new[] { ("INSPECT", InspectPassword), ("DNC", DncPassword), ("DATA", DataPassword) })
|
||||
if (!HeidenhainOptionsParser.IsCredentialReference(Blank(v)))
|
||||
errors.Add($"{name} password must be blank, secret:heidenhain/<name> or env:OTOPCUA_HEIDENHAIN_<NAME> — never a literal.");
|
||||
var errors = HeidenhainOptionsParser.ValidateDevice(new HeidenhainDeviceOptions { Host = Host.Trim(), Port = Port });
|
||||
return errors.Count == 0 ? null : string.Join(" ", errors);
|
||||
}
|
||||
|
||||
|
||||
+24
-9
@@ -49,13 +49,23 @@
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-select form-select-sm" value="@row.DataType"
|
||||
@onchange="@(e => row.DataType = e.Value?.ToString() ?? "Float")">
|
||||
@foreach (var dt in DataTypes)
|
||||
{
|
||||
<option value="@dt">@dt</option>
|
||||
}
|
||||
</select>
|
||||
@if (RawTagRowDefaults.DictatedDataType(DriverType, row.TagConfig) is { } dictated)
|
||||
{
|
||||
@* lmxopcua#830: the driver dictates the type for this address — show it, locked,
|
||||
rather than offer a choice the commit would replace. *@
|
||||
<input class="form-control form-control-sm mono" value="@dictated" disabled readonly
|
||||
title="Set by the address — the driver publishes this type" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<select class="form-select form-select-sm" value="@row.DataType"
|
||||
@onchange="@(e => row.DataType = e.Value?.ToString() ?? "Float")">
|
||||
@foreach (var dt in DataTypes)
|
||||
{
|
||||
<option value="@dt">@dt</option>
|
||||
}
|
||||
</select>
|
||||
}
|
||||
</td>
|
||||
<td>
|
||||
<select class="form-select form-select-sm" value="@row.AccessLevel"
|
||||
@@ -246,7 +256,13 @@
|
||||
if (nameError is not null) { row.Error = nameError; anyClientError = true; continue; }
|
||||
if (!seen.Add(row.Name)) { row.Error = "Duplicate name in this batch."; anyClientError = true; continue; }
|
||||
var configError = TagConfigValidator.Validate(DriverType, row.TagConfig);
|
||||
if (configError is not null) { row.Error = configError; anyClientError = true; }
|
||||
if (configError is not null) { row.Error = configError; anyClientError = true; continue; }
|
||||
// The dictated fields are locked to the driver's values (applied on every config edit), so this
|
||||
// re-application changes nothing the operator could see; the row rule then runs exactly as the
|
||||
// server's will — a mismatch is SHOWN, never silently rewritten.
|
||||
RawTagRowDefaults.Apply(DriverType, row.TagConfig, a => row.AccessLevel = a, d => row.DataType = d);
|
||||
var rowError = RawTagRowRules.Problem(DriverType, row.AccessLevel, row.DataType, row.TagConfig);
|
||||
if (rowError is not null) { row.Error = rowError; anyClientError = true; }
|
||||
}
|
||||
if (anyClientError)
|
||||
{
|
||||
@@ -260,7 +276,6 @@
|
||||
var failed = 0;
|
||||
foreach (var row in _rows)
|
||||
{
|
||||
RawTagRowDefaults.Apply(DriverType, row.TagConfig, a => row.AccessLevel = a, d => row.DataType = d);
|
||||
var input = new RawTagInput(
|
||||
row.Name,
|
||||
row.DataType,
|
||||
|
||||
@@ -46,12 +46,21 @@
|
||||
</div>
|
||||
<div class="col-md-6 mb-3">
|
||||
<label class="form-label" for="raw-tag-dtype">Data type</label>
|
||||
<InputSelect id="raw-tag-dtype" @bind-Value="_form.DataType" class="form-select form-select-sm">
|
||||
@foreach (var dt in DataTypes)
|
||||
{
|
||||
<option value="@dt">@dt</option>
|
||||
}
|
||||
</InputSelect>
|
||||
@if (RawTagRowDefaults.DictatedDataType(DriverType, _form.TagConfig) is { } dictated)
|
||||
{
|
||||
@* lmxopcua#830: locked to what the driver publishes for this address. *@
|
||||
<input id="raw-tag-dtype" class="form-control form-control-sm mono" value="@dictated" disabled readonly />
|
||||
<div class="form-text">Set by the address.</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<InputSelect id="raw-tag-dtype" @bind-Value="_form.DataType" class="form-select form-select-sm">
|
||||
@foreach (var dt in DataTypes)
|
||||
{
|
||||
<option value="@dt">@dt</option>
|
||||
}
|
||||
</InputSelect>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
Reference in New Issue
Block a user