cdd65beb6c
Closes the four remaining items in the 2026-06-24 template-inheritance/CLI follow-up tracker. #4 — CLI `instance set-bindings` can now set DataSourceReferenceOverride. `--bindings` accepts an optional 3rd element per entry: [attributeName, dataConnectionId, dataSourceReferenceOverride]. A string sets the override; a JSON null or an omitted 3rd element leaves it unset (template default). TryParseBindings accepts 2- or 3-element entries and rejects a non-string/non-null 3rd element or 4+ elements with a clean error. Previously the CLI sent the override as null and silently wiped any existing one (only a raw POST /management could set it). #5 — `template update` is partial, not full-replace (fixed server-side so all clients benefit). UpdateTemplateAsync now uses leave-unchanged semantics: a null description keeps the stored value (pass "" to clear); a null parentTemplateId keeps the existing parent. Parent stays immutable — a non-null differing value is still rejected — but omitting --parent-id is now a no-op instead of failing every derived-template update. #6 — compact `template list`/`get` table output + `--detail`. Table output is now id/name/description/parent/derived + member counts (#attrs/#alarms/ #scripts/#comps/#nativeAlarms) via TemplateTableProjection, fed through a new optional tableProjector seam on CommandHelpers. `--detail` restores the full dump. JSON output is left untouched (always full) so machine consumers are unaffected — the projector only runs on the table path. #8 — structured deploy-time validation error. New ValidationResult.SummarizeErrors() (Commons) returns a grouped, capped summary: leading total count, one line per ValidationCategory, and a per-module rollup (canonical name up to its last dot) with counts + "... and N more module(s)" caps. DeploymentService uses it for the "Pre-deployment validation failed" message and logs the full per-entry list via LogWarning. Replaces the flat semicolon-joined dump that became a wall of text for instances with 50-194 unbound attributes. Tests: +8 Commons (SummarizeErrors), +8 CLI (4 binding 3-element / 4 table projection), +2 net TemplateEngine (partial-update). Affected suites green: Commons 587, CLI 341, TemplateEngine 447, DeploymentManager 101, ManagementService 230, CentralUI 866; full solution builds 0/0. Docs: Component-DeploymentManager.md "Validation Error Reporting"; CLI README (set-bindings 3-element form, template update leave-unchanged, list/get --detail); UpdateTemplateCommand doc; known-issues tracker #4/#5/#6/#8 resolved (all 8 items now closed).
61 lines
4.8 KiB
C#
61 lines
4.8 KiB
C#
namespace ZB.MOM.WW.ScadaBridge.Commons.Messages.Management;
|
|
|
|
public record ListTemplatesCommand;
|
|
public record GetTemplateCommand(int TemplateId);
|
|
public record CreateTemplateCommand(string Name, string? Description, int? ParentTemplateId);
|
|
|
|
/// <summary>
|
|
/// Updates a template. Optional fields use leave-unchanged semantics (followup #5):
|
|
/// a <c>null</c> <see cref="Description"/> keeps the stored description (pass an empty
|
|
/// string to clear it), and a <c>null</c> <see cref="ParentTemplateId"/> keeps the
|
|
/// existing parent (the parent is immutable; a non-null value that differs is rejected).
|
|
/// </summary>
|
|
public record UpdateTemplateCommand(int TemplateId, string Name, string? Description, int? ParentTemplateId);
|
|
public record DeleteTemplateCommand(int TemplateId);
|
|
public record ValidateTemplateCommand(int TemplateId);
|
|
|
|
/// <summary>
|
|
/// Read-only authoring query (M9/T26a): returns the EFFECTIVE inherited member
|
|
/// set for a template — computed fresh from the full inheritance chain
|
|
/// (arbitrary depth), annotated per member with origin + lock state — plus a
|
|
/// staleness summary comparing the template's stored rows against the resolved
|
|
/// set. Feeds the template editor's inheritance preview + base-change banner;
|
|
/// never mutates stored rows. Response: <see cref="ResolvedTemplateMembers"/>.
|
|
/// </summary>
|
|
public record GetResolvedTemplateMembersCommand(int TemplateId);
|
|
|
|
/// <summary>
|
|
/// Reconciles a template's STORED inherited member rows with the resolved
|
|
/// effective inherited set, for the template and its whole derived subtree:
|
|
/// materializes missing inherited placeholders (e.g. base members added after a
|
|
/// derived template was created), re-syncs drifted placeholders to the live
|
|
/// effective value, and removes orphaned inherited rows. After a resync the
|
|
/// editor's editable member tabs are complete and the "base changed" staleness
|
|
/// banner clears. Designer-gated, audited. Response:
|
|
/// <see cref="ResyncInheritedMembersResult"/>.
|
|
/// </summary>
|
|
public record ResyncInheritedMembersCommand(int TemplateId);
|
|
|
|
// Template member operations
|
|
public record AddTemplateAttributeCommand(int TemplateId, string Name, string DataType, string? Value, string? Description, string? DataSourceReference, bool IsLocked, string? ElementDataType = null);
|
|
public record UpdateTemplateAttributeCommand(int AttributeId, string Name, string DataType, string? Value, string? Description, string? DataSourceReference, bool IsLocked, string? ElementDataType = null);
|
|
public record DeleteTemplateAttributeCommand(int AttributeId);
|
|
public record AddTemplateAlarmCommand(int TemplateId, string Name, string TriggerType, int PriorityLevel, string? Description, string? TriggerConfiguration, bool IsLocked);
|
|
public record UpdateTemplateAlarmCommand(int AlarmId, string Name, string TriggerType, int PriorityLevel, string? Description, string? TriggerConfiguration, bool IsLocked);
|
|
public record DeleteTemplateAlarmCommand(int AlarmId);
|
|
// Native alarm source bindings (read-only mirror of an OPC UA A&C / MxGateway source's alarms)
|
|
public record AddTemplateNativeAlarmSourceCommand(int TemplateId, string Name, string ConnectionName, string SourceReference, string? ConditionFilter, string? Description, bool IsLocked);
|
|
public record UpdateTemplateNativeAlarmSourceCommand(int NativeAlarmSourceId, string Name, string ConnectionName, string SourceReference, string? ConditionFilter, string? Description, bool IsLocked);
|
|
public record DeleteTemplateNativeAlarmSourceCommand(int NativeAlarmSourceId);
|
|
public record ListTemplateNativeAlarmSourcesCommand(int TemplateId);
|
|
// MinTimeBetweenRuns/ExecutionTimeoutSeconds are additive trailing optionals (default null = "unset"):
|
|
// MinTimeBetweenRuns mirrors the TemplateScript.MinTimeBetweenRuns TimeSpan throttle/re-fire interval;
|
|
// ExecutionTimeoutSeconds mirrors the per-script TemplateScript.ExecutionTimeoutSeconds override (seconds;
|
|
// null/non-positive falls back to the site's global default). Both were previously settable only via
|
|
// Transport bundle import — these fields close the CLI/UI authoring gap (#54). Additive-only: never reorder.
|
|
public record AddTemplateScriptCommand(int TemplateId, string Name, string Code, string? TriggerType, string? TriggerConfiguration, bool IsLocked, string? ParameterDefinitions = null, string? ReturnDefinition = null, TimeSpan? MinTimeBetweenRuns = null, int? ExecutionTimeoutSeconds = null);
|
|
public record UpdateTemplateScriptCommand(int ScriptId, string Name, string Code, string? TriggerType, string? TriggerConfiguration, bool IsLocked, string? ParameterDefinitions = null, string? ReturnDefinition = null, TimeSpan? MinTimeBetweenRuns = null, int? ExecutionTimeoutSeconds = null);
|
|
public record DeleteTemplateScriptCommand(int ScriptId);
|
|
public record AddTemplateCompositionCommand(int TemplateId, string InstanceName, int ComposedTemplateId);
|
|
public record DeleteTemplateCompositionCommand(int CompositionId);
|