Skip to content

batches: Add query to determine available bulk operations

Administrator requested to merge bo/add-query-available-bulk-ops into main

Created by: BolajiOlajide

Description

This pull request moves the logic of determining what Bulk Operations apply to a number of selected changesets to the backend.

Screenshot 2022-03-25 at 17 29 58 Screenshot 2022-03-25 at 17 30 09

Test plan

  1. Navigate to a batch change page. Example https://sourcegraph.test:3443/users/bolaji/batch-changes/all-drafts-all-the-time?visible=2.
  2. Ensure the batch change contains a number of changesets.
  3. Select a number of changesets, and the bulk operation option should be shown Screenshot 2022-03-25 at 17 30 09
  4. The option displayed should match bulk operations that can be performed on the selected changesets depending on their statuses.

Logic Breakdown

  • Changesets belonging to an archived batch change have the following bulk operations available:

    • COMMENT
    • DETACH
  • Changesets with a FAILED reconciler state have the following bulk operations available:

    • REENQUEUE
  • Changesets in an UNPUBLISHED state have the following bulk operations available:

    • PUBLISH
  • Changesets in a DRAFT state have the following bulk operations available:

    • COMMENT
    • CLOSE
    • PUBLISH
  • Changesets that are in an OPEN state have the following bulk operations available:

    • COMMENT
    • CLOSE
    • PUBLISH
    • MERGE
  • Changesets in a CLOSED state have the following bulk operations available:

    • COMMENT
  • MERGED changesets have the following bulk operations available

    • COMMENT
    • CLOSE

Closes #21185

App preview:

Merge request reports

Loading