OSDN Git Service

Improve admin logs
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Thu, 29 Nov 2012 04:49:11 +0000 (07:49 +0300)
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Thu, 29 Nov 2012 04:49:11 +0000 (07:49 +0300)
app/assets/javascripts/admin.js.coffee
app/views/admin/groups/_form.html.haml
app/views/admin/logs/show.html.haml
lib/gitlab/logger.rb

index 76454c2..1dafdf4 100644 (file)
@@ -10,3 +10,8 @@ $ ->
   $('.log-tabs a').click (e) ->
     e.preventDefault()
     $(this).tab('show')
+
+  $('.log-bottom').click (e) ->
+    e.preventDefault()
+    visible_log = $(".file_content:visible")
+    visible_log.animate({ scrollTop: visible_log.find('ol').height() }, "fast")
index 40d361b..67516eb 100644 (file)
@@ -7,13 +7,6 @@
       Group name is
     .input
       = f.text_field :name, placeholder: "Example Group", class: "xxlarge"
-  .clearfix
-    = f.label :path do
-      URL
-    .input
-      .input-prepend
-        %span.add-on= web_app_url + 'groups/'
-        = f.text_field :path, placeholder: "example"
 
   .form-actions
     = f.submit 'Save group', class: "btn save-btn"
index 0efe6db..e33c546 100644 (file)
@@ -3,12 +3,18 @@
     = link_to "githost.log", "#githost", 'data-toggle' => 'tab'
   %li
     = link_to "application.log", "#application", 'data-toggle' => 'tab'
+
+%p.light To prevent perfomance issues admin logs output the last 2000 lines
 .tab-content
   .tab-pane.active#githost
     .file_holder#README
       .file_title
         %i.icon-file
         githost.log
+        .right
+          = link_to '#', class: 'log-bottom' do
+            %i.icon-arrow-down
+            Scroll down
       .file_content.logs
         %ol
           - Gitlab::GitLogger.read_latest.each do |line|
       .file_title
         %i.icon-file
         application.log
+        .right
+          = link_to '#', class: 'log-bottom' do
+            %i.icon-arrow-down
+            Scroll down
       .file_content.logs
         %ol
           - Gitlab::AppLogger.read_latest.each do |line|
index cf9a4c4..8b4eee5 100644 (file)
@@ -11,7 +11,7 @@ module Gitlab
     def self.read_latest
       path = Rails.root.join("log", file_name)
       self.build unless File.exist?(path)
-      logs = File.read(path).split("\n")
+      logs = `tail -n 2000 #{path}`.split("\n")
     end
 
     def self.build