This repository has been archived by the owner on Jan 8, 2024. It is now read-only.
ui: handle incoming base64 strings from grpc-web #1967
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.
fixes #1923
Quick synopsis of the issue: data being received for the fields
waypointHcl
andprivateKeyPem
is being transmitted as base64 encoded strings, which was unaccounted for when rendering that data in the UI, leading it to display the base64 encoded strings instead of the readable data.The approach for this solution allows the data to continue "living" as base64, and is simply decoded when rendered in the UI (via computed properties
decodedWaypointHcl
anddecodedPrivateKey
). A caveat here is theon "input"
event listeners. If a user doesn't trigger that event (i.e. they don't change the value), there's no need to re-encode that field back to base64 to be sent to the server. This is why I chose to let the data stay as a base64 string - encoding will happen on input (in the actionssetWaypointHcl
andsetSshAuth
), thus removing the need to encode the data on form submission.