Skip to content

Allow filtering work items by Key Result type

Related to #385084 (closed)

What does this MR do and why?

Adds the ability to filter work items by type KEY_RESULT using GraphQL.

How to set up and validate locally

  1. Enable feature flag in rails console
    Feature.enable(:okrs_mvc)
  2. Visit http://gdk.test:3000/-/graphql-explorer and create work items with different types:
create work item mutations
mutation createKeyResult {
  workItemCreate(
    input: {title: "Key Result 1", projectPath: "gitlab-org/gitlab-test", workItemTypeId: "gid://gitlab/WorkItems::Type/2417"}
  ) {
    workItem {
      title
    }
    errors
  }
}

mutation createObjective {
  workItemCreate(
    input: {title: "Objective 1", projectPath: "gitlab-org/gitlab-test", workItemTypeId: "gid://gitlab/WorkItems::Type/2416"}
  ) {
    workItem {
      title
    }
    errors
  }
}

mutation createIssue {
  workItemCreate(
    input: {title: "Issue 1", projectPath: "gitlab-org/gitlab-test", workItemTypeId: "gid://gitlab/WorkItems::Type/1"}
  ) {
    workItem {
      title
    }
    errors
  }
}
  1. Query the project's work items using the types filter:
query keyResults {
  project(fullPath: "gitlab-org/gitlab-test") {
    workItems(types: KEY_RESULT) {
      edges {
        node {
          title
        }
      }
    }
  }
}
  1. The response should only contain key results
{"data": {"project": {"workItems": {"edges": [{"node": {"title": "Key Result 1"}}]}}}}

MR acceptance checklist

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

Edited by Eugenia Grieff

Merge request reports

Loading