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.
Summary
Fixes #13470 , #13471
Technical notes summary
The filtering toggle in
KeyValue.vue
has never worked properly. There were two sources of truth in there, firstfilteredRows
which was filtering items that are a system label, passed asprotectedKeys
prop, and the second wasthis.rows
which includes the whole items. When rendering, the component was usingfilteredRows
but when adding or removing items,this.rows
was being mutated by using the index of items infilteredRows
.You can see this issue by going to Explorer => Projects/Namespaces => Edit Config => Check Pod Security Admission Tab => enable any of the items there => Check Labels & Annotations Tab => Add a label using "Z" for its key and label => Try to Remove
Because there's no unique property in a label to rely on, you need to either create a temporary local id/index to track, or hide the filtered items without removing them from the list. I implemented the hiding approach since this component has many functionalities relied on the index which makes it tricky to update all the places, specially when it supports both arrays and objects, and also it's been vastly used throughout the app that makes it hard to test for the possible regressions. I've tested the performance of the component with 1000 items and didn't notice any slowness, though it's not the most accurate testing.
Areas or cases that should be tested
What's been mentioned on the issues, and also the case mentioned above
Areas which could experience regressions
Screenshot/Video
kv.mov
Checklist