Add columns to Issue Links Pane

Erwin Manuel March 8, 2012

Hi,

We want to know the possibility of adding columns to the Issue Links. Please refer to the Screenshot:

9 answers

1 vote
Massimo Prevignano January 8, 2014

Hi, I also had the needs to add some coulmn information in the issue links table in Jira 4.4.5. I found the way changing the "jira-view-issue-plugin" in the Jira source code.

I changed the following files in the plugin: "LinkBlockContextProvider.java" and "linkblock.vm"

For example if you want to add the assignee column you need to add in the "class SimpleLinkedIssue" the following code in the file "LinkBlockContextProvider.java":

public String getAssignee()
{
   return linkedIssue.getAssigneeUser().getDisplayName();
}

and in the "linkblock.vm" :

<td class="assignee">            
   ${linkIssue.assignee}       
</td>

in the <tr> after "#foreach (${linkIssue} in ${linkedIssues})" code

BR
Massimo
0 votes
Ruben Mangas August 6, 2020

Hi,

 

Following the idea of :

 

https://community.atlassian.com/t5/Jira-questions/How-do-you-add-a-column-to-quot-Issues-in-Epic-quot-panel/qaq-p/292561

 

And the idea this question, I have created an script to be included in the JIRA banner to add the fixversion in the issue link section, but just for specific projects and specific links.

 

 

<link type="text/css" rel="stylesheet" href="/s/db3b6a62696fa11def130a371ef1a39f-CDN/en_USoe5giz/64016/96/7df3cf06a8aa5b431658f0bcaee3999a/_/download/contextbatch/css/jira.navigator.simple,jira.navigator.advanced,jira.view.issue,atl.general,jira.navigator.kickass,jira.global,jira.general/batch.css?jag_disabled_marketing=true&amp;user-logged-in=true&amp;hc-enabled=true" media="all">

<script type='text/javascript'>
AJS.$(document).ready(function()
{

var objPageHeader = AJS.$(document).find('div.aui-page-header-main');
var myIssueKey = "";
if (objPageHeader.length) { myIssueKey = AJS.$(objPageHeader).find('a.issue-link').attr("data-issue-key"); }
//window.alert("my-issue-key: " + myIssueKey);

AJS.$('dl.links-list dd').each(function()
{
var objDD = this;

var objIssueLink = AJS.$(objDD).find('a');
var linkedIssueKey = "";
if (objIssueLink.length) {
linkedIssueKey = AJS.$(objIssueLink).attr("data-issue-key");
//window.alert("linked-issue-key: " + linkedIssueKey);
}

if ( myIssueKey.startsWith("LDMSD") && ( linkedIssueKey.startsWith("DMP") || linkedIssueKey.startsWith("LBL") ) )
{
//window.alert("linked-issue-key: " + linkedIssueKey);

AJS.$.getJSON(AJS.contextPath() + '/rest/api/latest/issue/' + linkedIssueKey, function(data)
{

var objSpan = AJS.$(objDD).find('span.link-summary');

if (objSpan.length) {

var value = data.fields.fixVersions.map(function(version){return version.name});

if (value != "")
{
AJS.$(objSpan).after('<span><b> (' + value + ')</b></span>');
}
}



});
}
});

});
</script>

 

In this way, in my case, I can see the fixversion of the linked issues, but just only for the tickets started with LDMSD and only for tickets started with DMP and LBL.

 

hope this hepls!

 

Regards

Nitin chaudhary September 21, 2020

Hello,

 

Solution is working fine, But, after any change in the page like adding comment, inline editing of fix version , adding or deleting issue link the assignee name or the added column name disappears .

Any solution for this ?

 

Regards,

Nitin

0 votes
Peter T
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 17, 2015

Hello,

I am happy to announce that with our recently released Issue Matrix plug-in, changes to the visualization of sub-tasks or linked issues can be done very easily with out custom code or scripting. The changes are also configurable per issue type or project.
In a nutshell Issue Matrix will help displaying not just system fields but any custom field for sub-tasks or linked issues. See more on its functionality here: https://botronsoft.atlassian.net/wiki/display/ILV/Concept and let us know in case you need any support. The attachment shows example how linked issue panel can be improved using Issue Matrix.

Thanks,
Peter T

