refactor(ui/templates): drop the "Show derived" toggle
Derived templates are slot-owned and reached only via their owning parent's composition leaf in the tree — there's no scenario where listing them as standalone root nodes is useful, so the toggle was dead UI. Remove the form-switch, the _showDerived state, and the OnToggleShowDerived handler; BuildTemplateTree filters derived templates out unconditionally.
This commit is contained in:
@@ -69,14 +69,6 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="form-check form-switch d-flex align-items-center gap-2 mb-0"
|
||||
title="Derived templates back individual composition slots and are normally hidden.">
|
||||
<input class="form-check-input" type="checkbox" role="switch"
|
||||
id="show-derived-toggle"
|
||||
checked="@_showDerived"
|
||||
@onchange="OnToggleShowDerived" />
|
||||
<label class="form-check-label small text-muted" for="show-derived-toggle">Show derived</label>
|
||||
</div>
|
||||
<button class="btn btn-outline-secondary btn-sm"
|
||||
title="New folder at root"
|
||||
@onclick="() => OpenNewFolderDialog(null)">+ Folder</button>
|
||||
@@ -117,7 +109,6 @@
|
||||
|
||||
private List<Template> _templates = new();
|
||||
private List<TemplateFolder> _folders = new();
|
||||
private bool _showDerived;
|
||||
|
||||
private bool _loading = true;
|
||||
private string? _errorMessage;
|
||||
@@ -129,12 +120,6 @@
|
||||
await LoadTemplatesAsync();
|
||||
}
|
||||
|
||||
private void OnToggleShowDerived(ChangeEventArgs e)
|
||||
{
|
||||
_showDerived = e.Value is bool b && b;
|
||||
BuildTemplateTree();
|
||||
}
|
||||
|
||||
private async Task LoadTemplatesAsync()
|
||||
{
|
||||
_loading = true;
|
||||
@@ -193,11 +178,10 @@
|
||||
roots.Add(node);
|
||||
}
|
||||
|
||||
// 3. Template nodes with composition leaves
|
||||
var visibleTemplates = _showDerived
|
||||
? _templates
|
||||
: _templates.Where(t => !t.IsDerived);
|
||||
foreach (var t in visibleTemplates.OrderBy(t => t.Name, StringComparer.OrdinalIgnoreCase))
|
||||
// 3. Template nodes with composition leaves. Derived templates are
|
||||
// slot-owned and reached via their parent's composition leaf — never
|
||||
// shown as standalone tree nodes.
|
||||
foreach (var t in _templates.Where(t => !t.IsDerived).OrderBy(t => t.Name, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
var compChildren = t.Compositions
|
||||
.OrderBy(c => c.InstanceName, StringComparer.OrdinalIgnoreCase)
|
||||
|
||||
Reference in New Issue
Block a user