Skip to content

Commit

Permalink
add params to entry, color different params value, hotkey p to change…
Browse files Browse the repository at this point in the history
… from inline to list layout
  • Loading branch information
omenking committed Aug 3, 2012
1 parent f96c9fd commit 4e2a1b7
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 5 deletions.
3 changes: 3 additions & 0 deletions app/assets/javascripts/rubyception/routers/log.coffee
Expand Up @@ -30,6 +30,8 @@ class App.Routers.Log extends Backbone.Router
@index()
toggle_side: =>
$('.wrapper').toggleClass 'filter'
toggle_params: =>
$('body').toggleClass 'pretty_params'
hotkeys: =>
m = Mousetrap
m.bind '\\ n' , @toggle_side
Expand All @@ -38,6 +40,7 @@ class App.Routers.Log extends Backbone.Router
m.bind String(i) , _.bind @log.entries_index.number_hotkey, @, String(i) for i in [0..9]
m.bind 'shift+g' , _.bind @log.entries_index.goto_number, @, 'bottom'
m.bind 'g g' , _.bind @log.entries_index.goto_number, @, 'top'
m.bind 'p' , @toggle_params
m.bind ['o','enter'], @log.entries_index.toggle_open
index: =>
App.column = @partial '.column', 'shared/filters'
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/rubyception/template.js

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

14 changes: 14 additions & 0 deletions app/assets/javascripts/rubyception/views/entries/entry.coffee
Expand Up @@ -18,8 +18,22 @@ class App.Views.Entries.Entry extends Backbone.View
@el_template 'entries/entry'
@color_ms()
@color_marker()
@params()
@backtrace()
@lines()
params:->
params = @model.get 'params'
html = _.map params, (v,k)->
boolean = v is true or v is false
number = !isNaN(parseFloat(v)) && isFinite(v)
kind = if boolean then 'boolean'
else if number then 'number'
else
v = "'#{v}'"
'string'

"<span class='param'><span class='key'>#{k}</span><span class='colon'>:</span> <span class='value #{kind}'>#{v}</span></span>"
$(@el).find('.params').html html.join('')
backtrace:->
backtrace = @model.get 'backtrace'
if backtrace
Expand Down
37 changes: 35 additions & 2 deletions app/assets/stylesheets/rubyception/entries.sass
Expand Up @@ -45,17 +45,50 @@
:color rgb(50,250,100)
.datetime
:color rgb(120,120,120)
.lines, .backtrace_lines
.lines, .backtrace_lines, .params
:display none
&.ignore
:display none
&.selected
:background rgb(55,55,55)
&.open
.lines, .backtrace_lines
.lines, .backtrace_lines, .params
:display block
:padding-bottom 10px
.position_marker
:background rgb(255,0,0)
:height 2px
:margin 2px 0

.params
:padding 5px
:top 0px
:font-size 12px
.key
:color rgb(160,160,160)
.value
:margin
:left 5px
:right 10px
.string
:color rgb(0,200,100)
.number
:color rgb(0,100,200)
.boolean
:color rgb(200,200,0)


body.pretty_params
.open
.params
.param
:display block
//:display table
//:border-collapse collapse
//:border none
//.param
//:display table-row
//span
//:display table-cell
//.key, .colon
//:width 1%
6 changes: 5 additions & 1 deletion app/models/rubyception/entry.rb
Expand Up @@ -28,7 +28,10 @@ def set_values event
self.error = payload[:exception].present?
self.duration = event.duration.to_f.round(2)
self.id = event.transaction_id
self.params = payload[:params]
params = payload[:params]
params.delete 'controller'
params.delete 'action'
self.params = params
self.start_time = event.time.to_s :entry
self.end_time = event.end.to_s :entry
end
Expand Down Expand Up @@ -83,6 +86,7 @@ def finalize(event)

def to_json
methods = %w{controller
params
action
path
method
Expand Down
1 change: 1 addition & 0 deletions app/views/rubyception/entries/_entry.haml
Expand Up @@ -7,6 +7,7 @@
.path {{path}}
.datetime {{start_time}}
.ms {{duration}}ms
.params
.lines
.backtrace_lines
.clear
2 changes: 1 addition & 1 deletion test/dummy/config/routes.rb
@@ -1,5 +1,5 @@
Rails.application.routes.draw do

mount Rubyception::Engine => "/rubyception"
root to: 'tasks#index'
root to: 'tasks#index', all_done: true, project_name: 'Zeus', tasks_count: 235
end

0 comments on commit 4e2a1b7

Please sign in to comment.