From cd87afc8d73b87383fa151be5f297842e636e733 Mon Sep 17 00:00:00 2001 From: Joakim Hamren Date: Tue, 23 Sep 2014 23:09:47 +0200 Subject: [PATCH] Fixed search highlighting bug. Some minor UI changes as well. --- psdash/static/css/psdash.css | 2 +- psdash/static/js/psdash.js | 10 +++++-- psdash/templates/disks.html | 2 +- psdash/templates/index.html | 58 ++++++++++++++++++------------------ 4 files changed, 39 insertions(+), 33 deletions(-) diff --git a/psdash/static/css/psdash.css b/psdash/static/css/psdash.css index be7d1f9..2639172 100644 --- a/psdash/static/css/psdash.css +++ b/psdash/static/css/psdash.css @@ -174,7 +174,7 @@ a:hover { } #dashboard div.box.swap { - min-width: 300px; + min-width: 350px; } #dashboard div.box.memory { diff --git a/psdash/static/js/psdash.js b/psdash/static/js/psdash.js index 8a2e424..0933806 100644 --- a/psdash/static/js/psdash.js +++ b/psdash/static/js/psdash.js @@ -75,15 +75,21 @@ function init_log() { if(resp.position == -1) { $status.text("EOF Reached."); } else { + // split up the content on found pos. + var content_before = resp.content.slice(0, resp.buffer_pos); + var content_after = resp.content.slice(resp.buffer_pos + params["text"].length); + + // escape html in log content resp.content = $('
').text(resp.content).html(); + + // highlight matches var matched_text = '' + params['text'] + ''; var found_text = '' + params["text"] + ''; - var content_before = resp.content.slice(0, resp.buffer_pos); - var content_after = resp.content.slice(resp.buffer_pos + params["text"].length); content_before = replace_all(params["text"], matched_text, content_before); content_after = replace_all(params["text"], matched_text, content_after); resp.content = content_before + found_text + content_after; $el.html(resp.content); + $status.text("Position " + resp.position + " of " + resp.filesize + "."); } diff --git a/psdash/templates/disks.html b/psdash/templates/disks.html index 824e8af..f6f1253 100644 --- a/psdash/templates/disks.html +++ b/psdash/templates/disks.html @@ -6,7 +6,7 @@ Disks
- +
diff --git a/psdash/templates/index.html b/psdash/templates/index.html index 81f262e..a1334f5 100644 --- a/psdash/templates/index.html +++ b/psdash/templates/index.html @@ -63,35 +63,6 @@
Device
-
-
- Swap -
-
- - - - - - - - - - - - - - - - - - - - - -
Total{{ swap.total|filesizeformat }}
Used{{ swap.used|filesizeformat }} ({{ swap.percent }} %)
Free{{ swap.free|filesizeformat }}
Swapped in{{ swap.swapped_in|filesizeformat }}
Swapped out{{ swap.swapped_out|filesizeformat }}
-
-
Network @@ -148,6 +119,35 @@
+
+
+ Swap +
+
+ + + + + + + + + + + + + + + + + + + + + +
Total{{ swap.total|filesizeformat }}
Used{{ swap.used|filesizeformat }} ({{ swap.percent }} %)
Free{{ swap.free|filesizeformat }}
Swapped in{{ swap.swapped_in|filesizeformat }}
Swapped out{{ swap.swapped_out|filesizeformat }}
+
+
Users