Skip to content

Ask for template parameters on config template import - #3564

Merged
Ekhorn merged 7 commits into
mainfrom
feature/configuration-template-parameters
Nov 23, 2026
Merged

Ekhorn merged 7 commits into
mainfrom
feature/configuration-template-parameters

Conversation

@Ekhorn

@Ekhorn Ekhorn commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds a parameter step to configuration template import for the values that differ per asset, so one template can be reused across assets and instances.

Changelog

  • Add @JsonSchemaTemplateParameter to mark template parameters in the generated schema.
  • Mark AgentLink.id and ModbusAgentLink.unitId with @JsonSchemaTemplateParameter.
  • Add the parameter step, grouped by agent link type, where fields of one type with the same value share one parameter
  • Offer only agents of the link's type in the asset's realm, and block import while no such agent exists
  • Check the other parameters with JSON Forms against the schema of their field
  • Add @JsonSchemaTitle labels for Agent ID and Unit ID
  • Cover the parameter mark in JSONSchemaUtilTest

Checklist

  • 1. Acceptance criteria of the linked issue(s) are met
  • 2. Tests are written and all tests pass
  • 3. Changes are manually tested by you and the reviewer
  • 4. Documentation is written or updated

@Ekhorn Ekhorn self-assigned this Nov 10, 2026
@Ekhorn Ekhorn added the Feature Development of new feature label Nov 10, 2026
@Ekhorn
Ekhorn force-pushed the feature/configuration-template-parameters branch from 7b33be2 to b5653dc Compare November 10, 2026 21:58
@Ekhorn
Ekhorn changed the base branch from main to feature/import-export-asset-attribute-configuration November 10, 2026 22:34
@Ekhorn
Ekhorn marked this pull request as ready for review November 10, 2026 22:46
@Ekhorn
Ekhorn force-pushed the feature/configuration-template-parameters branch from 9a6b347 to d8c9dec Compare November 11, 2026 10:46
@Ekhorn
Ekhorn force-pushed the feature/configuration-template-parameters branch from d8c9dec to 43c062c Compare November 19, 2026 08:35
Base automatically changed from feature/import-export-asset-attribute-configuration to main November 19, 2026 18:47
- Ask for a template parameter per agent and apply it to every linked attribute
- Block import until an agent of the link type exists
@Ekhorn
Ekhorn force-pushed the feature/configuration-template-parameters branch from 43c062c to 39d4e77 Compare November 19, 2026 18:49

@MartinaeyNL MartinaeyNL left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initial AI-assisted review 😉

};

const refreshAgents = async () => {
agents = [...(await loadAgents())];

@MartinaeyNL MartinaeyNL Nov 20, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ This comment is AI-assisted ⚠️

loadAgents() queries manager.displayRealm, so "agents in the asset's realm" (acceptance criteria 5)
holds only because the asset viewer always runs in the display realm. Worth a comment
stating that assumption, or filtering against asset.realm if that invariant could
ever break.

- Show the unknown agent error while no agent is picked, since the agent is only preset when the template's agent exists
- Drop the unused asset argument of getParameterGroups
- Test that the Modbus unit ID is a template parameter
@Ekhorn
Ekhorn requested a review from MartinaeyNL November 20, 2026 16:45
.items=${options.map(([value, optionLabel]) => ({ value, label: optionLabel }))}
.value=${live((parameter.value as string | undefined) ?? "")}
@value-changed=${(ev: CustomEvent<{ value: string }>) => {
parameter.value = ev.detail.value || undefined;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this || undefined is necessary, correct?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn't strictly needed today, but I'd keep it.

The select fires value-changed when the user picks an agent, and also when our code changes its value. When our code clears it, for example because the picked agent was deleted, the event carries "".

|| undefined turns that "" into undefined, so "no agent" is always undefined. That's what unknownAgent checks. Without it everything still works, but only because resolveAgentId turns "" back into undefined before the next render.

@sonarqubecloud

Copy link
Copy Markdown

@Ekhorn
Ekhorn requested a review from MartinaeyNL November 23, 2026 15:27
@MartinaeyNL
MartinaeyNL added this pull request to the merge queue Nov 23, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 23, 2026
@Ekhorn
Ekhorn added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit d7fed6f Nov 23, 2026
39 of 40 checks passed
@Ekhorn
Ekhorn deleted the feature/configuration-template-parameters branch November 23, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature Development of new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support template parameters on configuration template import

2 participants