diff options
author | Robert Speicher <rspeicher@gmail.com> | 2017-08-23 00:12:48 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2017-08-23 00:12:48 +0300 |
commit | e288afec9ccd85fb444ec11d5359a17f8c657f06 (patch) | |
tree | 9100a81534adc3262c45c7c59b9314f9ed303012 /app | |
parent | 4598e0c3924b30d11495e803e88a6ded11094318 (diff) |
Refactor `Admin::LogsController#show`
We should be defining the list of loggers in the controller, not the
view.
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/admin/logs_controller.rb | 9 | ||||
-rw-r--r-- | app/views/admin/logs/show.html.haml | 16 |
2 files changed, 15 insertions, 10 deletions
diff --git a/app/controllers/admin/logs_controller.rb b/app/controllers/admin/logs_controller.rb index b999018dde4..bdc4332ae69 100644 --- a/app/controllers/admin/logs_controller.rb +++ b/app/controllers/admin/logs_controller.rb @@ -1,2 +1,11 @@ class Admin::LogsController < Admin::ApplicationController + def show + @loggers = [ + Gitlab::AppLogger, + Gitlab::GitLogger, + Gitlab::EnvironmentLogger, + Gitlab::SidekiqLogger, + Gitlab::RepositoryCheckLogger + ] + end end diff --git a/app/views/admin/logs/show.html.haml b/app/views/admin/logs/show.html.haml index 487f1cf5c4f..ee87f25a225 100644 --- a/app/views/admin/logs/show.html.haml +++ b/app/views/admin/logs/show.html.haml @@ -1,25 +1,21 @@ - @no_container = true - page_title "Logs" -- loggers = [Gitlab::GitLogger, Gitlab::AppLogger, - Gitlab::EnvironmentLogger, Gitlab::SidekiqLogger, - Gitlab::RepositoryCheckLogger] = render 'admin/monitoring/head' %div{ class: container_class } %ul.nav-links.log-tabs - - loggers.each do |klass| - %li{ class: active_when(klass == Gitlab::GitLogger) }> - = link_to klass::file_name, "##{klass::file_name_noext}", - 'data-toggle' => 'tab' + - @loggers.each do |klass| + %li{ class: active_when(klass == @loggers.first) }> + = link_to klass.file_name, "##{klass.file_name_noext}", data: { toggle: 'tab' } .row-content-block To prevent performance issues admin logs output the last 2000 lines .tab-content - - loggers.each do |klass| - .tab-pane{ class: active_when(klass == Gitlab::GitLogger), id: klass::file_name_noext } + - @loggers.each do |klass| + .tab-pane{ class: active_when(klass == @loggers.first), id: klass.file_name_noext } .file-holder#README .js-file-title.file-title %i.fa.fa-file - = klass::file_name + = klass.file_name .pull-right = link_to '#', class: 'log-bottom' do %i.fa.fa-arrow-down |