feat(ui/templates): derived-template action and slimmer composition row

Right-click a template now offers "New Derived Template" — opens
TemplateCreate with the parent pre-selected via a new ?parentId query
parameter. Composition rows in the tree drop the trailing
"→ TargetName" muted text; the kind glyph plus the instance name carry
enough meaning, and the composed template is one click away from the
row's right-click menu.
This commit is contained in:
Joseph Doherty
2026-05-11 21:29:32 -04:00
parent b4cb7e6f5f
commit b2eddd9713
5 changed files with 16 additions and 18 deletions

View File

@@ -57,6 +57,7 @@
@code {
[SupplyParameterFromQuery] public int? FolderId { get; set; }
[SupplyParameterFromQuery] public int? ParentId { get; set; }
private List<Template> _templates = new();
private bool _loading = true;
@@ -71,6 +72,10 @@
try
{
_templates = (await TemplateEngineRepository.GetAllTemplatesAsync()).ToList();
if (ParentId is int pid && _templates.Any(t => t.Id == pid))
{
_createParentId = pid;
}
}
catch (Exception ex)
{

View File

@@ -239,13 +239,8 @@
break;
case TmplNodeKind.Composition:
var composedName = _templates.FirstOrDefault(t => t.Id == node.Composition!.ComposedTemplateId)?.Name
?? $"#{node.Composition!.ComposedTemplateId}";
<span class="tv-glyph"><i class="bi bi-arrow-return-right"></i></span>
<span class="tv-label" title="@node.Label">
@node.Label
<span class="text-muted small ms-1">→ @composedName</span>
</span>
<span class="tv-label" title="@node.Label">@node.Label</span>
break;
}
};
@@ -282,6 +277,7 @@
break;
case TmplNodeKind.Template:
<button class="dropdown-item" @onclick='() => NavigationManager.NavigateTo($"/design/templates/create?parentId={node.EntityId}")'>New Derived Template</button>
<button class="dropdown-item" @onclick="() => OpenMoveTemplateDialog(node.EntityId, node.Label)">Move to Folder…</button>
<div class="dropdown-divider"></div>
<button class="dropdown-item text-danger" @onclick="() => DeleteTemplate(node.Template!)">Delete</button>