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

ui: [BUGFIX] Ensure in-folder KVs are created in the correct folder #10569

Merged
merged 2 commits into from
Jul 14, 2021

Conversation

johncowen
Copy link
Contributor

@johncowen johncowen commented Jul 7, 2021

In #10212 we made a fairly significant change to how our routing for namespaces works, with an eye to supporting a future feature of the UI (more details on that PR)

We based the majority of that work on code already existing in the ember framework but noticed that our app would slightly inconsistently use the some of the code in here, which meant it was possible to set empty URL segments in URLs for example /kv/folder-name//create (the URL for creating a new KV within the folder-name folder).

Ember seems to generally strips these, and whilst I've not looked too far into it as yet, this wasn't happening previous to the above PR.

https://github.com/emberjs/ember.js/blob/297ab0e771409d61dcb014a9a40144cd7fdd5ee8/packages/%40ember/-internals/routing/lib/location/history_location.ts#L145

With the addition of the above PR, the double slash stripping began to work, without us noticing! So when clicking to create a KV within folder name, would would be viewing a form that was a form for creating a KV in the root, which when the user clicked to save, saved the KV in the root.

For the moment at least I've removed the code that strips double slashes, and whilst this isn't ideal, it looks like we've picked up one of those bugs that turns into a 'feature', and completely reworking KV to not rely on the double slashes is not really an option right now.

This fixes the problem. Typically it doesn't look like we had a test here to cover this exact pattern, so I've added an additional line to our tests that fails before this bug was fixed.

Fixes #10502

@johncowen johncowen added theme/ui Anything related to the UI backport/1.10 labels Jul 7, 2021
@johncowen johncowen requested a review from kaxcode July 9, 2021 17:18
@johncowen johncowen marked this pull request as ready for review July 9, 2021 17:18
@johncowen johncowen added this to the 1.10.1 milestone Jul 13, 2021
@vercel vercel bot temporarily deployed to Preview – consul July 14, 2021 11:44 Inactive
@vercel vercel bot temporarily deployed to Preview – consul-ui-staging July 14, 2021 11:44 Inactive
Copy link
Contributor

@kaxcode kaxcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@johncowen johncowen merged commit b256313 into main Jul 14, 2021
@johncowen johncowen deleted the ui/bugfix/kv-in-folder-creation branch July 14, 2021 17:49
@hc-github-team-consul-core
Copy link
Collaborator

🍒 If backport labels were added before merging, cherry-picking will start automatically.

To retroactively trigger a backport after merging, add backport labels and re-run https://circleci.com/gh/hashicorp/consul/409091.

@hc-github-team-consul-core
Copy link
Collaborator

🍒❌ Cherry pick of commit b256313 onto release/1.10.x failed! Build Log

johncowen added a commit that referenced this pull request Jul 15, 2021
…10569)

When clicking to create a KV within folder name, would would be viewing a form that was a form for creating a KV in the root, which when the user clicked to save, saved the KV in the root.

For the moment at least I've removed the code that strips double slashes, and whilst this isn't ideal, it looks like we've picked up one of those bugs that turns into a 'feature', and completely reworking KV to not rely on the double slashes is not really an option right now.
@hc-github-team-consul-core
Copy link
Collaborator

🍒 If backport labels were added before merging, cherry-picking will start automatically.

To retroactively trigger a backport after merging, add backport labels and re-run https://circleci.com/gh/hashicorp/consul/410034.

@hc-github-team-consul-core
Copy link
Collaborator

🍒✅ Cherry pick of commit b256313 onto release/1.10.x succeeded!

hc-github-team-consul-core pushed a commit that referenced this pull request Jul 15, 2021
…10569)

When clicking to create a KV within folder name, would would be viewing a form that was a form for creating a KV in the root, which when the user clicked to save, saved the KV in the root.

For the moment at least I've removed the code that strips double slashes, and whilst this isn't ideal, it looks like we've picked up one of those bugs that turns into a 'feature', and completely reworking KV to not rely on the double slashes is not really an option right now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/ui Anything related to the UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

KV keys created in UI are added one prefix level up
3 participants