Commit ff9a2e2a9399bf1d190de7fab2d1d26b70433b19

Authored by Dmitriy Zaporozhets
1 parent eb1004f7

Improve admin logs

app/assets/javascripts/admin.js.coffee
... ... @@ -10,3 +10,8 @@ $ ->
10 10 $('.log-tabs a').click (e) ->
11 11 e.preventDefault()
12 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 7 Group name is
8 8 .input
9 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 11 .form-actions
19 12 = f.submit 'Save group', class: "btn save-btn"
... ...
app/views/admin/logs/show.html.haml
... ... @@ -3,12 +3,18 @@
3 3 = link_to "githost.log", "#githost", 'data-toggle' => 'tab'
4 4 %li
5 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 8 .tab-content
7 9 .tab-pane.active#githost
8 10 .file_holder#README
9 11 .file_title
10 12 %i.icon-file
11 13 githost.log
  14 + .right
  15 + = link_to '#', class: 'log-bottom' do
  16 + %i.icon-arrow-down
  17 + Scroll down
12 18 .file_content.logs
13 19 %ol
14 20 - Gitlab::GitLogger.read_latest.each do |line|
... ... @@ -19,6 +25,10 @@
19 25 .file_title
20 26 %i.icon-file
21 27 application.log
  28 + .right
  29 + = link_to '#', class: 'log-bottom' do
  30 + %i.icon-arrow-down
  31 + Scroll down
22 32 .file_content.logs
23 33 %ol
24 34 - Gitlab::AppLogger.read_latest.each do |line|
... ...
lib/gitlab/logger.rb
... ... @@ -11,7 +11,7 @@ module Gitlab
11 11 def self.read_latest
12 12 path = Rails.root.join("log", file_name)
13 13 self.build unless File.exist?(path)
14   - logs = File.read(path).split("\n")
  14 + logs = `tail -n 2000 #{path}`.split("\n")
15 15 end
16 16  
17 17 def self.build
... ...