Commit 4b02f4a22d2c7f10418c9202bb718dab185e6d82

Authored by Dmitriy Zaporozhets
1 parent e9c6d4ad

show production.log, show only active milestone for issue filter

app/helpers/issues_helper.rb
... ... @@ -36,4 +36,8 @@ module IssuesHelper
36 36 labels = labels.map{ |l| { label: l.name, value: l.name } }
37 37 labels.to_json
38 38 end
  39 +
  40 + def issues_active_milestones
  41 + @project.milestones.active.order("id desc").all
  42 + end
39 43 end
... ...
app/views/admin/logs/show.html.haml
... ... @@ -3,6 +3,8 @@
3 3 = link_to "githost.log", "#githost", 'data-toggle' => 'tab'
4 4 %li
5 5 = link_to "application.log", "#application", 'data-toggle' => 'tab'
  6 + %li
  7 + = link_to "production.log", "#production", 'data-toggle' => 'tab'
6 8  
7 9 %p.light To prevent perfomance issues admin logs output the last 2000 lines
8 10 .tab-content
... ... @@ -34,3 +36,17 @@
34 36 - Gitlab::AppLogger.read_latest.each do |line|
35 37 %li
36 38 %p= line
  39 + .tab-pane#production
  40 + .file_holder#README
  41 + .file_title
  42 + %i.icon-file
  43 + production.log
  44 + .right
  45 + = link_to '#', class: 'log-bottom' do
  46 + %i.icon-arrow-down
  47 + Scroll down
  48 + .file_content.logs
  49 + %ol
  50 + - Gitlab::Logger.read_latest_for('production.log').each do |line|
  51 + %li
  52 + %p= line
... ...
app/views/issues/index.html.haml
... ... @@ -27,7 +27,7 @@
27 27 .left
28 28 = select_tag('update[status]', options_for_select(['open', 'closed']), prompt: "Status")
29 29 = select_tag('update[assignee_id]', options_from_collection_for_select(@project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee")
30   - = select_tag('update[milestone_id]', options_from_collection_for_select(@project.milestones.order("id desc").all, "id", "title", params[:milestone_id]), prompt: "Milestone")
  30 + = select_tag('update[milestone_id]', options_from_collection_for_select(issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone")
31 31 = hidden_field_tag 'update[issues_ids]', []
32 32 = hidden_field_tag :f, params[:f]
33 33 = button_tag "Save", class: "btn update_selected_issues"
... ... @@ -51,7 +51,7 @@
51 51 = form_tag project_issues_path(@project), method: :get, class: :right do
52 52 = select_tag(:label_name, options_for_select(issue_tags, params[:label_name]), prompt: "Labels")
53 53 = select_tag(:assignee_id, options_from_collection_for_select([unassigned_filter] + @project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee")
54   - = select_tag(:milestone_id, options_from_collection_for_select([unassigned_filter] + @project.milestones.order("id desc").all, "id", "title", params[:milestone_id]), prompt: "Milestone")
  54 + = select_tag(:milestone_id, options_from_collection_for_select([unassigned_filter] + issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone")
55 55 = hidden_field_tag :f, params[:f]
56 56 .clearfix
57 57  
... ...
lib/gitlab/logger.rb
... ... @@ -14,6 +14,11 @@ module Gitlab
14 14 logs = `tail -n 2000 #{path}`.split("\n")
15 15 end
16 16  
  17 + def self.read_latest_for filename
  18 + path = Rails.root.join("log", filename)
  19 + logs = `tail -n 2000 #{path}`.split("\n")
  20 + end
  21 +
17 22 def self.build
18 23 new(Rails.root.join("log", file_name))
19 24 end
... ...