Skip to content
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

Add JSON validation to UI #2712

Merged
merged 2 commits into from
May 2, 2017
Merged

Add JSON validation to UI #2712

merged 2 commits into from
May 2, 2017

Conversation

jackturnbull
Copy link
Contributor

@jackturnbull jackturnbull commented Feb 6, 2017

I'd expect that there'd be other users than ourselves that use the Key/Value store to store JSON nested keys so I thought I'd pass up a PR for review. The implementation itself is pretty lightweight; see if JSON.parse throws an error, if not then valid. The isValid function can be changed to suit.

This has been implemented through the use of a flag to enable/disable the functionality with a watcher on the value to set the success/error class on the textarea itself:

Default

screen shot 2017-02-06 at 14 30 55

Enabled (error)

screen shot 2017-02-06 at 14 31 01

Enabled (success)

screen shot 2017-02-06 at 14 31 18

No hard validation added to form to prevent the request - intentional as this didn't feel like expected behaviour and I didn't want to force the users into any specific workflow.

In all honesty, I won't be heartbroken if this doesn't make it in, we can run our own UI after all although I do think its a net gain overall. cc: @nathanhebe

@sethvargo
Copy link
Contributor

Hey @jackturnbull

Could you please rebase this?

JSON validation added to UI. This has been implemented through the use of a flag
to enable/disable the functionality with a watcher on the value to set the
success/error class on the textarea itself.

No hard validation added to the field.
JSON validation has now been added to the update view following the same format
as create. Since 'valueDecoded' does not have the ability to check if the value
is base64 before decoding then this must be checked first; if it is base64 then
use the decoded one, if not just get the value.

Change incorrect trailing span close to label.
@jackturnbull
Copy link
Contributor Author

@sethvargo All done 😄

@slackpad slackpad merged commit 416126d into hashicorp:master May 2, 2017
@slackpad
Copy link
Contributor

slackpad commented May 2, 2017

Thanks!

slackpad added a commit that referenced this pull request May 2, 2017
johncowen pushed a commit that referenced this pull request May 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants