Archive Label GraphQL endpoint
-
Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA. As a benefit of being a GitLab Community Contributor, you receive complimentary access to GitLab Duo.
What does this MR do and why?
Adds a GraphQL endpoint to update the archived attribute of labels.
This MR is a prerequisite for #554227 (closed). We need to add the API first, in order to be able to archive/unarchive the label from the frontend.
Labels in labels list
- When a label is not archived, add an action from the Labels list "Archive". This should be the last action in the ellipsis menu.
- When a label is archived, add an action from the Labels list "Unarchive". This should be the first action in the ellipsis menu.
References
Issue: #4233
Screenshots
How to set up and validate locally
- Enable feature flag with
rails c:
Feature.enable(:labels_archive)
- Get the global label id from a label:
Label.last.to_global_id - Use curl or the GraphQL explorer to mutate the label. Change
idandarchivedin the variables:
curl --request POST \
--url https://gdk.test:3443/api/graphql \
--header 'Authorization: Bearer <glpat>' \
--header 'Content-Type: application/json' \
--data '{
"query": "mutation labelUpdate($id: LabelID!, $archived: Boolean) {\n labelUpdate(input: { id: $id, archived: $archived }) {\n label {\n id\n archived\n }\n errors\n }\n}\n",
"operationName": "labelUpdate",
"variables": {
"id": "gid://gitlab/ProjectLabel/78",
"archived": true
}
}'
mutation labelUpdate($id: LabelID!, $archived: Boolean) {
labelUpdate(input: { id: $id, archived: $archived }) {
label {
id
archived
}
errors
}
}
{
"id": "gid://gitlab/ProjectLabel/780",
"archived": true
}
MR acceptance checklist
checklist
-
Changelog entry added, if necessary -
Documentation created/updated via this MR -
Documentation reviewed by technical writer or follow-up review issue created -
Tests added for this feature/bug -
Tested in all supported browsers -
Conforms to the code review guidelines -
Conforms to the merge request performance guidelines -
Conforms to the style guides -
Conforms to the javascript style guides -
Conforms to the database guides
Related to #4233
Edited by Nicholas Wittstruck
