Fix critical cell editor submit flow
This commit is contained in:
@@ -380,8 +380,8 @@
|
||||
return;
|
||||
}
|
||||
|
||||
editorModel = CriticalCellEditorModel.FromResponse(response);
|
||||
await LoadTableDetailAsync();
|
||||
await CloseCellEditorAsync();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
|
||||
@@ -17,166 +17,170 @@
|
||||
<button type="button" class="btn btn-link critical-editor-close" @onclick="OnClose">Close</button>
|
||||
</header>
|
||||
|
||||
@if (!string.IsNullOrWhiteSpace(ErrorMessage))
|
||||
{
|
||||
<p class="error-text">@ErrorMessage</p>
|
||||
}
|
||||
|
||||
@if (IsLoading)
|
||||
{
|
||||
<p class="muted">Loading editor...</p>
|
||||
<div class="critical-editor-body">
|
||||
<p class="muted">Loading editor...</p>
|
||||
</div>
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="critical-editor-body">
|
||||
<section class="critical-editor-section">
|
||||
<h4>Base Cell</h4>
|
||||
<div class="field-shell">
|
||||
<label>Raw Cell Text</label>
|
||||
<InputTextArea class="input-shell critical-editor-textarea tall" @bind-Value="Model.RawCellText" />
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Description / Prose</label>
|
||||
<InputTextArea class="input-shell critical-editor-textarea" @bind-Value="Model.DescriptionText" />
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Affix Text</label>
|
||||
<InputTextArea class="input-shell critical-editor-textarea compact" @bind-Value="Model.RawAffixText" />
|
||||
</div>
|
||||
<div class="form-grid">
|
||||
<div class="field-shell">
|
||||
<label>Parse Status</label>
|
||||
<InputText class="input-shell" @bind-Value="Model.ParseStatus" />
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Parsed Json</label>
|
||||
<InputTextArea class="input-shell critical-editor-textarea compact" @bind-Value="Model.ParsedJson" />
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="critical-editor-section">
|
||||
<div class="critical-editor-section-header">
|
||||
<h4>Base Effects</h4>
|
||||
<button type="button" class="btn-ritual" @onclick="AddBaseEffect">Add Effect</button>
|
||||
</div>
|
||||
@if (Model.Effects.Count == 0)
|
||||
<EditForm Model="Model" OnSubmit="HandleSubmitAsync">
|
||||
<div class="critical-editor-body">
|
||||
@if (!string.IsNullOrWhiteSpace(ErrorMessage))
|
||||
{
|
||||
<p class="muted">No normalized base effects for this cell.</p>
|
||||
<p class="error-text critical-editor-error">@ErrorMessage</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
@for (var index = 0; index < Model.Effects.Count; index++)
|
||||
{
|
||||
var effect = Model.Effects[index];
|
||||
<div class="critical-editor-card">
|
||||
<div class="critical-editor-card-header">
|
||||
<strong>Effect @(index + 1)</strong>
|
||||
<button type="button" class="btn btn-link" @onclick="() => RemoveBaseEffect(index)">Remove</button>
|
||||
</div>
|
||||
@EffectFields(effect)
|
||||
|
||||
<section class="critical-editor-section">
|
||||
<h4>Base Cell</h4>
|
||||
<div class="field-shell">
|
||||
<label>Raw Cell Text</label>
|
||||
<InputTextArea class="input-shell critical-editor-textarea tall" @bind-Value="Model.RawCellText" />
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Description / Prose</label>
|
||||
<InputText class="input-shell" @bind-Value="Model.DescriptionText" />
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Affix Text</label>
|
||||
<InputText class="input-shell" @bind-Value="Model.RawAffixText" />
|
||||
</div>
|
||||
<div class="form-grid">
|
||||
<div class="field-shell">
|
||||
<label>Parse Status</label>
|
||||
<InputText class="input-shell" @bind-Value="Model.ParseStatus" />
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</section>
|
||||
<div class="field-shell">
|
||||
<label>Parsed Json</label>
|
||||
<InputTextArea class="input-shell critical-editor-textarea json" @bind-Value="Model.ParsedJson" />
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="critical-editor-section">
|
||||
<div class="critical-editor-section-header">
|
||||
<h4>Branches</h4>
|
||||
<button type="button" class="btn-ritual" @onclick="AddBranch">Add Branch</button>
|
||||
</div>
|
||||
@if (Model.Branches.Count == 0)
|
||||
{
|
||||
<p class="muted">No branch records on this cell.</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
@for (var index = 0; index < Model.Branches.Count; index++)
|
||||
<section class="critical-editor-section">
|
||||
<div class="critical-editor-section-header">
|
||||
<h4>Base Effects</h4>
|
||||
<button type="button" class="btn-ritual" @onclick="AddBaseEffect">Add Effect</button>
|
||||
</div>
|
||||
@if (Model.Effects.Count == 0)
|
||||
{
|
||||
var branch = Model.Branches[index];
|
||||
<div class="critical-editor-card branch-card-editor">
|
||||
<div class="critical-editor-card-header">
|
||||
<strong>Branch @(index + 1)</strong>
|
||||
<button type="button" class="btn btn-link" @onclick="() => RemoveBranch(index)">Remove</button>
|
||||
</div>
|
||||
<div class="form-grid">
|
||||
<div class="field-shell">
|
||||
<label>Branch Kind</label>
|
||||
<InputText class="input-shell" @bind-Value="branch.BranchKind" />
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Condition Key</label>
|
||||
<InputText class="input-shell" @bind-Value="branch.ConditionKey" />
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Sort Order</label>
|
||||
<InputNumber TValue="int" class="input-shell" @bind-Value="branch.SortOrder" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Condition Text</label>
|
||||
<InputTextArea class="input-shell critical-editor-textarea compact" @bind-Value="branch.ConditionText" />
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Raw Text</label>
|
||||
<InputTextArea class="input-shell critical-editor-textarea" @bind-Value="branch.RawText" />
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Description / Prose</label>
|
||||
<InputTextArea class="input-shell critical-editor-textarea" @bind-Value="branch.DescriptionText" />
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Affix Text</label>
|
||||
<InputTextArea class="input-shell critical-editor-textarea compact" @bind-Value="branch.RawAffixText" />
|
||||
</div>
|
||||
<div class="form-grid">
|
||||
<div class="field-shell">
|
||||
<label>Condition Json</label>
|
||||
<InputTextArea class="input-shell critical-editor-textarea compact" @bind-Value="branch.ConditionJson" />
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Parsed Json</label>
|
||||
<InputTextArea class="input-shell critical-editor-textarea compact" @bind-Value="branch.ParsedJson" />
|
||||
<p class="muted">No normalized base effects for this cell.</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
@for (var index = 0; index < Model.Effects.Count; index++)
|
||||
{
|
||||
var effect = Model.Effects[index];
|
||||
<div class="critical-editor-card">
|
||||
<div class="critical-editor-card-header">
|
||||
<strong>Effect @(index + 1)</strong>
|
||||
<button type="button" class="btn btn-link" @onclick="() => RemoveBaseEffect(index)">Remove</button>
|
||||
</div>
|
||||
@EffectFields(effect)
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</section>
|
||||
|
||||
<div class="critical-editor-subsection">
|
||||
<div class="critical-editor-section-header">
|
||||
<h5>Branch Effects</h5>
|
||||
<button type="button" class="btn-ritual" @onclick="() => AddBranchEffect(branch)">Add Effect</button>
|
||||
<section class="critical-editor-section">
|
||||
<div class="critical-editor-section-header">
|
||||
<h4>Branches</h4>
|
||||
<button type="button" class="btn-ritual" @onclick="AddBranch">Add Branch</button>
|
||||
</div>
|
||||
@if (Model.Branches.Count == 0)
|
||||
{
|
||||
<p class="muted">No branch records on this cell.</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
@for (var index = 0; index < Model.Branches.Count; index++)
|
||||
{
|
||||
var branch = Model.Branches[index];
|
||||
<div class="critical-editor-card branch-card-editor">
|
||||
<div class="critical-editor-card-header">
|
||||
<strong>Branch @(index + 1)</strong>
|
||||
<button type="button" class="btn btn-link" @onclick="() => RemoveBranch(index)">Remove</button>
|
||||
</div>
|
||||
@if (branch.Effects.Count == 0)
|
||||
{
|
||||
<p class="muted">No normalized branch effects.</p>
|
||||
}
|
||||
else
|
||||
{
|
||||
@for (var effectIndex = 0; effectIndex < branch.Effects.Count; effectIndex++)
|
||||
<div class="form-grid">
|
||||
<div class="field-shell">
|
||||
<label>Branch Kind</label>
|
||||
<InputText class="input-shell" @bind-Value="branch.BranchKind" />
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Condition Key</label>
|
||||
<InputText class="input-shell" @bind-Value="branch.ConditionKey" />
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Sort Order</label>
|
||||
<InputNumber TValue="int" class="input-shell" @bind-Value="branch.SortOrder" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Condition Text</label>
|
||||
<InputText class="input-shell" @bind-Value="branch.ConditionText" />
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Raw Text</label>
|
||||
<InputTextArea class="input-shell critical-editor-textarea" @bind-Value="branch.RawText" />
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Description / Prose</label>
|
||||
<InputText class="input-shell" @bind-Value="branch.DescriptionText" />
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Affix Text</label>
|
||||
<InputText class="input-shell" @bind-Value="branch.RawAffixText" />
|
||||
</div>
|
||||
<div class="form-grid">
|
||||
<div class="field-shell">
|
||||
<label>Condition Json</label>
|
||||
<InputTextArea class="input-shell critical-editor-textarea compact" @bind-Value="branch.ConditionJson" />
|
||||
</div>
|
||||
<div class="field-shell">
|
||||
<label>Parsed Json</label>
|
||||
<InputTextArea class="input-shell critical-editor-textarea json" @bind-Value="branch.ParsedJson" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="critical-editor-subsection">
|
||||
<div class="critical-editor-section-header">
|
||||
<h5>Branch Effects</h5>
|
||||
<button type="button" class="btn-ritual" @onclick="() => AddBranchEffect(branch)">Add Effect</button>
|
||||
</div>
|
||||
@if (branch.Effects.Count == 0)
|
||||
{
|
||||
var effect = branch.Effects[effectIndex];
|
||||
<div class="critical-editor-card nested">
|
||||
<div class="critical-editor-card-header">
|
||||
<strong>Branch Effect @(effectIndex + 1)</strong>
|
||||
<button type="button" class="btn btn-link" @onclick="() => RemoveBranchEffect(branch, effectIndex)">Remove</button>
|
||||
</div>
|
||||
@EffectFields(effect)
|
||||
</div>
|
||||
<p class="muted">No normalized branch effects.</p>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@for (var effectIndex = 0; effectIndex < branch.Effects.Count; effectIndex++)
|
||||
{
|
||||
var effect = branch.Effects[effectIndex];
|
||||
<div class="critical-editor-card nested">
|
||||
<div class="critical-editor-card-header">
|
||||
<strong>Branch Effect @(effectIndex + 1)</strong>
|
||||
<button type="button" class="btn btn-link" @onclick="() => RemoveBranchEffect(branch, effectIndex)">Remove</button>
|
||||
</div>
|
||||
@EffectFields(effect)
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
}
|
||||
</section>
|
||||
</div>
|
||||
}
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<footer class="critical-editor-footer">
|
||||
<button type="button" class="btn btn-link" @onclick="OnClose" disabled="@IsSaving">Cancel</button>
|
||||
<button type="button" class="btn-ritual" @onclick="OnSave" disabled="@IsLoading || IsSaving">
|
||||
@(IsSaving ? "Saving..." : "Save Cell")
|
||||
</button>
|
||||
</footer>
|
||||
<footer class="critical-editor-footer">
|
||||
<button type="button" class="btn btn-link" @onclick="OnClose" disabled="@IsSaving">Cancel</button>
|
||||
<button type="submit" class="btn-ritual" disabled="@IsSaving">
|
||||
@(IsSaving ? "Saving..." : "Save Cell")
|
||||
</button>
|
||||
</footer>
|
||||
</EditForm>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
@@ -205,6 +209,11 @@
|
||||
await OnClose.InvokeAsync();
|
||||
}
|
||||
|
||||
private async Task HandleSubmitAsync(EditContext _)
|
||||
{
|
||||
await OnSave.InvokeAsync();
|
||||
}
|
||||
|
||||
private void AddBaseEffect()
|
||||
{
|
||||
Model?.Effects.Add(new CriticalEffectEditorModel());
|
||||
|
||||
@@ -710,10 +710,22 @@ textarea {
|
||||
min-height: 4.5rem;
|
||||
}
|
||||
|
||||
.critical-editor-textarea.json {
|
||||
min-height: 12rem;
|
||||
}
|
||||
|
||||
.critical-editor-textarea.tall {
|
||||
min-height: 10rem;
|
||||
}
|
||||
|
||||
.critical-editor-error {
|
||||
margin: 0;
|
||||
padding: 0.85rem 0.95rem;
|
||||
border-radius: 14px;
|
||||
background: rgba(141, 43, 30, 0.08);
|
||||
border: 1px solid rgba(141, 43, 30, 0.18);
|
||||
}
|
||||
|
||||
.critical-editor-checkbox {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
|
||||
Reference in New Issue
Block a user