fix(kamelets): Edit Kamelets' nodes properties #651
Merged
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.
Context
Currently, Kamelets' nodes can't be edited using the Canvas Form, causing the changes made by the user, are not serialized into the source code.
This bug was caused due to a problem in the serialization of the
KameletResource
, because despite theCanvas Form
editing theKameletVisualEntity
correctly, what ultimately was serialized was the originalKamelet
without changes.Changes
The fix is to ensure that we're serializing the
KameletVisualEntity.from
as part of the resultingKameletResource.toJSON()
method.Notes
This change opens up a more broad topic about
Kamelets
, at this moment, theKameletVisualEntity
class has knowledge about the underlying flow (kamelet.spec.template.from
) and its metadata (kamelet.metadata
), and this shouldn't be the case.Ideally,
KameletVisualEntity
would have knowledge about the flow only but the issue with this is that it will close the possibility of renaming the flow, as thesetId
method is defined in theKameletVisualEntity
class. A solution for this could be to create an intermediatesetId
functionality in theCamelResource
interface itself which will later on delegate the change to the underlyingVisualEntities.setId()
method if necessary, this way, in case ofKamelets
andPipes
, we have the chance to update its metadata and also the underlying flow.In addition to that, it would be convenient to offer a mechanism to sort the properties of the underlying
VisualEntities
, this way we could sort the entireKamelet
in akubernetes
friendly way and also keep the underlyingCamel Route
sorted differently. This will be discussed in: #652fix: #594