You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kibble.apache.org by hu...@apache.org on 2018/01/17 18:37:38 UTC

[kibble] 02/06: Add in a chepa json dump widget for debugging

This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kibble.git

commit cdfbe837d819fd2c0033bddbae0953bfc2aca473
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Wed Jan 17 19:36:01 2018 +0100

    Add in a chepa json dump widget for debugging
---
 ui/js/coffee/datepicker.coffee      | 1 +
 ui/js/coffee/explorer.coffee        | 5 +++++
 ui/js/coffee/pageloader.coffee      | 1 +
 ui/js/coffee/widget.coffee          | 1 +
 ui/js/coffee/widget_jsondump.coffee | 5 +++++
 5 files changed, 13 insertions(+)

diff --git a/ui/js/coffee/datepicker.coffee b/ui/js/coffee/datepicker.coffee
index 4464a64..5250679 100644
--- a/ui/js/coffee/datepicker.coffee
+++ b/ui/js/coffee/datepicker.coffee
@@ -36,6 +36,7 @@ updateTimeseriesWidgets = (range) ->
             updateWidgets('mvp', null, { to: to, from: from})
             updateWidgets('comstat', null, { to: to, from: from})
             updateWidgets('worldmap', null, { to: to, from: from})
+            updateWidgets('jsondump', null, { to: to, from: from})
                 
 datepicker = (widget) ->
         div = document.createElement('div')
diff --git a/ui/js/coffee/explorer.coffee b/ui/js/coffee/explorer.coffee
index 99d2fde..61f0411 100644
--- a/ui/js/coffee/explorer.coffee
+++ b/ui/js/coffee/explorer.coffee
@@ -64,6 +64,7 @@ explorer = (json, state) ->
                 updateWidgets('trends', null, { source: source })
                 updateWidgets('mvp', null, { source: source })
                 updateWidgets('comstat', null, { source: source })
+                updateWidgets('jsondump', null, { source: source })
               )
         
         
@@ -92,6 +93,7 @@ explorer = (json, state) ->
                 updateWidgets('relationship', null, {author: author})
                 updateWidgets('mvp', null, {author: author})
                 updateWidgets('comstat', null, { author: author })
+                updateWidgets('jsondump', null, { author: author })
                 )
         state.widget.inject(chk)
         label = document.createElement('label')
@@ -155,6 +157,7 @@ sourceexplorer = (json, state) ->
                 updateWidgets('trends', null, { source: source })
                 updateWidgets('mvp', null, { source: source })
                 updateWidgets('comstat', null, { source: source })
+                updateWidgets('jsondump', null, { author: author })
         )
 
 
@@ -463,6 +466,7 @@ subFilter = () ->
         updateWidgets('mvp', null, x)
         updateWidgets('comstat', null, x)
         updateWidgets('worldmap', null, x)
+        updateWidgets('jsondump', null, x)
         
         $( "a" ).each( () ->
             url = $(this).attr('href')
@@ -537,6 +541,7 @@ viewexplorer = (json, state) ->
                 updateWidgets('mvp', null, x)
                 updateWidgets('comstat', null, x)
                 updateWidgets('worldmap', null, x)
+                updateWidgets('jsondump', null, x)
                 
                 $( "a" ).each( () ->
                     url = $(this).attr('href')
diff --git a/ui/js/coffee/pageloader.coffee b/ui/js/coffee/pageloader.coffee
index fe00cca..9938b6b 100644
--- a/ui/js/coffee/pageloader.coffee
+++ b/ui/js/coffee/pageloader.coffee
@@ -108,6 +108,7 @@ setupPage = (json, state) ->
                 when 'worldmap' then widget.load(worldmap)
                 when 'orglist' then widget.load(orglist)
                 when 'membership' then widget.load(membershipList)
+                when 'jsondump' then widget.load(jsondump)
 
 
 
diff --git a/ui/js/coffee/widget.coffee b/ui/js/coffee/widget.coffee
index b46afab..b8f672a 100644
--- a/ui/js/coffee/widget.coffee
+++ b/ui/js/coffee/widget.coffee
@@ -133,6 +133,7 @@ updateWidgets = (type, target, eargs) ->
                 when 'mvp' then widget.load(mvp)
                 when 'comstat' then widget.load(comstat)
                 when 'worldmap' then widget.load(worldmap)
+                when 'jsondump' then widget.load(jsondump)
 
 class pubWidget
     constructor: (@div, @wid, @config) ->
diff --git a/ui/js/coffee/widget_jsondump.coffee b/ui/js/coffee/widget_jsondump.coffee
new file mode 100644
index 0000000..8715b73
--- /dev/null
+++ b/ui/js/coffee/widget_jsondump.coffee
@@ -0,0 +1,5 @@
+jsondump = (json, state) ->
+    pre = new HTML('pre', { style: { whiteSpace: 'pre-wrap'}})
+    pre.inject(JSON.stringify(json, null, 2))
+    state.widget.inject(pre, true)
+

-- 
To stop receiving notification emails like this one, please contact
"commits@kibble.apache.org" <co...@kibble.apache.org>.