Skip to content

Handle "All branches" and "All protected branches"

Description

As part of the MVC &8075 (closed) for editing branch rules, we need to implement the ability to handle all branches and all protected branches scenario so that users can manage rules for branches in a project.

Scope

As we don't have a BranchRule model we can either spoof the creation step or create a new BranchRule model.

Spoofing:

User clicks Add branch rule > All branches/All protected branches and then we show the details page but instead of showing an actual record we just show a blank page. Then the user can add an approval rule or status check.

This will allow us to bypass adding a new model but will also mean if the user returns to the Branch Rules overview page without adding an approval rule or status check the Branch Rule would not be shown as it doesn't actually exist.

Implementation plan

Ensure the details page displays correctly when displaying All branches or All protected branches when no rules exist currently

  • Backend: display rule details without creating rule (?)
  • Frontend: Updates the branch rule details with:
    • Hide sections that are only applicable to branch name/pattern rules.
      • Section to be hidden: “Branch protections”
      • Section to show:
        • Rule details
        • Merge Request Approvals
        • Status checks

Mockups & behaviour

Figma

  • From branch rules list and "Add branch rule" is clicked
    • Select "All branches" or "All protected branches"
  • Edit branch rules only shows the following sections:
    • Rule details
    • Merge request approvals
    • Status checks
Description Mockup
Add from branch rules list image
Edit branch rules: All branches image
Edit branch rule: All protected branches image
Edited by André Luís