Linked-Big.jpg

Lee Cash May 20, 2016

Not available on Cloud. As usual. sad

0 votes
Massimo Prevignano April 2, 2014

Hi, I did the same for version 5.2.11. It's more complex of the patch in version 4.4.

The plugin to modify is the same "jira-view-issue-plugin" under "atlassian-jira-5.2.11-source/jira-project/jira-components/jira-plugins" path (hope is the same in v.5.2.2).

The files I modified are:

linkblock.vm:

I add this code after "#if ($hasIssueLinks)" line to have the column name above the list

of issues (to better understand the added column values); you can avoid if you don't need:

&lt;dl class="links-list "&gt;
     &lt;dt title="is related to"&gt;&lt;/dt&gt;
     &lt;dd&gt;&lt;div class="link-content"&gt;
        &lt;table width="100%" class="link-summary" &gt;
           &lt;tr class="link-summary"&gt;
   	      &lt;th width="15%" align="center" class="link-summary"&gt;
	         &lt;span title="Key"&gt;Key&lt;/span&gt;
	      &lt;/th&gt;
	      &lt;th width="40%" align="center" class="link-summary"&gt;
	         &lt;span title="Summary"&gt;Summary&lt;/span&gt;
	      &lt;/th&gt;
	      &lt;th width="15%" align="center" class="link-summary"&gt;
	         &lt;span title="Assignee"&gt;Assignee&lt;/span&gt;
	      &lt;/th&gt;
               &lt;th width="15%" align="center" class="link-summary"&gt;
	               &lt;span title="Status"&gt;Status&lt;/span&gt;
	       &lt;/th&gt;
              &lt;th width="15%" align="center" class="link-summary"&gt;
	         &lt;span title="icons"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;
	      &lt;/th&gt;
	   &lt;/tr&gt; 
        &lt;/table&gt;
     &lt;/div&gt;&lt;/dd&gt;
  &lt;/dl&gt;

localissuelink.vm:

I change this file with a new table to show all column's value; I add this code after the line "#set($contextMap = ${issueLinkContext.map})" :

&lt;table width="100%" &gt;   
   &lt;tr class="link-title#if (${contextMap.resolved}) resolution#end" width="15%"&gt;
      &lt;td&gt;
         &lt;span title="Key"&gt;
         #macro (renderIcon $url $title $alt)
            #if ($url)
               &lt;img src="$url" width="16" height="16" title="$!{title}" alt="$!{alt}" /&gt;
            #end
	 #end
         #set($contextMap = ${issueLinkContext.map})
            &lt;p&gt;
            #renderIcon(${contextMap.iconUrl} ${contextMap.iconTooltip} ${contextMap.iconTooltip})
               &lt;span title="${contextMap.tooltip}"&gt;
                  &lt;a href="${contextMap.url}" class="link-title#if (${contextMap.resolved}) resolution#end"&gt;${contextMap.title}&lt;/a&gt;
               &lt;/span&gt;
            &lt;/p&gt;
         &lt;/span&gt;
      &lt;/td&gt;
      &lt;td width="40%"&gt;
         &lt;span class="link-summary"&gt;$!{contextMap.summary}&lt;/span&gt;
      &lt;/td&gt;
      &lt;td width="15%"&gt;
         &lt;span class="link-summary"&gt;${contextMap.linkIssueAssignee}&lt;/span&gt;
      &lt;/td&gt;
      &lt;td width="15%"&gt;
         &lt;span class="link-summary"&gt;${contextMap.linkIssueStatus}&lt;/span&gt;
      &lt;/td&gt;
      &lt;td width="15%"&gt;
         #if (${contextMap.priorityIconUrl} || ${contextMap.statusIconUrl})
            &lt;ul class="link-snapshot"&gt;
            #if (${contextMap.priorityIconUrl})
               &lt;li class="priority"&gt;#renderIcon(${contextMap.priorityIconUrl} ${contextMap.priorityIconTooltip} ${contextMap.priorityIconTooltip})&lt;/li&gt;
            #end
            #if (${contextMap.statusIconUrl})
               #if (${contextMap.statusIconLink})
                  &lt;li class="status"&gt;&lt;a href="${contextMap.statusIconLink}"&gt;#renderIcon(${contextMap.statusIconUrl} ${contextMap.statusIconTooltip} ${contextMap.statusIconTooltip})

