perf(centralui): load template stubs/analysis projections instead of the full tracked graph (review 2026-10-21 07/P-1, 08/P1)

This commit is contained in:
Joseph Doherty
2026-10-22 08:40:49 -04:00
parent 0ebfafa98b
commit c429fb374b
12 changed files with 103 additions and 28 deletions
@@ -0,0 +1,25 @@
using ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates;
using ZB.MOM.WW.ScadaBridge.Commons.Types.Templates;
namespace ZB.MOM.WW.ScadaBridge.CentralUI.Services;
/// <summary>
/// Adapts the untracked, body-free <see cref="TemplateStub"/> projection to childless
/// <see cref="Template"/> shells for pickers and trees that only read identity/edge fields
/// (id, name, parent, folder, derived flag) — review 2026-10-21 07/P-1.
/// </summary>
internal static class TemplateStubExtensions
{
/// <summary>Builds childless <see cref="Template"/> shells carrying only the stub's identity and edges.</summary>
/// <param name="stubs">The stubs to adapt.</param>
/// <returns>One shell template per stub, in input order.</returns>
public static List<Template> ToShellTemplates(this IEnumerable<TemplateStub> stubs) =>
stubs.Select(s => new Template(s.Name)
{
Id = s.Id,
ParentTemplateId = s.ParentTemplateId,
FolderId = s.FolderId,
IsDerived = s.IsDerived,
OwnerCompositionId = s.OwnerCompositionId,
}).ToList();
}