@using Microsoft.Extensions.DependencyInjection @inject IServiceProvider MutationServices @page "/deployment/instances/create" @using ZB.MOM.WW.ScadaBridge.Security @using ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances @using ZB.MOM.WW.ScadaBridge.Commons.Entities.Sites @using ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates @using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Protocol @using ZB.MOM.WW.ScadaBridge.Commons.Interfaces.Repositories @using ZB.MOM.WW.ScadaBridge.Commons.Messages.Management @using ZB.MOM.WW.ScadaBridge.TemplateEngine.Services @using ZB.MOM.WW.ScadaBridge.DeploymentManager @using ZB.MOM.WW.ScadaBridge.CentralUI.Components.Dialogs @using ZB.MOM.WW.ScadaBridge.CentralUI.Components.Shared @using ZB.MOM.WW.ScadaBridge.CentralUI.Services @attribute [Authorize(Policy = AuthorizationPolicies.RequireDeployment)] @inject ITemplateEngineRepository TemplateEngineRepository @inject ISiteRepository SiteRepository @inject ZB.MOM.WW.ScadaBridge.CentralUI.Auth.SiteScopeService SiteScope @inject InstanceService InstanceService @inject IFlatteningPipeline FlatteningPipeline @inject AuthenticationStateProvider AuthStateProvider @inject NavigationManager NavigationManager @inject IDialogService Dialog
← Back

Create Instance

@if (_loading) { } else {
@if (_templates.Count == 0) {
No templates exist yet — create one on the Templates page.
} else if (_templateHint is not null) {
@_templateHint
}
@if (_formError != null) {
@_formError
} @if (!BindingsCardVisible) {
}
@* Connection Bindings — the same module groups the Configure page shows, built from a template+site PREVIEW flatten (no instance row exists yet). Group headers only: per-member editing stays on Configure. Nothing is saved until Create. Design: docs/plans/2026-08-21-create-instance-bindings-design.md *@ @if (BindingsCardVisible) {
Connection Bindings @if (_previewLoading) { } else { @_rowCount data-sourced attribute(s) in @_groups.Count group(s) } @if (UnboundGroups > 0 && !_skipBindings) { @UnboundGroups group(s) unbound } preview — nothing saved yet
@if (_previewError is not null) {
Could not preview this template at the selected site (@_previewError). You can create the instance and bind on Configure.
} else if (!_previewLoading && _rowCount == 0) {
Nothing to bind in this template.
} else if (_siteConnections.Count == 0) {
This site has no data connections — add one under Sites, or create now and bind later.
} else if (!_skipBindings) {
Bind all to Fills the connection on every group and suggests an Object for blanks; never overwrites an Object you typed.
@foreach (var g in _groups) { var input = _inputs.GetValueOrDefault(g.Key); var source = CreateBindingPlanner.SourceOf(g, input);
@g.Key @if (g.IsInstanceGroup) { direct attributes } else if (g.NestedModules.Count > 0) { incl. @string.Join(", ", g.NestedModules) } @g.Members.Count @if (source == CreateBindingPlanner.ObjectSource.Suggested) { suggested } else if (source == CreateBindingPlanner.ObjectSource.FromTemplate) { from template } @if (IsGroupBound(g)) { bound } else { @g.Members.Count unbound }
} }
@* Address-space picker. SelectableNodeClasses adds Object so a module's container node can be chosen, not just a leaf tag. *@ } }
@code { /// Query preselect: the template the operator picked elsewhere (e.g. the Templates tree's "New Instance…"). [SupplyParameterFromQuery] public int? TemplateId { get; set; } [SupplyParameterFromQuery] public int? SiteId { get; set; } [SupplyParameterFromQuery] public int? AreaId { get; set; } private List _sites = new(); private List