Add in a chepa json dump widget for debugging
authorDaniel Gruno <humbedooh@apache.org>
Wed, 17 Jan 2018 18:36:01 +0000 (19:36 +0100)
committerDaniel Gruno <humbedooh@apache.org>
Wed, 17 Jan 2018 18:36:01 +0000 (19:36 +0100)
ui/js/coffee/datepicker.coffee
ui/js/coffee/explorer.coffee
ui/js/coffee/pageloader.coffee
ui/js/coffee/widget.coffee
ui/js/coffee/widget_jsondump.coffee [new file with mode: 0644]

index 4464a64..5250679 100644 (file)
@@ -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')
index 99d2fde..61f0411 100644 (file)
@@ -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')
index fe00cca..9938b6b 100644 (file)
@@ -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)
 
 
 
index b46afab..b8f672a 100644 (file)
@@ -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 (file)
index 0000000..8715b73
--- /dev/null
@@ -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)
+