Skip to content

Commit

Permalink
debugging
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Harlan T Wood <code@harlantwood.net>
  • Loading branch information
harlantwood committed Jun 9, 2015
1 parent 107ec66 commit e44b51a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 11 deletions.
18 changes: 13 additions & 5 deletions webapps/tree-ltr/app.coffee
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
DEMO_HASH = 'QmZq1TFx4RF1LbNb9RmEMZxaXpB9UjcFTLRCT4GHzy3Kk2'
DEMO_HASH = 'QmTkzDwWqPbnAh5YiV5VwcTLnGdwSNsNTn2aDxdXBFca7D' # example viewer directory
DEBUG = false

app = ->
hash = window.location.hash[1..]
console.log hash
debug hash
if hash.length > 0
render hash
else
Expand All @@ -11,7 +12,10 @@ app = ->

render = (hash) ->
API_REFS_FORMAT = encodeURIComponent '<src> <dst> <linkname>'
d3.xhr "/api/v0/refs?arg=#{hash}&recursive&format=#{API_REFS_FORMAT}", (error, xhr) ->
apiPath = "/api/v0/refs?arg=#{hash}&recursive&format=#{API_REFS_FORMAT}"
debug apiPath
d3.xhr apiPath, (error, xhr) ->
debug arguments
data = xhr.responseText
tree = {}

Expand All @@ -26,7 +30,7 @@ render = (hash) ->
children = getDecendants hash, tree

@root = children: children
# console.log JSON.stringify @root, null, 2
debug JSON.stringify @root, null, 2
@root.x0 = h / 2
@root.y0 = 0
@root.children.forEach toggleAll
Expand All @@ -42,11 +46,15 @@ getDecendants = (ref, dict) ->
child.children = decendants if decendants?
children

debug = (args...) ->
if DEBUG
console.debug args...

app()



# Format of internal `dict`:
# Format of internal `tree`:
#
# {
# "Qmcav25eTinMV632w9zdyXsFENDz5FCWjrMEVU7Nzy2v98": [
Expand Down
25 changes: 20 additions & 5 deletions webapps/tree-ltr/app.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion webapps/tree-ltr/published-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
QmZpbpcPC9TZC7wBZwC8ekSVe4K8Fki4nYR2VgtBVJBKv1
QmdQRGbijGYBe8u29Gd7LkxgC4dCVcbGALe2dQ3r1kRdzY

0 comments on commit e44b51a

Please sign in to comment.