&lt;/a&gt;&lt;/li&gt;
               #else
                  &lt;li class="status"&gt;#renderIcon(${contextMap.statusIconUrl} ${contextMap.statusIconTooltip} ${contextMap.statusIconTooltip})&lt;/li&gt;
               #end
            #end
            &lt;/ul&gt;
         #end   
      &lt;/td&gt;
   &lt;/tr&gt; 
&lt;/table&gt;

Note: change the "width" of the column to fit the content.

LocalIssueLinkUtils.java:

In this file add tha values of our new columns, in the "getLocalIssueLinkVelocityContext" method:

putMap(contextBuilder, "linkIssueProject", (linkedIssue.getProjectObject()!=null?linkedIssue.getProjectObject().getKey():""));
putMap(contextBuilder, "linkIssueAssignee", ((linkedIssue != null &amp;&amp; linkedIssue.getAssigneeUser()!=null)?linkedIssue.getAssigneeUser().getDisplayName():""));
putMap(contextBuilder, "linkIssueStatus", (linkedIssue.getStatusObject()!= null?linkedIssue.getStatusObject().getName():""));

I hope that it helps :)

BR

Massimo

Raju Adluru
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 8, 2014

Hi Massimo

I checked in JIRA 6.2 to add this code, files are different now, and in different location, do you think above change will work in JIRA 6.2 also, can u please confirm, thanks.

Dalectric
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 28, 2014

Massimo, many thanks for posting this modification. This has been very useful.

I've got it working for components in v6.2.7 in the following way (I didn't go for adding a table with a header). Also if anyone can improve my code, please do, I'm still learning.

\jira-project\jira-components\jira-plugins\jira-view-issue-plugin\src\main\java\com\atlassian\jira\plugin\viewissue\issuelink\LocalIssueLinkUtils.java

Added to top

import java.util.Collection;
import java.util.Iterator;
import com.atlassian.jira.bc.project.component.ProjectComponent;

Added after tooltip putmap line

if (linkedIssue.getComponentObjects() != null)  //Added by SRK
			{
				Collection colComponents = linkedIssue.getComponentObjects();
				Iterator&lt;ProjectComponent&gt; compIter = colComponents.iterator();
				String compList = "";
				while(compIter.hasNext()){
					ProjectComponent component = (ProjectComponent)compIter.next();
					if (compList == "") {
					compList = component.getName();
					}
					else {
					compList = compList + ", " + component.getName();
					}
				} 
				putMap(contextBuilder, "component", compList);	
		}

\jira-project\jira-components\jira-plugins\jira-view-issue-plugin\src\main\resources\issuelink\localissuelink.vm

Added below summary paragraph

&lt;p&gt;
	&lt;span class="link-summary"&gt;$!{contextMap.component}&lt;/span&gt;
&lt;/p&gt;

Massimo Prevignano October 9, 2014

Hello Dalectric, thank you very much! I'll need your post next year when I'll upgrade the server to Jira 6.x

0 votes
Adam Hall April 2, 2014

I know this is an old question, but we are running version 5.2.2 and want to add the issue's Fix Version as a column. Is this possible in this version of Jira?

Thanks

0 votes
Renjith Pillai
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 1, 2013

Had a look at the code, I guess it is pretty much restricted about what you can do for this. Even though there are two velocity templates that are used for the rendering, the context that is passed seems to be limited. Sorry, nothing much possible, AFAIK :(

0 votes
Renjith Pillai
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 1, 2013

Read this thread, looks to be similar to what you need https://answers.atlassian.com/questions/33294/jira-issue-link-to-show-assignee-also

Erwin Manuel January 1, 2013

Hi Renjith, the suggested steps in the link does not seem to work.

0 votes
LoneL December 16, 2012

Hi I was looking for the exact same functionality. Want the priority to be shown in a subtask list and thus wants to add that column. Is this something that you are considering for future releases? Br Lone Lauritsen

0 votes
Igor Sereda [ALM Works]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 8, 2012

Not possible in JIRA up to version 5.0, as far as I know

Michael Danielsson
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 6, 2012

Is it possible in newer versions of JIRA?

Suggest an answer

Log in or Sign up to answer