Skip to content

Commit 7a3ecff

Browse files
committed
Fix See Trend and See Table on EPSS tab
Signed-off-by: Sampurna Pyne <sampurnapyne1710@gmail.com>
1 parent e1dd885 commit 7a3ecff

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

vulnerabilities/templates/advisory_detail.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -505,10 +505,10 @@
505505
</div>
506506

507507
<div class="mb-4 ml-1">
508-
<button id="btn-load-epss-chart" class="button is-small is-info is-outlined mr-2">
508+
<button id="btn-load-epss-chart" class="button is-small is-info mr-2">
509509
See Trend
510510
</button>
511-
<button id="btn-load-epss-table" class="button is-small is-info is-outlined">
511+
<button id="btn-load-epss-table" class="button is-small is-info">
512512
See Table
513513
</button>
514514
</div>

vulnerablecode/static/js/advisory_detail.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,19 @@
88
const getHistoryData = () => JSON.parse(document.getElementById('epss-history-data')?.textContent || "[]");
99
const toggleDisplay = (el) => el.style.display = el.style.display === "none" ? "block" : "none";
1010

11+
const updateBtn = (btn, wrap) => {
12+
if (!btn || !wrap) return;
13+
const isHidden = wrap.style.display === "none";
14+
btn.textContent = btn.textContent.replace(isHidden ? "Hide" : "See", isHidden ? "See" : "Hide");
15+
};
16+
1117
function renderChart() {
1218
const data = getHistoryData();
1319
if (!data.length) return;
1420

1521
toggleDisplay(chartWrap);
22+
updateBtn(btnChart, chartWrap);
23+
1624
if (chartWrap.style.display === "none" || epssChartInstance) return;
1725

1826
const history = [];
@@ -62,5 +70,11 @@
6270
}
6371

6472
btnChart?.addEventListener("click", renderChart);
65-
btnTable?.addEventListener("click", () => toggleDisplay(tableWrap));
73+
btnTable?.addEventListener("click", () => {
74+
toggleDisplay(tableWrap);
75+
updateBtn(btnTable, tableWrap);
76+
});
77+
78+
updateBtn(btnChart, chartWrap);
79+
updateBtn(btnTable, tableWrap);
6680
})();

0 commit comments

Comments
 (0)