Repository navigation
Add configuration template import and export #3380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Ekhorn
merged 22 commits into
main
from
feature/import-export-asset-attribute-configuration
Nov 19, 2026
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
2bd0b1a
Add asset attribute configuration import and export
Ekhorn f91f493
Keep access and attribute link meta items with the asset
Ekhorn 70f7125
Add config-template setup
Ekhorn 4f78508
Add side padding to configuration item cards
Ekhorn f2352b4
Add model and test guidelines to AGENTS.md
Ekhorn 00782b9
Drop redundant @JsonProperty annotations
Ekhorn 5a05f41
Use MetaMap and AttributeMap in configuration templates
Ekhorn 9d3aed1
Explain why exported attributes are sorted
Ekhorn 90d54e1
Start the container once in ConfigurationTemplateTest
Ekhorn 1dbd199
Merge remote-tracking branch 'origin/main' into feature/import-export…
Ekhorn fba05fd
Report where a configuration template fails to import
Ekhorn 22f3bf9
Validate imported templates as saving the asset does
Ekhorn ed33802
Fix spotless issue
Ekhorn f9c2e69
Change AttributeConfiguration classes into records
Ekhorn 0bd0e09
Disable configuration template import on unsaved assets
Ekhorn 390cd4b
Leave custom attributes out of configuration templates
Ekhorn b8c7acd
Add configuration template UI tests
Ekhorn 0ac0676
Go back to the file selection from a rejected template
Ekhorn 0a1e682
Wait for file step to close dialog in config template tests
Ekhorn 317846d
Rename ConfigurationItem to ConfigurationItemView
Ekhorn 87ee78e
Test export and import by a restricted user
Ekhorn 5c8f81e
Use slotted dialog content and attribute bindings in config templates
Ekhorn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
model/src/main/java/org/openremote/model/asset/AttributeConfiguration.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| /* | ||
| * Copyright 2026, OpenRemote Inc. | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU Affero General Public License as | ||
| * published by the Free Software Foundation, either version 3 of the | ||
| * License, or (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU Affero General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Affero General Public License | ||
| * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| * | ||
| * SPDX-License-Identifier: AGPL-3.0-or-later | ||
| */ | ||
| package org.openremote.model.asset; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import org.openremote.model.attribute.MetaMap; | ||
| import org.openremote.model.value.MetaHolder; | ||
|
|
||
| /** | ||
| * The configuration of a single {@link org.openremote.model.attribute.Attribute} within an {@link | ||
| * ConfigurationTemplate}. The attribute name is the document map key, so it is not repeated here. | ||
| */ | ||
| @Schema( | ||
| description = | ||
| "Configuration of a single attribute; the attribute name is the key within the document.") | ||
| public record AttributeConfiguration( | ||
| @Schema(description = "Value descriptor name of the attribute, e.g. number.") String type, | ||
| @Schema(description = "Metadata keyed by meta-item name, exactly as stored on the attribute.") | ||
| MetaMap meta) | ||
| implements MetaHolder { | ||
|
|
||
| @Override | ||
| public MetaMap getMeta() { | ||
| return meta; | ||
| } | ||
| } |
27 changes: 27 additions & 0 deletions
27
model/src/main/java/org/openremote/model/asset/AttributeConfigurationSummary.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /* | ||
| * Copyright 2026, OpenRemote Inc. | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU Affero General Public License as | ||
| * published by the Free Software Foundation, either version 3 of the | ||
| * License, or (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU Affero General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Affero General Public License | ||
| * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| * | ||
| * SPDX-License-Identifier: AGPL-3.0-or-later | ||
| */ | ||
| package org.openremote.model.asset; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
|
|
||
| /** An attribute of a {@link ConfigurationTemplate} as reported to the user. */ | ||
| @Schema(description = "Name and type of an attribute within an imported document.") | ||
| public record AttributeConfigurationSummary( | ||
| @Schema(description = "Attribute name.") String name, | ||
| @Schema(description = "Value descriptor name of the attribute, e.g. number.") String type) {} |
31 changes: 31 additions & 0 deletions
31
model/src/main/java/org/openremote/model/asset/AttributeConfigurationTypeMismatch.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| /* | ||
| * Copyright 2026, OpenRemote Inc. | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU Affero General Public License as | ||
| * published by the Free Software Foundation, either version 3 of the | ||
| * License, or (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU Affero General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Affero General Public License | ||
| * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| * | ||
| * SPDX-License-Identifier: AGPL-3.0-or-later | ||
| */ | ||
| package org.openremote.model.asset; | ||
|
|
||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
|
|
||
| /** | ||
| * An attribute that cannot be imported because the target attribute holds a different value type. | ||
| */ | ||
| @Schema(description = "Attribute skipped on import because the target type differs.") | ||
| public record AttributeConfigurationTypeMismatch( | ||
| @Schema(description = "Attribute name.") String name, | ||
| @Schema(description = "Value descriptor name within the imported document.") | ||
| String importedType, | ||
| @Schema(description = "Value descriptor name of the target attribute.") String targetType) {} |
66 changes: 66 additions & 0 deletions
66
model/src/main/java/org/openremote/model/asset/ConfigurationTemplate.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| /* | ||
| * Copyright 2026, OpenRemote Inc. | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU Affero General Public License as | ||
| * published by the Free Software Foundation, either version 3 of the | ||
| * License, or (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU Affero General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Affero General Public License | ||
| * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| * | ||
| * SPDX-License-Identifier: AGPL-3.0-or-later | ||
| */ | ||
| package org.openremote.model.asset; | ||
|
|
||
| import com.fasterxml.jackson.annotation.JsonCreator; | ||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
| import java.util.Map; | ||
|
|
||
| /** | ||
| * A configuration template: a user editable document holding the configuration of the {@link | ||
| * org.openremote.model.attribute.Attribute}s of an {@link Asset}. Attributes are keyed by attribute | ||
| * name. | ||
| */ | ||
| @Schema( | ||
| description = | ||
| "Versioned configuration template holding the attribute configuration of an asset, keyed by attribute name.") | ||
| public class ConfigurationTemplate { | ||
|
|
||
| /** The only document version this release can read and write. */ | ||
| public static final int CURRENT_VERSION = 1; | ||
|
|
||
| @Schema(description = "Document format version.", example = "1") | ||
| protected int version; | ||
|
richturner marked this conversation as resolved.
Resolved
|
||
|
|
||
| @Schema(description = "Asset type the template was exported from.") | ||
| protected String assetType; | ||
|
|
||
| @Schema(description = "Attribute configuration keyed by attribute name.") | ||
| protected Map<String, AttributeConfiguration> attributes; | ||
|
|
||
| @JsonCreator | ||
| public ConfigurationTemplate( | ||
| int version, String assetType, Map<String, AttributeConfiguration> attributes) { | ||
| this.version = version; | ||
| this.assetType = assetType; | ||
| this.attributes = attributes; | ||
| } | ||
|
|
||
| public int getVersion() { | ||
| return version; | ||
| } | ||
|
|
||
| public String getAssetType() { | ||
| return assetType; | ||
| } | ||
|
|
||
| public Map<String, AttributeConfiguration> getAttributes() { | ||
| return attributes; | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.