Find empty component


I'm trying to clean up my project and I'm looking for a way to easily find all components that is not connected to any issue. I guess I could try to delete them one-by-one and get the warnings dialog which states if a component is safe to delete (empty) or not. But that is not a very good or safe way to handle it...

Any ideas?



2 answers

1 accepted

You can use this sample JS code to delete all unused components (just replace the project key on the first line in the url):

AJS.$.getJSON( "/rest/api/2/project/SD/components", function( data) {
  AJS.$(data).each(function(i,e) {
		AJS.$.getJSON( "/rest/api/2/component/""/relatedIssueCounts", function(data) {
				if(data.issueCount == 0) {					
					  url: '/rest/api/2/component/',
					  type: 'DELETE'

0 votes

The quick and cheap way I do this is to define a filter that lists all the issues in the project, then use it in a "filter statistics" gadget with component as the stat. That gets you a list of all the components that HAVE been used, which you can then compare with the full list of all components.

It's not ideal - subtracting "used" from "all", but I think it may be the quickest without code or trying stuff out. (Additional benefit is you find out if you've got low-usage components that might be better deleted or merged)

Not an ideal way but sure, I guess that works.

An one bonus point for the "find low-used" components. :)


Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,760 views 11 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot