Allow the ability to re-order designs
Problem to solve
Currently, designs are presented ordered by their created date. This prevents users from ordering the designs in a way that makes sense (e.g. to show flows or progressions through the UI).
Further details
The manual sort order can be re-ordered by anyone with edit access to the issue (just like anyone can edit a description on an issue) but the order is saved and not altered until manually changed again.
@jareko
Prototype byhttps://codepen.io/jareko999/full/BaaRYog
Documentation
- Design management documentation should be updated
Proposal
We would like to allow certain users to be able to re-order the designs, manually. This new order would be preserved when another user views the designs.
When new designs are uploaded, they will be inserted at the end of the list, not the beginning.
Backend Planning Comments
MR Breakdown
- 1 MR to add the new DB column
- 1 MR to add a new GraphQL endpoint to reorder a design
- Database migration (uniquely constrained on
issue_id
) - Model property (a unique constraint on new order property and
issue_id
) - Data migration to set order properties on existing designs according to existing sort
- New
update_design
permission defined (would follow the existing permissions forcreate_design
anddestroy_design
) and exposed onDesignPermissions
GraphQL type - Service for setting order
- It would accept these arguments:
design_id
new_index
-
old_index
- sanity check. Service will return an error if this doesn't match current index of design
- It would return an error if the user does not have
update_design
(new permission added above) on the design - It would return the design that was updated
- It would accept these arguments:
- Change to
DesignsFinder
to use ordering scope - Expose order in GraphQL
DesignType
- GraphQL mutation for setting order
- Would authorize the user has
update_design
(new permission added above) on the design
- Would authorize the user has
Proposed GraphQL mutation schema:
designManagementDesignSetIndex(input: { design_id:, new_index:, old_index: }) {
designCollection {
...
}
errors
}
Testing Activity
If a custom order is present:
- Order should be kept if designs in the beginning/middle/end are deleted
- Newly added designs should be inserted at the end (or at the beginning?)
If a custom order is not present:
- Adding/deleting designs should behave as before
@.luke: Unit tests:
- Service
- DesignFinder changes
- GraphQL Type changes
- GraphQL mutation(s)
Request spec:
- GraphQL mutation(s)
All tests including permissions, handling bad data
Security Testing
- re-use an existing permission.