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