Add GQL mutation to update catalog resource to draft state
What does this MR do and why?
This MR adds a GraphQL mutation that updates a catalog resource to draft
state. The required argument is the Global ID of the catalog resource.
The action term used is unpublish
, equivalent to "update state to draft
".
Resolves #428439 (closed)
How to set up and validate locally
- Create at least one catalog resource. You can also create one in the Rails console like so:
Ci::Catalog::Resource.create(project: <YOUR-PROJECT>)
- Update your catalog resource to
published
state:
catalog_resource.update!(state: :published)
- Get the GID of that resource:
catalog_resource.to_gid
- Go to
http://gdk.test:3000/-/graphql-explorer
and test the following query:
mutation {
catalogResourceUnpublish(input: { id: "<CATALOG-RESOURCE-GID>" }) {
errors
}
}
- The result should show no errors. Recheck the catalog resource's state and confirm it is now
draft
:
catalog_resource.reload
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #428439 (closed)
Edited by Leaminn Ma