Alerting: Allow inserting before or after existing policy #83704
+400
−81
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.
What is this feature?
This PR introduces the ability to insert a new policy before or after an existing notification policy.
We currently do not have the ability to re-order notification policies and prior attempts have shown to have some rough edges; re-ordering nodes in large trees was slow, not accessible and hard to figure out now that pagination has been added to the policy tree.
Instead this PR adds the ability to choose where to insert new policies.
A move operation would be a delete + insert at position, with the caveat that label matchers would have to be copied / memorised by the user somewhere.
We feel like this is an acceptable compromise considering that operations on the tree wrt to moving the order of policies is quite rare and often required because the policy they had just inserted got appended to the bottom of the child policies.
Which issue(s) does this PR fix?:
Fixes #60101
Special notes for your reviewer:
Needs a few tests before merging to make sure the
insertBefore
/insertAfter
functions work as intended.Please check that: