#142: some refactoring according to Alexander's comments

This commit is contained in:
Vokhmin Alexey V 2013-05-24 13:26:32 +04:00
parent 59a22d00fd
commit 04f20185c8
4 changed files with 40 additions and 34 deletions

View File

@ -1,5 +1,5 @@
- content_for :sidebar do
= render 'projects/build_lists/server_status', :queues => [:iso]
= render 'server_status'
= form_tag product_build_lists_path, :method => :get, :html => {:class => :form} do
.block

View File

@ -0,0 +1,15 @@
.bordered.nopadding
%h3.medium= t('layout.build_lists.build_server_status.header')
.table
.lefter= t("layout.build_lists.build_server_status.iso_workers")
.both
- [:workers, :tasks, :build_tasks].each do |metric|
.table
.lefter= t("layout.build_lists.build_server_status.#{metric}")
.righter= @build_server_status[:iso][metric]
.both
%br

View File

@ -1,42 +1,32 @@
- queues ||= [:rpm, :publish]
.bordered.nopadding
%h3.medium= t('layout.build_lists.build_server_status.header')
- if queues.include? :rpm
.table
.lefter= t("layout.build_lists.build_server_status.rpm_workers")
.both
.table
.lefter= t("layout.build_lists.build_server_status.workers")
.righter= @build_server_status[:rpm][:workers]
.both
.table
.lefter= t("layout.build_lists.build_server_status.tasks")
.both
- [['user_tasks', :default_tasks], ['mass_build_tasks', :low_tasks]].each do |label, metric|
.table
.lefter= t("layout.build_lists.build_server_status.rpm_workers")
.lefter= t("layout.build_lists.build_server_status.#{label}")
.righter= @build_server_status[:rpm][metric]
.both
.table
.lefter= t("layout.build_lists.build_server_status.workers")
.righter= @build_server_status[:rpm][:workers]
.both
.table
.lefter= t("layout.build_lists.build_server_status.tasks")
.both
.table
.lefter= t("layout.build_lists.build_server_status.user_tasks")
.righter= @build_server_status[:rpm][:default_tasks]
.both
.table
.lefter= t("layout.build_lists.build_server_status.mass_build_tasks")
.righter= @build_server_status[:rpm][:low_tasks]
.both
%br
%br
- (queues - [:rpm]).each do |queue|
.table
.lefter= t("layout.build_lists.build_server_status.publish_workers")
.both
- [:workers, :tasks, :build_tasks].each do |metric|
.table
.lefter= t("layout.build_lists.build_server_status.#{queue}_workers")
.lefter= t("layout.build_lists.build_server_status.#{metric}")
.righter= @build_server_status[:publish][metric]
.both
- [:workers, :tasks, :build_tasks].each do |metric|
.table
.lefter= t("layout.build_lists.build_server_status.#{metric}")
- if metric == :tasks
- count = @build_server_status[queue][:default_tasks] + @build_server_status[queue][:low_tasks]
- else
- count = @build_server_status[queue][metric]
.righter= count
.both
%br
%br

View File

@ -32,8 +32,9 @@ module AbfWorker
{
:workers => workers.count,
:build_tasks => workers.select{ |w| w.working? }.count,
:default_tasks => redis.llen("#{key}_default"),
:low_tasks => redis.llen(key)
:default_tasks => default_tasks,
:low_tasks => tasks,
:tasks => (default_tasks + tasks)
}
end