From 8ca6e1a73c3f45a8ceac91770b4df95490d7fb72 Mon Sep 17 00:00:00 2001 From: Terrtia Date: Tue, 18 Jun 2019 16:19:27 +0200 Subject: [PATCH] chg: [UI dashboard + search] bootstrap 4 migration: dashbaord + fix search input --- .../modules/dashboard/templates/index.html | 320 ++++++++---------- var/www/static/js/indexjavascript.js | 177 +++++----- var/www/templates/dashboard/menu_sidebar.html | 41 +++ var/www/templates/nav_bar.html | 7 +- 4 files changed, 270 insertions(+), 275 deletions(-) create mode 100644 var/www/templates/dashboard/menu_sidebar.html diff --git a/var/www/modules/dashboard/templates/index.html b/var/www/modules/dashboard/templates/index.html index 49f3e59b..812e1ea0 100644 --- a/var/www/modules/dashboard/templates/index.html +++ b/var/www/modules/dashboard/templates/index.html @@ -2,23 +2,40 @@ - - - Analysis Information Leak framework Dashboard - - - + + - + + + + + + + - -
- -
-
-
-
-
-
+ +{% include 'nav_bar.html' %} + +
+
+ + {% include 'dashboard/menu_sidebar.html' %} + +
{%if update_in_progress%} -
- × + {%endif%} -
- × - Bootstrap 4 migration! Some pages are still in bootstrap 3. You can check the migration progress Here. + -
-
-
-
- Feeder(s) Monitor: -
-
- - Processed pastes -
-
- Filtered duplicates -
- -
- -
- -
- -
-
-
- Queues Monitor -
-
-
-
-
-
-
- -
- -
- -
- -
-
-
- Logs -
- - INFO - WARNING - CRITICAL +
+
+
+
+ Feeder(s) Monitor: +
+
+ Processed pastes +
+
+ Filtered duplicates +
+
+
+ +
+
+
+ Queues Monitor +
+
+
+
+
+
+ +
+
+
+ + +
+
+ Logs +
+ + INFO + WARNING + CRITICAL + +
+
+ +
+ + + + + + + + + + + + + + + + +
TimeChannelLevelScript NameSourceDatePaste nameMessageActions
+
+
+ +
-
-
-
- - - - - - - - - - - - - - - - -
TimeChannelLevelScript NameSourceDatePaste nameMessageActions
-
-
-
- -
- + +
+
- - + + + - - - - - +function toggle_sidebar(){ + if($('#nav_menu').is(':visible')){ + $('#nav_menu').hide(); + $('#side-bard-dashboard-content').hide(); + $('#side_menu').removeClass('border-right') + $('#side_menu').removeClass('col-lg-2') + $('#core_content').removeClass('col-lg-10') + }else{ + $('#nav_menu').show(); + $('#side-bard-dashboard-content').show(); + $('#side_menu').addClass('border-right') + $('#side_menu').addClass('col-lg-2') + $('#core_content').addClass('col-lg-10') + } +} + diff --git a/var/www/static/js/indexjavascript.js b/var/www/static/js/indexjavascript.js index aead7181..86d00cbb 100644 --- a/var/www/static/js/indexjavascript.js +++ b/var/www/static/js/indexjavascript.js @@ -201,92 +201,94 @@ function create_log_table(obj_json) { return; } - if( chansplit[1] == "INFO" ){ - tr.className = "info"; - } - else if ( chansplit[1] == "WARNING" ){ - tr.className = "warning"; - } - else if ( chansplit[1] == "CRITICAL"){ - tr.className = "danger" - } + if( parsedmess.length>2 ){ + if( chansplit[1] == "INFO" ){ + tr.className = "table-disabled"; + } + else if ( chansplit[1] == "WARNING" ){ + tr.className = "table-log-warning"; + } + else if ( chansplit[1] == "CRITICAL"){ + tr.className = "table-danger" + } - source_link = document.createElement("A"); - if (parsedmess[1] == "slexy.org"){ - source_url = "http://"+parsedmess[1]+"/view/"+parsedmess[3].split(".")[0]; - } - else{ - source_url = "http://"+parsedmess[1]+"/"+parsedmess[3].split(".")[0]; - } - source_link.setAttribute("HREF",source_url); - source_link.setAttribute("TARGET", "_blank"); - source_link.appendChild(document.createTextNode(parsedmess[1])); + source_link = document.createElement("A"); + if (parsedmess[1] == "slexy.org"){ + source_url = "http://"+parsedmess[1]+"/view/"+parsedmess[3].split(".")[0]; + } + else{ + source_url = "http://"+parsedmess[1]+"/"+parsedmess[3].split(".")[0]; + } + source_link.setAttribute("HREF",source_url); + source_link.setAttribute("TARGET", "_blank"); + source_link.appendChild(document.createTextNode(parsedmess[1])); - src.appendChild(source_link); + src.appendChild(source_link); - var now = new Date(); - var timepaste = pad_2(now.getHours()) + ":" + pad_2(now.getMinutes()) + ":" + pad_2(now.getSeconds()); + var now = new Date(); + var timepaste = pad_2(now.getHours()) + ":" + pad_2(now.getMinutes()) + ":" + pad_2(now.getSeconds()); - time.appendChild(document.createTextNode(timepaste)); - chan.appendChild(document.createTextNode(chansplit[0])); - level.appendChild(document.createTextNode(chansplit[1])); + time.appendChild(document.createTextNode(timepaste)); + chan.appendChild(document.createTextNode(chansplit[0])); + level.appendChild(document.createTextNode(chansplit[1])); - scrpt.appendChild(document.createTextNode(parsedmess[0])); - pdate.appendChild(document.createTextNode(parsedmess[2])); - nam.appendChild(document.createTextNode(parsedmess[3])); + scrpt.appendChild(document.createTextNode(parsedmess[0])); + pdate.appendChild(document.createTextNode(parsedmess[2])); + nam.appendChild(document.createTextNode(parsedmess[3])); - var iconspan = document.createElement('SPAN'); - if (parsedmess[4].split(" ")[0] == "Detected"){ - iconspan.className = "glyphicon glyphicon-eye-open"; - } - else if (parsedmess[4].split(" ")[0] == "Checked"){ - iconspan.className = "glyphicon glyphicon-thumbs-up"; - } - iconspan.innerHTML = " "; - msage.appendChild(iconspan); - var message = parsedmess[4].split(" "); - message.shift(); + var iconspan = document.createElement('SPAN'); + if (parsedmess[4].split(" ")[0] == "Detected"){ + iconspan.className = "fas fa-eye"; + } + else if (parsedmess[4].split(" ")[0] == "Checked"){ + iconspan.className = "far fa-thumbs-up"; + } + iconspan.innerHTML = " "; + msage.appendChild(iconspan); + var message = parsedmess[4].split(" "); + message.shift(); - msage.appendChild(document.createTextNode(message.join(" "))); + msage.appendChild(document.createTextNode(message.join(" "))); - var paste_path = parsedmess[5]; - var url_to_saved_paste = url_showSavedPath+"?paste="+paste_path+"&num="+parsedmess[0]; + var paste_path = parsedmess[5]; + var url_to_saved_paste = url_showSavedPath+"?paste="+paste_path+"&num="+parsedmess[0]; - var action_icon_a = document.createElement("A"); - action_icon_a.setAttribute("TARGET", "_blank"); - action_icon_a.setAttribute("HREF", url_to_saved_paste); - var action_icon_span = document.createElement('SPAN'); - action_icon_span.className = "fa fa-search-plus"; - action_icon_a.appendChild(action_icon_span); + var action_icon_a = document.createElement("A"); + action_icon_a.setAttribute("TARGET", "_blank"); + action_icon_a.setAttribute("HREF", url_to_saved_paste); + var action_icon_span = document.createElement('SPAN'); + action_icon_span.className = "fas fa-search-plus"; + action_icon_a.appendChild(action_icon_span); - inspect.appendChild(action_icon_a); - inspect.setAttribute("style", "text-align:center;"); + inspect.appendChild(action_icon_a); + inspect.setAttribute("style", "text-align:center;"); - tr.appendChild(time) - tr.appendChild(chan); - tr.appendChild(level); - tr.appendChild(scrpt); - tr.appendChild(src); - tr.appendChild(pdate); - tr.appendChild(nam); - tr.appendChild(msage); - tr.appendChild(inspect); + tr.appendChild(time) + tr.appendChild(chan); + tr.appendChild(level); + tr.appendChild(scrpt); + tr.appendChild(src); + tr.appendChild(pdate); + tr.appendChild(nam); + tr.appendChild(msage); + tr.appendChild(inspect); - if (tr.className == document.getElementById("checkbox_log_info").value && document.getElementById("checkbox_log_info").checked == true) { - tableBody.appendChild(tr); - } - if (tr.className == document.getElementById("checkbox_log_warning").value && document.getElementById("checkbox_log_warning").checked == true) { - tableBody.appendChild(tr); - } - if (tr.className == document.getElementById("checkbox_log_critical").value && document.getElementById("checkbox_log_critical").checked == true) { - tableBody.appendChild(tr); - }; + if (chansplit[1] == document.getElementById("checkbox_log_info").value && document.getElementById("checkbox_log_info").checked == true) { + tableBody.appendChild(tr); + } + if (chansplit[1] == document.getElementById("checkbox_log_warning").value && document.getElementById("checkbox_log_warning").checked == true) { + tableBody.appendChild(tr); + } + if (chansplit[1] == document.getElementById("checkbox_log_critical").value && document.getElementById("checkbox_log_critical").checked == true) { + tableBody.appendChild(tr); + }; - var sel = document.getElementById("log_select") - if (tableBody.rows.length > sel.options[sel.options.selectedIndex].value) { - while (tableBody.rows.length != sel.options[sel.options.selectedIndex].value){ - tableBody.deleteRow(0); - } + var sel = document.getElementById("log_select") + if (tableBody.rows.length > sel.options[sel.options.selectedIndex].value) { + while (tableBody.rows.length != sel.options[sel.options.selectedIndex].value){ + tableBody.deleteRow(0); + } + } } } @@ -294,7 +296,7 @@ function create_queue_table() { document.getElementById("queueing").innerHTML = ""; var Tablediv = document.getElementById("queueing") var table = document.createElement('TABLE') - table.className = "table table-bordered table-hover table-striped tableQueue"; + table.className = "table table-bordered table-hover tableQueue"; var tableHead = document.createElement('THEAD') var tableBody = document.createElement('TBODY') @@ -323,8 +325,8 @@ function create_queue_table() { var td2 = document.createElement('TD'); td.appendChild(document.createTextNode("No running queues")); td2.appendChild(document.createTextNode("Or no feed")); - td.className += " danger"; - td2.className += " danger"; + td.className += " table-danger"; + td2.className += " table-danger"; tr.appendChild(td); tr.appendChild(td2); tableBody.appendChild(tr); @@ -345,11 +347,11 @@ function create_queue_table() { // - j=2: LastProcessedPasteTime // - j=3: Number of the module belonging in the same category if (parseInt(glob_tabvar.row1[i][2]) > window.threshold_stucked_module && parseInt(glob_tabvar.row1[i][1]) > 2) - tr.className += " danger"; + tr.className += " table-danger"; else if (parseInt(glob_tabvar.row1[i][1]) == 0) - tr.className += " warning"; + tr.className += " table-disabled"; else - tr.className += " success"; + tr.className += " table-success"; tableBody.appendChild(tr); } } @@ -474,29 +476,12 @@ function load_queues() { g.updateOptions( { 'file': data } ); g2.updateOptions( { 'file': data2 } ); - - // TagCanvas.Reload('myCanvas'); - }, interval); } }); }; refresh(); - - try { - var options = { - weight:true, - weightMode:"both", - noMouse:true, - textColour: '#2E9AFE' - } - TagCanvas.Start('myCanvas','',options); - TagCanvas.SetSpeed('myCanvas', [0.05, -0.15]); - } catch(e) { - // something went wrong, hide the canvas container - document.getElementById('myCanvasContainer').style.display = 'none'; - } } function manage_undefined() { diff --git a/var/www/templates/dashboard/menu_sidebar.html b/var/www/templates/dashboard/menu_sidebar.html new file mode 100644 index 00000000..b1abd954 --- /dev/null +++ b/var/www/templates/dashboard/menu_sidebar.html @@ -0,0 +1,41 @@ +
+ + + + + + +
+
+ Total pastes since {{ default_minute }} min +
+
+
+
+
+ +
+ + +
+
+ +
+
+ + + + + + +
Idling queues
Working queues
Stuck queues
+
+
+
+
+
diff --git a/var/www/templates/nav_bar.html b/var/www/templates/nav_bar.html index c878da4c..462c375f 100644 --- a/var/www/templates/nav_bar.html +++ b/var/www/templates/nav_bar.html @@ -10,7 +10,7 @@