Skip to content

Add GQL mutation to update catalog resource to draft state

Leaminn Ma requested to merge gql-update-catalog-resource-to-draft into master

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

  1. Create at least one catalog resource. You can also create one in the Rails console like so:
Ci::Catalog::Resource.create(project: <YOUR-PROJECT>)
  1. Update your catalog resource to published state:
catalog_resource.update!(state: :published)
  1. Get the GID of that resource:
catalog_resource.to_gid
  1. Go to http://gdk.test:3000/-/graphql-explorer and test the following query:
mutation {
  catalogResourceUnpublish(input: { id: "<CATALOG-RESOURCE-GID>" }) {
    errors
  }
}
  1. The result should show no errors. Recheck the catalog resource's state and confirm it is now draft:

Screenshot_2023-10-18_at_1.19.49_PM

catalog_resource.reload

Screenshot_2023-10-18_at_1.20.03_PM

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #428439 (closed)

Edited by Leaminn Ma

Merge request reports