diff options
author | Rémy Coutable <remy@rymai.me> | 2017-07-06 19:37:31 +0000 |
---|---|---|
committer | Clement Ho <clemmakesapps@gmail.com> | 2017-07-06 19:37:31 +0000 |
commit | 18326c20805df1fb392ea55599626b3f19de1322 (patch) | |
tree | 79871da6e9e136f140c604d26b16163340b56f0d /lib/peek | |
parent | 46ccda86fb7e7c78b75c69d3b4c33f347f03da2b (diff) | |
download | gitlab-ce-18326c20805df1fb392ea55599626b3f19de1322.tar.gz |
Improve & fix the performance bar UI and behavior
Diffstat (limited to 'lib/peek')
-rw-r--r-- | lib/peek/rblineprof/custom_controller_helpers.rb | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/lib/peek/rblineprof/custom_controller_helpers.rb b/lib/peek/rblineprof/custom_controller_helpers.rb index 99f9c2c9b04..7cfe76b7b71 100644 --- a/lib/peek/rblineprof/custom_controller_helpers.rb +++ b/lib/peek/rblineprof/custom_controller_helpers.rb @@ -41,9 +41,14 @@ module Peek ] end.sort_by{ |a,b,c,d,e,f| -f } - output = '' - per_file.each do |file_name, lines, file_wall, file_cpu, file_idle, file_sort| + output = "<div class='modal-dialog modal-full'><div class='modal-content'>" + output << "<div class='modal-header'>" + output << "<button class='close btn btn-link btn-sm' type='button' data-dismiss='modal'>X</button>" + output << "<h4>Line profiling: #{human_description(params[:lineprofiler])}</h4>" + output << "</div>" + output << "<div class='modal-body'>" + per_file.each do |file_name, lines, file_wall, file_cpu, file_idle, file_sort| output << "<div class='peek-rblineprof-file'><div class='heading'>" show_src = file_sort > min @@ -86,11 +91,32 @@ module Peek output << "</div></div>" # .data then .peek-rblineprof-file end - response.body += "<div class='peek-rblineprof-modal' id='line-profile'>#{output}</div>".html_safe + output << "</div></div></div>" + + response.body += "<div class='modal' id='modal-peek-line-profile' tabindex=-1>#{output}</div>".html_safe end ret end + + private + + def human_description(lineprofiler_param) + case lineprofiler_param + when 'app' + 'app/ & lib/' + when 'views' + 'app/view/' + when 'gems' + 'vendor/gems' + when 'all' + 'everything in Rails.root' + when 'stdlib' + 'everything in the Ruby standard library' + else + 'app/, config/, lib/, vendor/ & plugin/' + end + end end end end |