Skip to content

Commit a61d54d

Browse files
committed
Add ability to show Assignee
1 parent 85fe429 commit a61d54d

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

jira-dependency-graph.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def __init__(self, url, auth, no_verify_ssl):
2929
self.url = url + '/rest/api/latest'
3030
self.auth = auth
3131
self.no_verify_ssl = no_verify_ssl
32-
self.fields = ','.join(['key', 'summary', 'status', 'description', 'issuetype', 'issuelinks', 'subtasks'])
32+
self.fields = ','.join(['key', 'summary', 'status', 'assignee', 'description', 'issuetype', 'issuelinks', 'subtasks'])
3333

3434
def get(self, uri, params={}):
3535
headers = {'Content-Type' : 'application/json'}
@@ -65,7 +65,7 @@ def get_issue_uri(self, issue_key):
6565

6666

6767
def build_graph_data(start_issue_key, jira, excludes, show_directions, directions, includes, issue_excludes,
68-
ignore_closed, ignore_epic, ignore_subtasks, traverse, word_wrap):
68+
ignore_closed, ignore_epic, ignore_subtasks, traverse, word_wrap, show_assignee):
6969
""" Given a starting image key and the issue-fetching function build up the GraphViz data representing relationships
7070
between issues. This will consider both subtasks and issue links.
7171
"""
@@ -83,6 +83,9 @@ def get_status_color(status_field):
8383
def create_node_text(issue_key, fields, islink=True):
8484
summary = fields['summary']
8585
status = fields['status']
86+
assignee = ''
87+
if show_assignee and 'assignee' in fields and fields['assignee']:
88+
assignee = '<BR/><I>' + fields['assignee']['displayName'] + '</I>'
8689

8790
if word_wrap == True:
8891
if len(summary) > MAX_SUMMARY_LENGTH:
@@ -98,7 +101,8 @@ def create_node_text(issue_key, fields, islink=True):
98101

99102
if islink:
100103
return '"{}\\n({})"'.format(issue_key, summary)
101-
return '"{}\\n({})" [href="{}", fillcolor="{}", style=filled]'.format(issue_key, summary, jira.get_issue_uri(issue_key), get_status_color(status))
104+
return '"{}\\n({}){}" [href="{}", fillcolor="{}", style=filled]'.format(issue_key, summary, assignee, jira.get_issue_uri(issue_key), get_status_color(status))
105+
102106

103107
def process_link(fields, issue_key, link):
104108
if 'outwardIssue' in link:
@@ -251,6 +255,7 @@ def parse_args():
251255
parser.add_argument('-t', '--ignore-subtasks', action='store_true', default=False, help='Don''t include sub-tasks issues')
252256
parser.add_argument('-T', '--dont-traverse', dest='traverse', action='store_false', default=True, help='Do not traverse to other projects')
253257
parser.add_argument('-w', '--word-wrap', dest='word_wrap', default=False, action='store_true', help='Word wrap issue summaries instead of truncating them')
258+
parser.add_argument('-b', '--show-assignee', dest='show_assignee', default=False, action='store_true', help='Show assignee in issues')
254259
parser.add_argument('--no-verify-ssl', dest='no_verify_ssl', default=False, action='store_true', help='Don\'t verify SSL certs for requests')
255260
parser.add_argument('issues', nargs='*', help='The issue key (e.g. JRADEV-1107, JRADEV-1391)')
256261
return parser.parse_args()
@@ -290,7 +295,7 @@ def main():
290295
for issue in options.issues:
291296
graph = graph + build_graph_data(issue, jira, options.excludes, options.show_directions, options.directions,
292297
options.includes, options.issue_excludes, options.closed, options.ignore_epic,
293-
options.ignore_subtasks, options.traverse, options.word_wrap)
298+
options.ignore_subtasks, options.traverse, options.word_wrap, options.show_assignee)
294299

295300
if options.local:
296301
print_graph(filter_duplicates(graph), options.node_shape)

0 commit comments

Comments
 (0)