Repository navigation
Ask for template parameters on config template import - #3564
Conversation
7b33be2 to
b5653dc
Compare
9a6b347 to
d8c9dec
Compare
d8c9dec to
43c062c
Compare
- Ask for a template parameter per agent and apply it to every linked attribute - Block import until an agent of the link type exists
43c062c to
39d4e77
Compare
MartinaeyNL
left a comment
There was a problem hiding this comment.
Initial AI-assisted review 😉
| }; | ||
|
|
||
| const refreshAgents = async () => { | ||
| agents = [...(await loadAgents())]; |
There was a problem hiding this comment.
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
| .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; |
There was a problem hiding this comment.
I don't think this || undefined is necessary, correct?
There was a problem hiding this comment.
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.
|



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
@JsonSchemaTemplateParameterto mark template parameters in the generated schema.AgentLink.idandModbusAgentLink.unitIdwith@JsonSchemaTemplateParameter.@JsonSchemaTitlelabels for Agent ID and Unit IDJSONSchemaUtilTestChecklist