Fix action/rule deletion bug
What does this MR do and why?
Fix action/rule deletion bug
- the bug is that the
v-for
items are using theindex
for the:key
, so the UI is not updating properly - create a unique id for each action/rule in the policy object, use the key
id
, and use it for the:key
in thev-for
- add unique id to default actions/rules
- add unique id to actions/rules if they exist when creating the policy object in the
fromYaml
methods - remove unique id from the actions/rules if they exist when created the policy yaml in the
toYaml
methods- only have the unique id appear in the policy object, which is used in rule mode, which is where the bug is
- the unique id should never appear in the policy yaml because the policy yaml is what is saved
- update all the tests
- mock uniqueId in tests
Changelog: fixed
EE: true
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Scenario | Before | After |
---|---|---|
Scan Result Policy | srp_-_b | srp_-_a |
Scan Execution Policy | sep_-_b | sep_-_a |
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
Scan Result Policy
- Upload a GitLab Ultimate license
- Navigate to a project/group => Secure => Policies => New policy => Scan Result Policy
- Create multiple rules of the same type and change various other parameters to distinguish between them
- Remove the first rule
- Verify the correct rule was removed from the UI and the yaml preview
Scan Execution Policy
- Upload a GitLab Ultimate license
- Navigate to a project/group => Secure => Policies => New policy => Scan Execution Policy
- Create multiple rules of the same type and change various other parameters to distinguish between them
- Remove the first rule
- Verify the correct rule was removed from the UI and the yaml preview
- Create multiple actions of the same type and change various other parameters to distinguish between them
- Remove the first action
- Verify the correct action was removed from the UI and the yaml preview
Related to #433293 (closed)
Edited by Alexander Turinske