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
Open
Ekhorn
wants to merge
3
commits into
main
Choose a base branch
from
feature/import-export-asset-attribute-configuration
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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
55 changes: 55 additions & 0 deletions
55
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,55 @@ | ||
| /* | ||
| * 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 com.fasterxml.jackson.annotation.JsonProperty; | ||
| import com.fasterxml.jackson.databind.node.ObjectNode; | ||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
|
|
||
| /** | ||
| * 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 class AttributeConfiguration { | ||
|
|
||
| @Schema(description = "Value descriptor name of the attribute, e.g. number.") | ||
| protected String type; | ||
|
|
||
| @Schema(description = "Metadata keyed by meta-item name, exactly as stored on the attribute.") | ||
| protected ObjectNode meta; | ||
|
|
||
| @JsonCreator | ||
| public AttributeConfiguration( | ||
| @JsonProperty("type") String type, @JsonProperty("meta") ObjectNode meta) { | ||
| this.type = type; | ||
| this.meta = meta; | ||
| } | ||
|
|
||
| public String getType() { | ||
| return type; | ||
| } | ||
|
|
||
| public ObjectNode getMeta() { | ||
| return meta; | ||
| } | ||
| } |
49 changes: 49 additions & 0 deletions
49
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,49 @@ | ||
| /* | ||
| * 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 com.fasterxml.jackson.annotation.JsonProperty; | ||
| 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 class AttributeConfigurationSummary { | ||
|
|
||
| @Schema(description = "Attribute name.") | ||
| protected String name; | ||
|
|
||
| @Schema(description = "Value descriptor name of the attribute, e.g. number.") | ||
| protected String type; | ||
|
|
||
| @JsonCreator | ||
| public AttributeConfigurationSummary( | ||
| @JsonProperty("name") String name, @JsonProperty("type") String type) { | ||
| this.name = name; | ||
| this.type = type; | ||
| } | ||
|
|
||
| public String getName() { | ||
| return name; | ||
| } | ||
|
|
||
| public String getType() { | ||
| return type; | ||
| } | ||
| } |
61 changes: 61 additions & 0 deletions
61
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,61 @@ | ||
| /* | ||
| * 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 com.fasterxml.jackson.annotation.JsonProperty; | ||
| 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 class AttributeConfigurationTypeMismatch { | ||
|
|
||
| @Schema(description = "Attribute name.") | ||
| protected String name; | ||
|
|
||
| @Schema(description = "Value descriptor name within the imported document.") | ||
| protected String importedType; | ||
|
|
||
| @Schema(description = "Value descriptor name of the target attribute.") | ||
| protected String targetType; | ||
|
|
||
| @JsonCreator | ||
| public AttributeConfigurationTypeMismatch( | ||
| @JsonProperty("name") String name, | ||
| @JsonProperty("importedType") String importedType, | ||
| @JsonProperty("targetType") String targetType) { | ||
| this.name = name; | ||
| this.importedType = importedType; | ||
| this.targetType = targetType; | ||
| } | ||
|
|
||
| public String getName() { | ||
| return name; | ||
| } | ||
|
|
||
| public String getImportedType() { | ||
| return importedType; | ||
| } | ||
|
|
||
| public String getTargetType() { | ||
| return targetType; | ||
| } | ||
| } |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should probably settle whether we want to call these endpoints
attributeConfiguration, or instead maybe:configurationTemplate,attributeConfigurationTemplate,attributeConfigurationItemTemplate, etc.. ?I'm questioning this because we also are considering templates for individual attributes I believe..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Settled on configuration template, the name the design and dialogs were already using it. "Attribute template" stays free for the planned per-attribute templates.
GET /asset/{assetId}/configurationTemplateandPOST /asset/{assetId}/configurationTemplate/importConfigurationTemplate,ConfigurationTemplateImport{Request,Preview,Failure}andConfigurationTemplateUtilconfiguration-template.ts, locale keysconfigurationTemplate.*, download<asset-name>-configuration-template.jsonAttributeConfiguration,AttributeConfigurationSummaryandAttributeConfigurationTypeMismatchkeep their names, as each describes a single attribute