19 lines
1.3 KiB
Plaintext
19 lines
1.3 KiB
Plaintext
@page "/"
|
|
@rendermode InteractiveServer
|
|
@implements IDisposable
|
|
@inject FixtureSession Session
|
|
@inject FixtureRegistry Registry
|
|
@{var target=Session.Target;}
|
|
<h1>Local synthetic CSV import fixture</h1>
|
|
<p>Loopback-only. Uploaded files are parsed locally; commits are fabricated in-memory results. No database, driver or operational service writes.</p>
|
|
<button type="button" id="open" @onclick="()=>_visible=true">Open synthetic import</button><button type="button" id="outside">Outside fixture control</button>
|
|
<output id="ready">@(_ready?"ready":"loading")</output><output id="session">@Session.Id</output>
|
|
<RawCsvImportModal Visible="_visible" DeviceId="@target" TagGroupId="@("group-"+target)" DriverType="Modbus" OnSaved="()=>Saved(target)" VisibleChanged="value=>Closed(value,target)" />
|
|
@code{
|
|
private bool _visible,_ready;
|
|
protected override void OnAfterRender(bool first){if(first){Registry.Sessions.TryAdd(Session.Id,Session);Session.Changed=()=>InvokeAsync(StateHasChanged);_ready=true;StateHasChanged();}}
|
|
private Task Saved(string target){Session.Saved.Enqueue(target);return Task.CompletedTask;}
|
|
private Task Closed(bool value,string target){Session.Closed.Enqueue(target);if(Session.Target==target)_visible=value;return Task.CompletedTask;}
|
|
public void Dispose(){Session.Changed=null;Registry.Sessions.TryRemove(Session.Id,out _);}
|
|
}
|