diff --git a/web/startScan/templates/startScan/detail_scan.html b/web/startScan/templates/startScan/detail_scan.html index ffecb9b88..2e3dc6471 100644 --- a/web/startScan/templates/startScan/detail_scan.html +++ b/web/startScan/templates/startScan/detail_scan.html @@ -1034,7 +1034,7 @@ Scan Findings
-
+
@@ -1536,6 +1536,11 @@ $(document).ready(function() { // vulnerability datatable const ps2 = new PerfectScrollbar(document.querySelector('.vulnerability-search')); $("#pills-vulnerabilities-tab").click(function() { + // prevent table loading twice + // https://datatables.net/manual/tech-notes/3 + if ( $.fn.dataTable.isDataTable( '#vulnerability_results' ) ) { + return false; + } var is_grouping = false; var grouping_col = 3; var vuln_ajax_url = '/api/listVulnerability/?scan_history={{scan_history_id}}&format=datatables'; @@ -1777,6 +1782,10 @@ $(document).ready(function() { }); }); + $('#reload_vulnerabilities_table_btn').click(function () { + vulnerability_table.ajax.reload(); + }); + $('#vulnerability-search-button').click(function () { vulnerability_table.search($('#vulnerability-search').val()).draw() ; }); @@ -2011,6 +2020,9 @@ $(document).ready(function() { {% if 'screenshot' in history.tasks %} $("#pills-screenshot-tab").click(function() { + if($('#screenshots-table').children().length > 0) { + return false; + } get_screenshot({{scan_history_id}}); //animate search placeholder @@ -2095,6 +2107,9 @@ $(document).ready(function() { }); $("#pills-visualisation-tab").click(function() { + if($('#visualisation').children().length > 0) { + return false; + } visualise_scan_results({{scan_history_id}}); }); @@ -2111,6 +2126,11 @@ $(document).ready(function() { {% endif %} $("#pills-subdomain-tab").click(function() { + // prevent table loading twice + // https://datatables.net/manual/tech-notes/3 + if ( $.fn.dataTable.isDataTable( '#subdomain_scan_results' ) ) { + return false; + } var subdomain_ajax_url = '/api/listDatatableSubdomain/?project={{current_project.slug}}&scan_id={{scan_history_id}}&format=datatables'; var is_subd_grouping = false; var subd_grouping_col = 8; diff --git a/web/startScan/templates/startScan/vulnerabilities.html b/web/startScan/templates/startScan/vulnerabilities.html index 9c7c4631e..65c339228 100644 --- a/web/startScan/templates/startScan/vulnerabilities.html +++ b/web/startScan/templates/startScan/vulnerabilities.html @@ -323,6 +323,9 @@ $(document).ready(function() { } }); }); + $('#reload_vulnerabilities_table_btn').click(function () { + vulnerability_table.ajax.reload(); + }); }); var vulnerability_cols = [ diff --git a/web/targetApp/templates/target/summary.html b/web/targetApp/templates/target/summary.html index 4d7f94b27..517501f0b 100644 --- a/web/targetApp/templates/target/summary.html +++ b/web/targetApp/templates/target/summary.html @@ -903,14 +903,19 @@ $(document).ready(function(){ chart.render() $("#pills-subdomain-tab").click(function() { - var subdomain_ajax_url = '/api/listDatatableSubdomain/?project={{current_project.slug}}&target_id={{target.id}}&format=datatables'; + // prevent table loading twice + // https://datatables.net/manual/tech-notes/3 + if ( $.fn.dataTable.isDataTable( '#subdomain_scan_results' ) ) { + return false; + } + var subdomain_ajax_url = '/api/listDatatableSubdomain/?project={{current_project.slug}}&scan_id={{target.id}}&format=datatables'; var is_subd_grouping = false; var subd_grouping_col = 8; var subdomain_datatables = $('#subdomain_scan_results').DataTable({ "headerCallback": function(e, a, t, n, s) { e.getElementsByTagName("th")[0].innerHTML='
\nc
\n' }, - "destroy": true, + "destroy": false, "processing": true, "oLanguage": subdomain_oLanguage, "fnCreatedRow": function (nRow, aData, iDataIndex) { @@ -1335,11 +1340,16 @@ $(document).ready(function(){ }); $("#pills-vulnerabilities-tab").click(function() { + // prevent table loading twice + // https://datatables.net/manual/tech-notes/3 + if ( $.fn.dataTable.isDataTable( '#vulnerability_results' ) ) { + return false; + } var is_grouping = false; var grouping_col = 3; var vuln_ajax_url = '/api/listVulnerability/?target_id={{target.id}}&format=datatables'; var vulnerability_table = $('#vulnerability_results').DataTable({ - "destroy": true, + "destroy": false, "oLanguage": { "oPaginate": { "sPrevious": '', @@ -1558,6 +1568,9 @@ $(document).ready(function(){ } }); }); + $('#reload_vulnerabilities_table_btn').click(function() { + vulnerability_table.ajax.reload(); + }); // column visibility vulnerability_datatable_col_visibility(vulnerability_table); }, diff --git a/web/templates/base/_items/vulnerability_tab_content.html b/web/templates/base/_items/vulnerability_tab_content.html index 675f13578..8c309842b 100644 --- a/web/templates/base/_items/vulnerability_tab_content.html +++ b/web/templates/base/_items/vulnerability_tab_content.html @@ -25,7 +25,7 @@ -
-