Skip to content
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
merged 5 commits into from
Aug 3, 2021

Conversation

grottohub
Copy link
Contributor

fixes #1923

Quick synopsis of the issue: data being received for the fields waypointHcl and privateKeyPem 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 and decodedPrivateKey). A caveat here is the on "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 actions setWaypointHcl and setSshAuth), thus removing the need to encode the data on form submission.

@gregone gregone self-requested a review August 2, 2021 12:44
@gregone gregone self-assigned this Aug 2, 2021
@gregone
Copy link
Contributor

gregone commented Aug 3, 2021

@grahamhub Thanks for investigating the bug and for taking the time to dive into this with @jgwhite ! The approach is good, and after trying it out, everything works as expected. 🎉

I just had to push a changelog entry in 320d29c to make the checks pass on our side.

Thanks for contributing 💯 !

@grottohub
Copy link
Contributor Author

thanks for the quick review @gregone - glad to have contributed to something I've been using extensively!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Waypoint HCL file becomes garbled in the UI if saved on the server via UI
2 participants