From 8a069cda2c076f9ba1b60b35c7cff6431c8a7f87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gon=C3=A7alo=20Val=C3=A9rio?= Date: Sat, 18 May 2019 19:20:35 +0100 Subject: [PATCH] add highlightjs for the body of the requests --- callbacks/static/js/viewer.js | 18 ++++++++++++ callbacks/templates/callbacks/check.html | 35 ++++++++++++++++++------ 2 files changed, 45 insertions(+), 8 deletions(-) diff --git a/callbacks/static/js/viewer.js b/callbacks/static/js/viewer.js index d3549fb..a351e90 100644 --- a/callbacks/static/js/viewer.js +++ b/callbacks/static/js/viewer.js @@ -43,6 +43,24 @@ function setupConnection() { setupConnection(); }; } +/* + Create the highlight directive +*/ +Vue.directive("highlightjs", { + deep: true, + bind: function(el, binding) { + if (binding.value) { + el.textContent = binding.value; + } + hljs.highlightBlock(el); + }, + componentUpdated: function(el, binding) { + if (binding.value) { + target.textContent = binding.value; + hljs.highlightBlock(target); + } + } +}); /* Setup a simple components to handle the display of new content. diff --git a/callbacks/templates/callbacks/check.html b/callbacks/templates/callbacks/check.html index e699e6b..e6a644f 100644 --- a/callbacks/templates/callbacks/check.html +++ b/callbacks/templates/callbacks/check.html @@ -8,13 +8,18 @@ rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.2/css/bulma.min.css" /> - - - + + + Webhook Logger @@ -42,7 +47,10 @@
- +
@@ -107,8 +115,14 @@

Body

-
- [[request.body]] +
+
[[request.body]]
+
+
+
[[request.body]]
@@ -120,8 +134,12 @@ @@ -152,6 +170,7 @@ +