Skip to content

Commit f5a6414

Browse files
committed
Refactor to use show_epss_chart flag
Signed-off-by: Sampurna Pyne <sampurnapyne1710@gmail.com>
1 parent b517f23 commit f5a6414

6 files changed

Lines changed: 7 additions & 14 deletions

File tree

vulnerabilities/templates/advisory_detail.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
</ul>
102102
</div>
103103
<div id="tab-content">
104-
<div class="tab-div {% if not 'epss_page' in request.GET %}is-active{% endif %}" data-content="essentials">
104+
<div class="tab-div is-active" data-content="essentials">
105105
<div class="tab-nested-div">
106106
<table class="table vcio-table width-100-pct mt-2">
107107
<tbody>
@@ -797,9 +797,9 @@
797797
</section>
798798
{% endif %}
799799

800-
<script src="{% static 'js/main.js' %}"></script>
800+
<script src="{% static 'js/main.js' %}" crossorigin="anonymous"></script>
801801

802-
{% if 'epss_page' in request.GET or severities %}
802+
{% if show_epss_chart %}
803803
<link rel="stylesheet" href="{% static 'css/billboard.css' %}">
804804
<script src="{% static 'js/d3.js' %}"></script>
805805
<script src="{% static 'js/billboard.js' %}"></script>

vulnerabilities/tests/test_epss_history.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
import json
1111
import time
12-
import pytest
1312
from pathlib import Path
1413

14+
import pytest
1515
from django.test import TestCase
1616
from django.urls import reverse
1717

vulnerabilities/views.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
from django.db.models import Max
2929
from django.db.models import OuterRef
3030
from django.db.models import Prefetch
31-
from django.core.paginator import Paginator
3231
from django.db.models import Q
3332
from django.db.models.functions import Cast
3433
from django.db.models.functions import TruncDate
@@ -806,6 +805,8 @@ def add_ssvc(ssvc):
806805
advisory, self.request.GET.get("epss_page")
807806
)
808807

808+
show_epss_chart = "epss_page" in self.request.GET or advisory.severities.exists()
809+
809810
context.update(
810811
{
811812
"advisory": advisory,
@@ -819,6 +820,7 @@ def add_ssvc(ssvc):
819820
"epss_data": epss_data,
820821
"epss_history_data": epss_history_data,
821822
"epss_pagination_obj": epss_pagination_obj,
823+
"show_epss_chart": show_epss_chart,
822824
}
823825
)
824826
return context

vulnerablecode/static/css/custom.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -655,4 +655,3 @@ ul.fixed_by_bullet li li li {
655655
box-shadow: none;
656656
}
657657
}
658-

vulnerablecode/static/js/billboard.js.ABOUT

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,3 @@ licenses:
1212
- key: mit
1313
name: MIT License
1414
file: billboard.js.LICENSE
15-
16-
17-

vulnerablecode/static/js/d3.js.ABOUT

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,3 @@ licenses:
1212
- key: isc
1313
name: ISC License
1414
file: d3.js.LICENSE
15-
16-
17-
18-
19-

0 commit comments

Comments
 (0)