Commit 88519e90331339aa67420390193aaf32f7682c90

Authored by Dmitriy Zaporozhets
1 parent 9f31fbc9

Refactor and restyle Admin#background_jobs page

app/controllers/admin/background_jobs_controller.rb
1 1 class Admin::BackgroundJobsController < Admin::ApplicationController
2 2 def show
  3 + @sidekiq_processes = `ps -U #{Settings.gitlab.user} -o euser,pid,pcpu,pmem,stat,start,command | grep sidekiq | grep -v grep`
3 4 end
4 5 end
... ...
app/views/admin/background_jobs/show.html.haml
1 1 %h3.page-title Background Jobs
2   -%br
  2 +%p.light GitLab use #{link_to "sidekiq", "http://sidekiq.org/"} library for async job processing
  3 +
  4 +%hr
  5 +
  6 +.ui-box
  7 + .title Sidekiq running processes
  8 + .ui-box-body
  9 + - if @sidekiq_processes.empty?
  10 + %h4.cred
  11 + %i.icon-warning-sign
  12 + There are no running sidekiq processes. Please restart GitLab
  13 + - else
  14 + %table.table
  15 + %thead
  16 + %th USER
  17 + %th
  18 + %th PID
  19 + %th
  20 + %th CPU
  21 + %th
  22 + %th MEM
  23 + %th
  24 + %th STATE
  25 + %th
  26 + %th START
  27 + %th
  28 + %th COMMAND
  29 + %th
  30 + - @sidekiq_processes.split("\n").each do |process|
  31 + - next unless process.match(/(sidekiq \d+\.\d+\.\d+.+$)/)
  32 + - data = process.gsub!(/\s+/m, '|').strip.split('|')
  33 + %tr
  34 + - 6.times do
  35 + %td= data.shift
  36 + %td
  37 + %td= data.join(" ")
  38 +
  39 + .clearfix
  40 + %p
  41 + %i.icon-exclamation-sign
  42 + If '[25 of 25 busy]' is shown, restart GitLab with 'sudo service gitlab reload'.
  43 + %p
  44 + %i.icon-exclamation-sign
  45 + If more than one sidekiq process is listed, stop GitLab, kill the remaining sidekiq processes (sudo pkill -u #{Settings.gitlab.user} -f sidekiq) and restart GitLab.
  46 +
  47 +
  48 +
3 49 .ui-box
4 50 %iframe{src: sidekiq_path, width: '100%', height: 900, style: "border: none"}
5   -%h4 Sidekiq running processes
6   -- sidekiq_processes = `ps -U #{Settings.gitlab.user} -o euser,pid,pcpu,pmem,stat,start,command | grep sidekiq | grep -v grep`
7   -- if sidekiq_processes.empty?
8   - %b There are no running sidekiq processes
9   - %b Please restart GitLab
10   -- else
11   - .ui-box
12   - %table.zebra-striped
13   - %thead
14   - %th USER
15   - %th
16   - %th PID
17   - %th
18   - %th CPU
19   - %th
20   - %th MEM
21   - %th
22   - %th STATE
23   - %th
24   - %th START
25   - %th
26   - %th COMMAND
27   - %th
28   - - sidekiq_processes.split("\n").each do |process|
29   - - next unless process.match(/(sidekiq \d+\.\d+\.\d+.+$)/)
30   - - data = process.gsub!(/\s+/m, '|').strip.split('|')
31   - %tr
32   - - 6.times do
33   - %td= data.shift
34   - %td
35   - %td= data.join(" ")
36   - %b If '[25 of 25 busy]' is shown, restart GitLab with 'sudo service gitlab reload'.
37   - %br
38   - %b If more than one sidekiq process is listed, stop GitLab, kill the remaining sidekiq processes (sudo pkill -u #{Settings.gitlab.user} -f sidekiq) and restart GitLab.
... ...