Skip to content

Commit 8bea46a

Browse files
authored
Merge pull request DefectDojo#1498 from Maffooch/jira_cols
Remove JIRA status if product is not configured
2 parents 997e8da + 6cf3a05 commit 8bea46a

File tree

4 files changed

+45
-34
lines changed

4 files changed

+45
-34
lines changed

dojo/finding/views.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,20 @@ def open_findings(request, pid=None, eid=None, view=None):
115115

116116
product_tab = None
117117
active_tab = None
118+
jira_config = None
118119

119120
# Only show product tab view in product or engagement
120121
if pid:
121122
show_product_column = False
122123
product_tab = Product_Tab(pid, title="Findings", tab="findings")
124+
jira_config = JIRA_PKey.objects.filter(product=pid)[0].conf_id
123125
elif eid and pid_local:
124126
show_product_column = False
125127
product_tab = Product_Tab(pid_local, title=eng.name, tab="engagements")
128+
jira_config = JIRA_PKey.objects.filter(product__engagement=eid)[0].conf_id
126129
else:
127130
add_breadcrumb(title="Findings", top_level=not len(request.GET), request=request)
128-
131+
# raise Exception('Stop')
129132
return render(
130133
request, 'dojo/findings_list.html', {
131134
'show_product_column': show_product_column,
@@ -138,6 +141,7 @@ def open_findings(request, pid=None, eid=None, view=None):
138141
'filter_name': filter_name,
139142
'title': title,
140143
'tag_input': tags,
144+
'jira_config': jira_config,
141145
})
142146

143147

dojo/templates/dojo/findings_list.html

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,10 @@ <h3 class="has-filters">
138138
<th>Status</th>
139139
<th></th>
140140
{% if "enable_jira"|get_system_setting %}
141-
<th>JIRA Age</th>
142-
<th>JIRA Change</th>
141+
{% if jira_config and product_tab or not product_tab %}
142+
<th>JIRA Age</th>
143+
<th>JIRA Change</th>
144+
{% endif %}
143145
{% endif%}
144146
{% if show_product_column and product_tab is None %}
145147
<th class="nowrap">{% dojo_sort request 'Product' 'test__engagement__product__name'%}</th>
@@ -318,21 +320,21 @@ <h3 class="has-filters">
318320
{% endif %}
319321
{% endif %}
320322
</td>
321-
322-
<td class="nowrap">
323-
{% if "enable_jira"|get_system_setting %}
324-
{% if finding.jira_creation %}
325-
{{ finding.jira_creation|timesince }}
326-
{% endif %}
327-
{% endif %}
328-
</td>
329-
<td class="nowrap">
330-
{% if "enable_jira"|get_system_setting %}
331-
{% if finding.jira_change %}
332-
{{ finding.jira_change|timesince }}
333-
{% endif %}
323+
{% if "enable_jira"|get_system_setting %}
324+
{% if jira_config and product_tab or not product_tab %}
325+
<td class="nowrap">
326+
{% if finding.jira_creation %}
327+
{{ finding.jira_creation|timesince }}
328+
{% endif %}
329+
</td>
330+
<td class="nowrap">
331+
{% if finding.jira_change %}
332+
{{ finding.jira_change|timesince }}
333+
{% endif %}
334+
</td>
334335
{% endif %}
335-
</td>
336+
{% endif %}
337+
336338

337339

338340
{% if show_product_column and product_tab is None %}

dojo/templates/dojo/view_test.html

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,11 @@ <h4 class="pull-left"> Findings ({{findings_count}}) <small>{{ test.id|get_sever
196196
<th>Reporter</th>
197197
<th>Status</th>
198198
{% if "enable_jira"|get_system_setting %}
199-
<th>Jira</th>
200-
<th>Jira Age</th>
201-
<th>Jira Change</th>
199+
{% if jira_config and product_tab or not product_tab %}
200+
<th>Jira</th>
201+
<th>Jira Age</th>
202+
<th>Jira Change</th>
203+
{% endif %}
202204
{% endif %}
203205
</tr>
204206
</thead>
@@ -420,23 +422,24 @@ <h4 class="pull-left"> Findings ({{findings_count}}) <small>{{ test.id|get_sever
420422
{% endif %}
421423
</td>
422424
{% if "enable_jira"|get_system_setting %}
423-
<td>
424-
<a href="{{finding.jira_conf.url}}/browse/{{finding.jira.jira_key}}" target="_blank"> {{finding.jira.jira_key}} </a>
425-
</td>
426-
<td class="nowrap">
427-
{% if "enable_jira"|get_system_setting %}
425+
{% if jira_config and product_tab or not product_tab %}
426+
<td>
427+
<a href="{{finding.jira_conf.url}}/browse/{{finding.jira.jira_key}}" target="_blank"> {{finding.jira.jira_key}} </a>
428+
</td>
429+
428430
{% if finding.jira_creation %}
429-
{{ finding.jira_creation|timesince }}
431+
<td class="nowrap">
432+
{{ finding.jira_creation|timesince }}
433+
</td>
430434
{% endif %}
431-
{% endif %}
432-
</td>
433-
<td class="nowrap">
434-
{% if "enable_jira"|get_system_setting %}
435+
435436
{% if finding.jira_change %}
436-
{{ finding.jira_change|timesince }}
437+
<td class="nowrap">
438+
{{ finding.jira_change|timesince }}
439+
</td>
437440
{% endif %}
438-
{% endif %}
439-
</td>
441+
442+
{% endif %}
440443
{% endif %}
441444
</tr>
442445
{% endfor %}

dojo/test/views.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def view_test(request, tid):
7070

7171
product_tab = Product_Tab(prod.id, title="Test", tab="engagements")
7272
product_tab.setEngagement(test.engagement)
73+
jira_config = JIRA_PKey.objects.filter(product=prod.id)[0].conf_id
7374
return render(request, 'dojo/view_test.html',
7475
{'test': test,
7576
'product_tab': product_tab,
@@ -83,7 +84,8 @@ def view_test(request, tid):
8384
'show_re_upload': show_re_upload,
8485
'creds': creds,
8586
'cred_test': cred_test,
86-
'tag_input': tags
87+
'tag_input': tags,
88+
'jira_config': jira_config,
8789
})
8890

8991

0 commit comments

Comments
 (0)