Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

filter controller or controller action via checkbox in column

  • Loading branch information...
commit f96c9fdcc542bf7e5a1281ac98572289aeb9995e 1 parent 083cd70
Andrew Brown omenking authored
18 app/assets/javascripts/rubyception/collections/entries.coffee
View
@@ -1,3 +1,21 @@
class App.Collections.Entries extends Backbone.Collection
model: App.Models.Entry
url:-> ''
+ filter:(args)->
+ _.each @models, (model)=>
+ controller = model.get 'controller'
+ action = model.get 'action'
+ check_action = args.controller isnt undefined and args.action isnt undefined
+ check_controller = args.controller isnt undefined
+
+ trigger = if check_action
+ controller is args.controller && action is args.action
+ else if check_controller
+ controller is args.controller
+ else
+ false
+
+ if trigger && args.trigger is 'ignore'
+ model.trigger 'ignore'
+ else if trigger && args.trigger is 'notice'
+ model.trigger 'notice'
3  app/assets/javascripts/rubyception/collections/filter_actions.coffee
View
@@ -0,0 +1,3 @@
+class App.Collections.FilterActions extends Backbone.Collection
+ url: ''
+ model: App.Models.FilterAction
8 app/assets/javascripts/rubyception/lib/jenny.coffee
View
@@ -57,7 +57,7 @@ CollectionHelpers =
collect:->
e = $ @context.el
find = arguments[0]
- has_find = find isnt undefined
+ has_find = find isnt undefined && find isnt null
options = arguments[1]
options ||= {}
@@ -65,12 +65,12 @@ CollectionHelpers =
delete options.template_index
template_index = ti
template_index = "#{@name}/index" if ti is undefined
- e
- html = @context.template template_index, options.args || {}
hti = options.has_template_index
delete options.has_template_index
- e.html html if hti != false
+ if hti != false
+ html = @context.template template_index, options.args || {}
+ e.html html
t = options.template
delete options.template
2  app/assets/javascripts/rubyception/models/filter_action.coffee
View
@@ -0,0 +1,2 @@
+class App.Models.FilterAction extends Backbone.Model
+ url: ''
4 app/assets/javascripts/rubyception/routers/log.coffee
View
@@ -8,6 +8,7 @@ class App.Routers.Log extends Backbone.Router
socket.onclose = @onclose
socket.onmessage = @onmessage
@collection = new App.Collections.Entries()
+ App.enteries = @collection
@collection.model = App.Models.Entry
@default()
onmessage:(msg)=>
@@ -39,6 +40,7 @@ class App.Routers.Log extends Backbone.Router
m.bind 'g g' , _.bind @log.entries_index.goto_number, @, 'top'
m.bind ['o','enter'], @log.entries_index.toggle_open
index: =>
+ App.column = @partial '.column', 'shared/filters'
@log = @partial '.content', 'logs/show',
- collection: @collection
+ collection: @collection
@hotkeys()
2  app/assets/javascripts/rubyception/template.js
View
@@ -1 +1 @@
-Template = {"entries":{"index":"<div class='entries'></div>\n","entry":"<div class='marker'></div>\n<div class='details'>\n <div class='heading'>\n <div class='method'>{{method}}</div>\n <div class='format'>{{format}}</div>\n {{controller}}#{{action}}\n <div class='path'>{{path}}</div>\n <div class='datetime'>{{start_time}}</div>\n <div class='ms'>{{duration}}ms</div>\n </div>\n <div class='lines'></div>\n <div class='backtrace_lines'></div>\n</div>\n<div class='clear'></div>\n"},"backtrace_lines":{"index":"<table>\n <thead>\n <th class='toggle_rails'>\n <a href=\"#\" class=\"show_rails\" onclick=\"return false\">T</a>\n </th>\n <th class='exception' colspan='3'>\n {{name}}: {{message}}\n </th>\n </thead>\n <tbody></tbody>\n</table>\n","backtrace_line":"<td class='num'>{{num}}</td>\n<td class='msg'><a href=\"mvim://open?url={{url}}&amp;line={{line_num}}\">{{msg}}</a></td>\n<td class='lnum'>{{line_num}}</td>\n<td class='in'>\n <span>{{in}}</span>\n</td>\n"},"lines":{"index":"<table>\n <thead></thead>\n <tbody></tbody>\n</table>\n","action_controller":{"write_fragment":"","read_fragment":"","expire_fragment":"","exist_fragment":"","write_page":"","expire_page":"","start_processing":"","process_action":"","send_file":"","send_data":"","redirect_to":"","halted_callback":""},"action_view":{"render_template":"<td class='msg'>render template</td>\n<td class='identifier'>{{identifier}}</td>\n<td class='layout'>\n <span>layout:</span>\n {{layout}}\n</td>\n<td class='duration' colspan='10'>{{duration}}ms</td>\n","render_partial":"<td class='msg'>render partial</td>\n<td class='identifier'>{{identifier}}</td>\n<td class='duration' colspan='10'>{{duration}}ms</td>\n"},"active_record":{"sql":"<td class='name'>{{name}}</td>\n<td class='sql'>\n <pre class='brush: sql'>{{sql}}</pre>\n</td>\n<td class='duration' colspan='10'>{{duration}}ms</td>\n","identity":"<td class='name'>{{name}}</td>\n<td class='line'>{{line}}</td>\n<td class='duration' colspan='10'>{{duration}}ms</td>\n"},"action_mailer":{"receive":"","deliver":""},"active_resource":{"request":""},"active_support":{"cache_read":"","cache_generate":"","cache_fetch_hit":"","cache_write":"","cache_delete":"","cache_exist":""}}}
+Template = {"entries":{"index":"<div class='entries'></div>\n","entry":"<div class='marker'></div>\n<div class='details'>\n <div class='heading'>\n <div class='method'>{{method}}</div>\n <div class='format'>{{format}}</div>\n {{controller}}#{{action}}\n <div class='path'>{{path}}</div>\n <div class='datetime'>{{start_time}}</div>\n <div class='ms'>{{duration}}ms</div>\n </div>\n <div class='lines'></div>\n <div class='backtrace_lines'></div>\n</div>\n<div class='clear'></div>\n"},"backtrace_lines":{"index":"<table>\n <thead>\n <th class='toggle_rails'>\n <a href=\"#\" class=\"show_rails\" onclick=\"return false\">T</a>\n </th>\n <th class='exception' colspan='3'>\n {{name}}: {{message}}\n </th>\n </thead>\n <tbody></tbody>\n</table>\n","backtrace_line":"<td class='num'>{{num}}</td>\n<td class='msg'><a href=\"mvim://open?url={{url}}&amp;line={{line_num}}\">{{msg}}</a></td>\n<td class='lnum'>{{line_num}}</td>\n<td class='in'>\n <span>{{in}}</span>\n</td>\n"},"shared":{"filter_controller":"<input id=\"filter\" name=\"filter\" type=\"checkbox\" value=\"1\" />\n{{controller}}\n<div class='filter_actions'></div>\n","filter_action":"<input id=\"filter\" name=\"filter\" type=\"checkbox\" value=\"1\" />\n{{action}}\n"},"lines":{"index":"<table>\n <thead></thead>\n <tbody></tbody>\n</table>\n","action_controller":{"write_fragment":"","read_fragment":"","expire_fragment":"","exist_fragment":"","write_page":"","expire_page":"","start_processing":"","process_action":"","send_file":"","send_data":"","redirect_to":"","halted_callback":""},"action_view":{"render_template":"<td class='msg'>render template</td>\n<td class='identifier'>{{identifier}}</td>\n<td class='layout'>\n <span>layout:</span>\n {{layout}}\n</td>\n<td class='duration' colspan='10'>{{duration}}ms</td>\n","render_partial":"<td class='msg'>render partial</td>\n<td class='identifier'>{{identifier}}</td>\n<td class='duration' colspan='10'>{{duration}}ms</td>\n"},"active_record":{"sql":"<td class='name'>{{name}}</td>\n<td class='sql'>\n <pre class='brush: sql'>{{sql}}</pre>\n</td>\n<td class='duration' colspan='10'>{{duration}}ms</td>\n","identity":"<td class='name'>{{name}}</td>\n<td class='line'>{{line}}</td>\n<td class='duration' colspan='10'>{{duration}}ms</td>\n"},"action_mailer":{"receive":"","deliver":""},"active_resource":{"request":""},"active_support":{"cache_read":"","cache_generate":"","cache_fetch_hit":"","cache_write":"","cache_delete":"","cache_exist":""}}}
13 app/assets/javascripts/rubyception/views/entries/entry.coffee
View
@@ -3,6 +3,8 @@ class App.Views.Entries.Entry extends Backbone.View
events:
'click': 'select_and_toggle'
initialize: ->
+ @model.bind 'notice', @notice
+ @model.bind 'ignore', @ignore
@render()
select_and_toggle: (event) =>
target = $ event.target
@@ -12,6 +14,7 @@ class App.Views.Entries.Entry extends Backbone.View
@index.entry $ @el
@index.toggle_open()
render: =>
+ @add_to_filters()
@el_template 'entries/entry'
@color_ms()
@color_marker()
@@ -19,7 +22,6 @@ class App.Views.Entries.Entry extends Backbone.View
@lines()
backtrace:->
backtrace = @model.get 'backtrace'
- console.log backtrace
if backtrace
el = $(@el).find '.backtrace_lines'
@collect 'backtrace_lines',
@@ -47,3 +49,12 @@ class App.Views.Entries.Entry extends Backbone.View
else 'slow'
e = $(@el).find '.ms'
e.addClass c
+ ignore:=> $(@el).addClass 'ignore'
+ notice:=> $(@el).removeClass 'ignore'
+ add_to_filters:->
+ controller = @model.get 'controller'
+ action = @model.get 'action'
+ App.filters[controller] = [] if App.filters[controller] is undefined
+ App.filters[controller].push action
+ App.filters[controller] = _.uniq App.filters[controller]
+ App.column.render()
20 app/assets/javascripts/rubyception/views/shared/filter_action.coffee
View
@@ -0,0 +1,20 @@
+class App.Views.Shared.FilterAction extends Backbone.View
+ className: 'filter_action'
+ events:
+ 'click input': 'filter'
+ initialize:->
+ @render()
+ render:->
+ @el_template 'shared/filter_action'
+ filter:(e)->
+ parent = $(e.currentTarget).parent().parent().parent()
+ checked = parent.find('input:first').is(':checked')
+ if checked is false
+ controller = @model.get 'controller'
+ action = @model.get 'action'
+ checked = $(e.currentTarget).is(':checked')
+ trigger = if checked then 'ignore' else 'notice'
+ App.enteries.filter
+ controller : controller
+ aciton : action
+ trigger : trigger
22 app/assets/javascripts/rubyception/views/shared/filter_controller.coffee
View
@@ -0,0 +1,22 @@
+class App.Views.Shared.FilterController extends Backbone.View
+ className: 'filter_controller'
+ events:
+ 'click input:first': 'filter'
+ initialize:->
+ @render()
+ render:->
+ @el_template 'shared/filter_controller'
+ @collect 'filter_actions',
+ el : @$ '.filter_actions'
+ template: 'shared/filter_actions'
+ filters = @model.get 'filters'
+ @collection.reset filters
+ filter:(e)->
+ e = $(e.currentTarget)
+ controller = @model.get 'controller'
+ checked = e.is(':checked')
+ trigger = if checked then 'ignore' else 'notice'
+ $(@el).find('input').attr 'checked', checked
+ App.enteries.filter
+ controller : controller
+ trigger : trigger
15 app/assets/javascripts/rubyception/views/shared/filters.coffee
View
@@ -0,0 +1,15 @@
+class App.Views.Shared.Filters extends Backbone.View
+ initialize:->
+ App.filters = {}
+ @render()
+ render:->
+ $(@el).empty()
+ _.each App.filters, (v,k)=>
+ v = _.map v, (action)=>
+ {controller: k, action: v}
+ attrs =
+ controller : k
+ filters : v
+ model = new Backbone.Model attrs
+ e = @partial null, 'shared/filter_controller', model: model
+ $(@el).append e.el
7 app/assets/javascripts/rubyception/views/shared/filters_actions.coffee
View
@@ -0,0 +1,7 @@
+class App.Views.Shared.FilterActions extends Backbone.View
+ initialize:->
+ @bind_render()
+ render:->
+ @collection.collect null,
+ template : 'shared/filter_action'
+ has_template_index : false
7 app/assets/stylesheets/rubyception/default.sass
View
@@ -24,12 +24,19 @@ html,body
.wrapper.filter
.column
+ :display block
:float left
:width 260px
:margin-left -100%
+ :color rgb(195,195,195)
+ :font-size 14px
.content_wrap
:float left
:width 100%
.content
:margin
:left 260px
+
+.filter_action
+ :padding
+ :left 15px
2  app/assets/stylesheets/rubyception/entries.sass
View
@@ -47,6 +47,8 @@
:color rgb(120,120,120)
.lines, .backtrace_lines
:display none
+ &.ignore
+ :display none
&.selected
:background rgb(55,55,55)
&.open
2  app/views/rubyception/shared/_filter_action.haml
View
@@ -0,0 +1,2 @@
+= check_box_tag :filter
+{{action}}
3  app/views/rubyception/shared/_filter_controller.haml
View
@@ -0,0 +1,3 @@
+= check_box_tag :filter
+{{controller}}
+.filter_actions
3  config/templating.yml
View
@@ -4,6 +4,9 @@ entries:
backtrace_lines:
- index
- backtrace_line
+shared:
+ - filter_controller
+ - filter_action
lines:
index:
action_controller:
Please sign in to comment.
Something went wrong with that request. Please try again.