refactor(adminui): retire generic DriverEdit.razor
All 9 driver types now have typed pages; DriverEditRouter dispatches to them directly. Unknown DriverType strings (e.g. legacy rows) render an explicit error notice instead of falling through to a generic editor — the failure mode is now visible, not silent.
This commit is contained in:
+16
-5
@@ -26,9 +26,22 @@ else if (_existing is null)
|
||||
Driver instance <span class="mono">@DriverInstanceId</span> was not found in cluster <span class="mono">@ClusterId</span>.
|
||||
</section>
|
||||
}
|
||||
else if (ResolveComponentType() is { } pageType)
|
||||
{
|
||||
<DynamicComponent Type="pageType" Parameters="BuildParameters()" />
|
||||
}
|
||||
else
|
||||
{
|
||||
<DynamicComponent Type="ResolveComponentType()" Parameters="BuildParameters()" />
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<h4 class="mb-0">Edit driver instance · <span class="mono">@ClusterId</span></h4>
|
||||
<a href="/clusters/@ClusterId/drivers" class="btn btn-outline-secondary btn-sm">Cancel</a>
|
||||
</div>
|
||||
<ClusterNav ClusterId="@ClusterId" ActiveTab="drivers" />
|
||||
<section class="panel notice rise" style="animation-delay:.02s; border-color:var(--alert)">
|
||||
Driver instance <span class="mono">@DriverInstanceId</span> has an unknown <code>DriverType</code> value of
|
||||
<strong><span class="mono">@_existing.DriverType</span></strong>. No editor is registered for this type.
|
||||
Likely causes: the row was written by a newer build, or the type-string was corrupted in the database.
|
||||
</section>
|
||||
}
|
||||
|
||||
@code {
|
||||
@@ -60,10 +73,8 @@ else
|
||||
_loaded = true;
|
||||
}
|
||||
|
||||
private Type ResolveComponentType()
|
||||
=> _componentMap.TryGetValue(_existing!.DriverType, out var t)
|
||||
? t
|
||||
: typeof(ZB.MOM.WW.OtOpcUa.AdminUI.Components.Pages.Clusters.DriverEdit);
|
||||
private Type? ResolveComponentType()
|
||||
=> _componentMap.TryGetValue(_existing!.DriverType, out var t) ? t : null;
|
||||
|
||||
private IDictionary<string, object> BuildParameters()
|
||||
=> new Dictionary<string, object>
|
||||
|
||||
Reference in New Issue
Block a user