From 4b02f4a22d2c7f10418c9202bb718dab185e6d82 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Wed, 19 Dec 2012 07:14:05 +0300 Subject: [PATCH] show production.log, show only active milestone for issue filter --- app/helpers/issues_helper.rb | 4 ++++ app/views/admin/logs/show.html.haml | 16 ++++++++++++++++ app/views/issues/index.html.haml | 4 ++-- lib/gitlab/logger.rb | 5 +++++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/app/helpers/issues_helper.rb b/app/helpers/issues_helper.rb index 264b764fa..2825787fd 100644 --- a/app/helpers/issues_helper.rb +++ b/app/helpers/issues_helper.rb @@ -36,4 +36,8 @@ module IssuesHelper labels = labels.map{ |l| { label: l.name, value: l.name } } labels.to_json end + + def issues_active_milestones + @project.milestones.active.order("id desc").all + end end diff --git a/app/views/admin/logs/show.html.haml b/app/views/admin/logs/show.html.haml index e33c54685..25644d632 100644 --- a/app/views/admin/logs/show.html.haml +++ b/app/views/admin/logs/show.html.haml @@ -3,6 +3,8 @@ = link_to "githost.log", "#githost", 'data-toggle' => 'tab' %li = link_to "application.log", "#application", 'data-toggle' => 'tab' + %li + = link_to "production.log", "#production", 'data-toggle' => 'tab' %p.light To prevent perfomance issues admin logs output the last 2000 lines .tab-content @@ -34,3 +36,17 @@ - Gitlab::AppLogger.read_latest.each do |line| %li %p= line + .tab-pane#production + .file_holder#README + .file_title + %i.icon-file + production.log + .right + = link_to '#', class: 'log-bottom' do + %i.icon-arrow-down + Scroll down + .file_content.logs + %ol + - Gitlab::Logger.read_latest_for('production.log').each do |line| + %li + %p= line diff --git a/app/views/issues/index.html.haml b/app/views/issues/index.html.haml index cc47da65b..08d4393b2 100644 --- a/app/views/issues/index.html.haml +++ b/app/views/issues/index.html.haml @@ -27,7 +27,7 @@ .left = select_tag('update[status]', options_for_select(['open', 'closed']), prompt: "Status") = select_tag('update[assignee_id]', options_from_collection_for_select(@project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee") - = select_tag('update[milestone_id]', options_from_collection_for_select(@project.milestones.order("id desc").all, "id", "title", params[:milestone_id]), prompt: "Milestone") + = select_tag('update[milestone_id]', options_from_collection_for_select(issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone") = hidden_field_tag 'update[issues_ids]', [] = hidden_field_tag :f, params[:f] = button_tag "Save", class: "btn update_selected_issues" @@ -51,7 +51,7 @@ = form_tag project_issues_path(@project), method: :get, class: :right do = select_tag(:label_name, options_for_select(issue_tags, params[:label_name]), prompt: "Labels") = select_tag(:assignee_id, options_from_collection_for_select([unassigned_filter] + @project.users.all, "id", "name", params[:assignee_id]), prompt: "Assignee") - = select_tag(:milestone_id, options_from_collection_for_select([unassigned_filter] + @project.milestones.order("id desc").all, "id", "title", params[:milestone_id]), prompt: "Milestone") + = select_tag(:milestone_id, options_from_collection_for_select([unassigned_filter] + issues_active_milestones, "id", "title", params[:milestone_id]), prompt: "Milestone") = hidden_field_tag :f, params[:f] .clearfix diff --git a/lib/gitlab/logger.rb b/lib/gitlab/logger.rb index 8b4eee5da..389eef339 100644 --- a/lib/gitlab/logger.rb +++ b/lib/gitlab/logger.rb @@ -14,6 +14,11 @@ module Gitlab logs = `tail -n 2000 #{path}`.split("\n") end + def self.read_latest_for filename + path = Rails.root.join("log", filename) + logs = `tail -n 2000 #{path}`.split("\n") + end + def self.build new(Rails.root.join("log", file_name)) end -- 2.11.0