Commit ff9a2e2a9399bf1d190de7fab2d1d26b70433b19
1 parent
eb1004f7
Exists in
master
and in
4 other branches
Improve admin logs
Showing
4 changed files
with
16 additions
and
8 deletions
Show diff stats
app/assets/javascripts/admin.js.coffee
| @@ -10,3 +10,8 @@ $ -> | @@ -10,3 +10,8 @@ $ -> | ||
| 10 | $('.log-tabs a').click (e) -> | 10 | $('.log-tabs a').click (e) -> |
| 11 | e.preventDefault() | 11 | e.preventDefault() |
| 12 | $(this).tab('show') | 12 | $(this).tab('show') |
| 13 | + | ||
| 14 | + $('.log-bottom').click (e) -> | ||
| 15 | + e.preventDefault() | ||
| 16 | + visible_log = $(".file_content:visible") | ||
| 17 | + visible_log.animate({ scrollTop: visible_log.find('ol').height() }, "fast") |
app/views/admin/groups/_form.html.haml
| @@ -7,13 +7,6 @@ | @@ -7,13 +7,6 @@ | ||
| 7 | Group name is | 7 | Group name is |
| 8 | .input | 8 | .input |
| 9 | = f.text_field :name, placeholder: "Example Group", class: "xxlarge" | 9 | = f.text_field :name, placeholder: "Example Group", class: "xxlarge" |
| 10 | - .clearfix | ||
| 11 | - = f.label :path do | ||
| 12 | - URL | ||
| 13 | - .input | ||
| 14 | - .input-prepend | ||
| 15 | - %span.add-on= web_app_url + 'groups/' | ||
| 16 | - = f.text_field :path, placeholder: "example" | ||
| 17 | 10 | ||
| 18 | .form-actions | 11 | .form-actions |
| 19 | = f.submit 'Save group', class: "btn save-btn" | 12 | = f.submit 'Save group', class: "btn save-btn" |
app/views/admin/logs/show.html.haml
| @@ -3,12 +3,18 @@ | @@ -3,12 +3,18 @@ | ||
| 3 | = link_to "githost.log", "#githost", 'data-toggle' => 'tab' | 3 | = link_to "githost.log", "#githost", 'data-toggle' => 'tab' |
| 4 | %li | 4 | %li |
| 5 | = link_to "application.log", "#application", 'data-toggle' => 'tab' | 5 | = link_to "application.log", "#application", 'data-toggle' => 'tab' |
| 6 | + | ||
| 7 | +%p.light To prevent perfomance issues admin logs output the last 2000 lines | ||
| 6 | .tab-content | 8 | .tab-content |
| 7 | .tab-pane.active#githost | 9 | .tab-pane.active#githost |
| 8 | .file_holder#README | 10 | .file_holder#README |
| 9 | .file_title | 11 | .file_title |
| 10 | %i.icon-file | 12 | %i.icon-file |
| 11 | githost.log | 13 | githost.log |
| 14 | + .right | ||
| 15 | + = link_to '#', class: 'log-bottom' do | ||
| 16 | + %i.icon-arrow-down | ||
| 17 | + Scroll down | ||
| 12 | .file_content.logs | 18 | .file_content.logs |
| 13 | %ol | 19 | %ol |
| 14 | - Gitlab::GitLogger.read_latest.each do |line| | 20 | - Gitlab::GitLogger.read_latest.each do |line| |
| @@ -19,6 +25,10 @@ | @@ -19,6 +25,10 @@ | ||
| 19 | .file_title | 25 | .file_title |
| 20 | %i.icon-file | 26 | %i.icon-file |
| 21 | application.log | 27 | application.log |
| 28 | + .right | ||
| 29 | + = link_to '#', class: 'log-bottom' do | ||
| 30 | + %i.icon-arrow-down | ||
| 31 | + Scroll down | ||
| 22 | .file_content.logs | 32 | .file_content.logs |
| 23 | %ol | 33 | %ol |
| 24 | - Gitlab::AppLogger.read_latest.each do |line| | 34 | - Gitlab::AppLogger.read_latest.each do |line| |
lib/gitlab/logger.rb
| @@ -11,7 +11,7 @@ module Gitlab | @@ -11,7 +11,7 @@ module Gitlab | ||
| 11 | def self.read_latest | 11 | def self.read_latest |
| 12 | path = Rails.root.join("log", file_name) | 12 | path = Rails.root.join("log", file_name) |
| 13 | self.build unless File.exist?(path) | 13 | self.build unless File.exist?(path) |
| 14 | - logs = File.read(path).split("\n") | 14 | + logs = `tail -n 2000 #{path}`.split("\n") |
| 15 | end | 15 | end |
| 16 | 16 | ||
| 17 | def self.build | 17 | def self.build |