diff --git a/docs/plans/2026-05-18-contained-template-names-design.md b/docs/plans/2026-05-18-contained-template-names-design.md index ad9aa4c..5f37fc8 100644 --- a/docs/plans/2026-05-18-contained-template-names-design.md +++ b/docs/plans/2026-05-18-contained-template-names-design.md @@ -1,7 +1,7 @@ # Contained Names for Composition-Derived Templates — Design **Date:** 2026-05-18 -**Status:** Approved (brainstorming) — implementation to follow +**Status:** Implemented ## Context diff --git a/docs/requirements/Component-TemplateEngine.md b/docs/requirements/Component-TemplateEngine.md index bdfb196..61a231f 100644 --- a/docs/requirements/Component-TemplateEngine.md +++ b/docs/requirements/Component-TemplateEngine.md @@ -81,6 +81,18 @@ When a template composes a feature module, members from that module are addresse - The composing template's own members (not from a module) have no prefix — they are top-level names. - Naming collision detection operates on canonical names, so two modules can define the same member name as long as their module instance names differ. +### Derived template naming + +A composition slot is materialized as its own *derived* template. A derived +template stores a **contained name** — the composition slot's instance name +(e.g. `Pump`), unique only within its owner. The **qualified name** +(`Motor Controller.Pump`, or `Motor Controller.Pump.TempSensor` when nested) is +*computed* on read by walking the owner-composition chain — it is not stored. +Only base (user-authored) templates are globally unique by name; a derived +template's uniqueness is the slot-name uniqueness within its owner. The Central +UI shows the contained name as the template title and the qualified path as a +breadcrumb. + ## Override Granularity Override and lock rules apply per entity type at the following granularity: diff --git a/src/ScadaLink.CentralUI/Components/Pages/Design/TemplateEdit.razor b/src/ScadaLink.CentralUI/Components/Pages/Design/TemplateEdit.razor index 64c8840..6732540 100644 --- a/src/ScadaLink.CentralUI/Components/Pages/Design/TemplateEdit.razor +++ b/src/ScadaLink.CentralUI/Components/Pages/Design/TemplateEdit.razor @@ -236,7 +236,7 @@ @_baseTemplate.Name @if (_ownerTemplate != null && _ownerComposition != null) { - — composed inside @_ownerTemplate.Name as @_ownerComposition.InstanceName. + — composed inside @QualifiedTemplateName(_ownerTemplate) as @_ownerComposition.InstanceName. } @@ -248,6 +248,12 @@ { inherits @(_templates.FirstOrDefault(t => t.Id == _selectedTemplate.ParentTemplateId)?.Name) } + @if (_selectedTemplate.IsDerived) + { + @* Derived templates store a contained name; show the full + qualified path as a breadcrumb subtitle. *@ +
@QualifiedTemplateName(_selectedTemplate)
+ }