Skip to content

Draft: Add default hierarchy restrictions

Jan Provaznik requested to merge jp-hierarchy-poc into master

What does this MR do and why?

POC how usage of hierarchy restrictions might look like.

Related to #378058 (closed)

Example of query to get list of types which can be added to work item being displayed (related to #378890 (closed)):

query {
  workItem(id: "gid://gitlab/WorkItem/620") {
    widgets {
      ... on WorkItemWidgetHierarchy {
        allowedChildrenTypes {
          nodes{
            id
            name
          }
        }
      }
    }
  }
}

Example of mutation to add key result as a child to objective (related to #381817 (closed) and #381833 (closed)):

mutation {
  workItemCreate(input: {projectPath: "flightjs/Flight",title: "h3-test", workItemTypeId: "gid://gitlab/WorkItems::Type/92", hierarchyWidget: {parentId: "gid://gitlab/WorkItem/630"}}) {
    errors
  	workItem {
    	id
    	workItemType {
	      id
  	    name
    	}
    	widgets {
      	... on WorkItemWidgetHierarchy {
          parent {
            id
            title
          }
          availableChildrenTypes {
            nodes{
            	id
            	name
            }
          }
      	  }
    	}
    }
  }
}

Remove parent for a work item type (no change - works as is now - just by setting null parent_id):

mutation {
  workItemUpdate(input: {id: "gid://gitlab/WorkItem/634", hierarchyWidget: {parentId: null}}) {
    errors
  }
}

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

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 Jan Provaznik

Merge request reports