feat(cli+templateengine+deploymanager): resolve follow-ups #4/#5/#6/#8 — CLI ergonomics + structured deploy validation error
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).
This commit is contained in:
@@ -86,23 +86,35 @@ Exit codes:
|
||||
|
||||
#### `template list`
|
||||
|
||||
List all templates with their full attribute, alarm, script, and composition definitions.
|
||||
List all templates. **Table** output (`--format table`) shows a compact summary — id,
|
||||
name, description, parent, and member **counts** (`#attrs`, `#alarms`, `#scripts`,
|
||||
`#comps`, `#nativeAlarms`) — so it stays readable in a terminal. Add `--detail` to dump
|
||||
the full attribute/alarm/script/composition definitions in the table. **JSON** output
|
||||
(`--format json`) is always the full, unmodified payload regardless of `--detail`.
|
||||
|
||||
```sh
|
||||
scadabridge --url <url> template list
|
||||
scadabridge --url <url> template list # compact table
|
||||
scadabridge --url <url> --format table template list --detail # full table dump
|
||||
scadabridge --url <url> --format json template list # full JSON (always)
|
||||
```
|
||||
|
||||
| Option | Required | Description |
|
||||
|--------|----------|-------------|
|
||||
| `--detail` | no | Include full definitions in table output (no effect on JSON) |
|
||||
|
||||
#### `template get`
|
||||
|
||||
Get a single template by ID.
|
||||
Get a single template by ID. Like `template list`, table output is a compact summary
|
||||
unless `--detail` is supplied; JSON output is always full.
|
||||
|
||||
```sh
|
||||
scadabridge --url <url> template get --id <int>
|
||||
scadabridge --url <url> template get --id <int> [--detail]
|
||||
```
|
||||
|
||||
| Option | Required | Description |
|
||||
|--------|----------|-------------|
|
||||
| `--id` | yes | Template ID |
|
||||
| `--detail` | no | Include full definitions in table output (no effect on JSON) |
|
||||
|
||||
#### `template create`
|
||||
|
||||
@@ -120,9 +132,11 @@ scadabridge --url <url> template create --name <string> [--description <string>]
|
||||
|
||||
#### `template update`
|
||||
|
||||
Update an existing template. An update **replaces** the whole entity — every required
|
||||
field below must be supplied with the value it should have after the update, even if
|
||||
it is unchanged.
|
||||
Update an existing template. Optional fields use **leave-unchanged** semantics: omitting
|
||||
`--description` or `--parent-id` keeps the stored value rather than wiping it. To
|
||||
explicitly clear the description, pass an empty string (`--description ""`). The parent
|
||||
template is immutable after creation — omit `--parent-id` (or pass the current value);
|
||||
passing a different value is rejected.
|
||||
|
||||
```sh
|
||||
scadabridge --url <url> template update --id <int> --name <string> [--description <string>] [--parent-id <int>]
|
||||
@@ -132,8 +146,8 @@ scadabridge --url <url> template update --id <int> --name <string> [--descriptio
|
||||
|--------|----------|-------------|
|
||||
| `--id` | yes | Template ID |
|
||||
| `--name` | yes | Template name |
|
||||
| `--description` | no | Updated description |
|
||||
| `--parent-id` | no | Updated parent template ID |
|
||||
| `--description` | no | Updated description. Omit to leave unchanged; pass `""` to clear. |
|
||||
| `--parent-id` | no | Immutable; omit to leave unchanged. |
|
||||
|
||||
#### `template delete`
|
||||
|
||||
@@ -544,7 +558,22 @@ scadabridge --url <url> instance set-bindings --id <int> --bindings <json>
|
||||
| Option | Required | Description |
|
||||
|--------|----------|-------------|
|
||||
| `--id` | yes | Instance ID |
|
||||
| `--bindings` | yes | JSON array of `[attributeName, dataConnectionId]` pairs (e.g. `[["Speed",7],["Temperature",7]]`) |
|
||||
| `--bindings` | yes | JSON array of binding entries, each either `[attributeName, dataConnectionId]` or `[attributeName, dataConnectionId, dataSourceReferenceOverride]` |
|
||||
|
||||
The optional **third element** sets the per-instance data-source reference override
|
||||
(the OPC UA node id / protocol address used in place of the template's
|
||||
`DataSourceReference` for that attribute). Pass a string to set it, or `null` / omit
|
||||
it to use the template default:
|
||||
|
||||
```sh
|
||||
# Bind Speed with an address override; bind Mode using the template default reference.
|
||||
scadabridge --url <url> instance set-bindings --id 42 \
|
||||
--bindings '[["Speed",7,"ns=2;s=Reactor.Speed"],["Mode",7]]'
|
||||
```
|
||||
|
||||
> **Note:** this command **replaces** all bindings for the instance. Include the
|
||||
> override on every entry that needs one — omitting the third element clears any
|
||||
> previously-set override for that attribute.
|
||||
|
||||
#### `instance set-overrides`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user