-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Snapshot & Restore] Decode URIs and fix editing of a policy #76278
[Snapshot & Restore] Decode URIs and fix editing of a policy #76278
Conversation
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing these bugs @jloleysens!
The change does indeed fix the problem of using :
in the name, however, there is still an error if using a %
. You can take a look in the component templates code for what I did to address this. Re: #69732 (comment).
I also noticed both the summary tab in the review step and the details panel sometimes has no value under the Data streams and indices
section when all indices/data streams are selected.
@alisonelizabeth Thanks for the review! It looks like there was an issue with how serialisation of policy config was being done and that was the issue that helped me to uncover the weird validation issue too. I've addressed your feedback, would you mind taking another look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making those fixes! I think there's still an issue with the decoding logic that I left a comment in the code about. I'm going to go ahead and approve to not block you, but happy to retest again if you'd like.
export const attemptToURIDecode = (value: string) => { | ||
let result: string; | ||
try { | ||
result = decodeURIComponent(value); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💚 Build SucceededBuild metrics@kbn/optimizer bundle module count
async chunks size
History
To update your PR or re-run it, just comment with: |
…#76278) * fix URI decoding and editing of a policy which backs up all indices * fix type issue * fix general use of encoding and update decode algo * fix serialisation of snapshots and added a test * Fix test description name * Update attempt_to_uri_decode.ts * catch errors from decoding in the already throwing code Co-authored-by: Elastic Machine <[email protected]>
…#76278) * fix URI decoding and editing of a policy which backs up all indices * fix type issue * fix general use of encoding and update decode algo * fix serialisation of snapshots and added a test * Fix test description name * Update attempt_to_uri_decode.ts * catch errors from decoding in the already throwing code Co-authored-by: Elastic Machine <[email protected]>
…#76320) * fix URI decoding and editing of a policy which backs up all indices * fix type issue * fix general use of encoding and update decode algo * fix serialisation of snapshots and added a test * Fix test description name * Update attempt_to_uri_decode.ts * catch errors from decoding in the already throwing code Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
…#76322) * fix URI decoding and editing of a policy which backs up all indices * fix type issue * fix general use of encoding and update decode algo * fix serialisation of snapshots and added a test * Fix test description name * Update attempt_to_uri_decode.ts * catch errors from decoding in the already throwing code Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
Summary
Add logic for decoding snapshot policy, snapshot repository, snapshot and restore names.
Fix: #75951
Also discovered an issue when editing existing policies. The form will block (incorrectly) when editing a policy's name (or any other value) because the validation thinks that indices need to be set. This is a regression from the behaviour added here: #68078. The fix for now is to bypass this validation unless we are specifically editing index name values in the UI.
How to test decoding - after fix
yarn es snapshot -E path.repo=/tmp/es-snaps
)How to test editing policy fix
This should be covered in the steps mentioned before if you repeated steps 3 and 4 for editing a snapshot policy after creating it. But to reiterate:
Release note
Fixed an issue in Snapshot and Restore UI where creating a policy, repository or snapshot with a special character, like a colon, in the name would result in a 404 when viewing details or editing any of the aforementioned.