Merge branch 'master' of github.com:warpc/rosa-build

This commit is contained in:
George Vinogradov 2011-10-29 17:39:09 +04:00
commit 02ac46019a
11 changed files with 85 additions and 40 deletions

View File

@ -17,6 +17,9 @@ class BuildListsController < ApplicationController
end end
@action_url = all_build_lists_path @action_url = all_build_lists_path
@build_server_status = BuildServer.get_status
#@build_server_status = {:client_count => '1', :count_new_task => '2', :count_build_task => 3}
render :action => 'index' render :action => 'index'
end end

View File

@ -13,7 +13,7 @@ class CategoriesController < ApplicationController
def index def index
if @platform if @platform
@categories = Category.joins(:projects => :repositories).where('repositories.platform_id = ?', @platform.id). @categories = Category.joins(:projects => :repositories).where('repositories.platform_id = ?', @platform.id).
having('count(projects.id) > 0').group('categories.id').default_order having('count(projects.id) > 0').group('categories.id, categories.name, categories.ancestry, categories.projects_count, categories.created_at, categories.updated_at').default_order
@categories_count = @categories.count @categories_count = @categories.count
render 'index2' render 'index2'
else else

View File

@ -58,8 +58,8 @@ class ProjectsController < ApplicationController
def build def build
@arches = Arch.recent @arches = Arch.recent
@pls = Platform.main @bpls = Platform.main
@bpls = @project.repositories.collect { |rep| ["#{rep.platform.name}/#{rep.unixname}", rep.platform.id] } @pls = @project.repositories.collect { |rep| ["#{rep.platform.name}/#{rep.unixname}", rep.platform.id] }
@project_versions = @project.project_versions.collect { |tag| [tag.name, tag.name.gsub(/^\w+\./, "")] }.select { |pv| pv[0] =~ /^v\./ } @project_versions = @project.project_versions.collect { |tag| [tag.name, tag.name.gsub(/^\w+\./, "")] }.select { |pv| pv[0] =~ /^v\./ }
end end
@ -69,10 +69,10 @@ class ProjectsController < ApplicationController
@project_version = params[:build][:project_version] @project_version = params[:build][:project_version]
pls_ids = params[:build][:pl].blank? ? [] : params[:build][:pl].select{|_,v| v == "1"}.collect{|x| x[0].to_i } bpls_ids = params[:build][:bpl].blank? ? [] : params[:build][:bpl].select{|_,v| v == "1"}.collect{|x| x[0].to_i }
pls = Platform.where(:id => pls_ids) bpls = Platform.where(:id => bpls_ids)
bpl = Platform.find params[:build][:bpl] pl = Platform.find params[:build][:pl]
update_type = params[:build][:update_type] update_type = params[:build][:update_type]
build_requires = params[:build][:build_requires] build_requires = params[:build][:build_requires]
@ -80,20 +80,20 @@ class ProjectsController < ApplicationController
if !check_arches || !check_project_versions if !check_arches || !check_project_versions
@arches = Arch.recent @arches = Arch.recent
@pls = Platform.main @bpls = Platform.main
@bpls = @project.repositories.collect { |rep| ["#{rep.platform.name}/#{rep.unixname}", rep.platform.id] } @pls = @project.repositories.collect { |rep| ["#{rep.platform.name}/#{rep.unixname}", rep.platform.id] }
render :action => "build" render :action => "build"
else else
flash[:notice], flash[:error] = "", "" flash[:notice], flash[:error] = "", ""
@arches.each do |arch| @arches.each do |arch|
pls.each do |pl| bpls.each do |bpl|
build_list = @project.build_lists.new(:arch => arch, :project_version => @project_version, :pl => pl, :bpl => bpl, :update_type => update_type, :build_requires => build_requires) build_list = @project.build_lists.new(:arch => arch, :project_version => @project_version, :pl => pl, :bpl => bpl, :update_type => update_type, :build_requires => build_requires)
if build_list.save if build_list.save
flash[:notice] += t("flash.build_list.saved", :project_version => @project_version, :arch => arch.name, :pl => pl.name, :bpl => bpl) flash[:notice] += t("flash.build_list.saved", :project_version => @project_version, :arch => arch.name, :bpl => bpl.name, :pl => pl)
else else
flash[:error] += t("flash.build_list.save_error", :project_version => @project_version, :arch => arch.name, :pl => pl.name, :bpl => bpl) flash[:error] += t("flash.build_list.save_error", :project_version => @project_version, :arch => arch.name, :bpl => bpl.name, :pl => pl)
end end
end end
end end

View File

@ -14,7 +14,7 @@ class BuildList < ActiveRecord::Base
validates :update_type, :inclusion => UPDATE_TYPES validates :update_type, :inclusion => UPDATE_TYPES
validate lambda { validate lambda {
errors.add(:pl, I18n.t('flash.build_list.wrong_platform')) if bpl.platform_type == 'main' && pl_id != bpl_id errors.add(:bpl, I18n.t('flash.build_list.wrong_platform')) if pl.platform_type == 'main' && pl_id != bpl_id
} }
BUILD_CANCELED = 5000 BUILD_CANCELED = 5000

View File

@ -41,7 +41,7 @@ class User < ActiveRecord::Base
create_ssh_key ssh_key create_ssh_key ssh_key
elsif ssh_key_was.present? and ssh_key.blank? elsif ssh_key_was.present? and ssh_key.blank?
destroy_ssh_key ssh_key_was destroy_ssh_key ssh_key_was
elsif ssh_key_changed? elsif ssh_key_changed? and ssh_key.present? and ssh_key_was.present?
update_ssh_key ssh_key_was, ssh_key update_ssh_key ssh_key_was, ssh_key
end end
} }

View File

@ -6,6 +6,18 @@
%li.active= link_to t("layout.build_lists.all"), project_build_lists_path(@project) %li.active= link_to t("layout.build_lists.all"), project_build_lists_path(@project)
.content .content
- if controller.action_name == 'all'
.inner
%h2= t('layout.build_lists.build_server_status.header')
.field
%span= t('layout.build_lists.build_server_status.client_count') + ":"
%span= @build_server_status[:client_count]
.field
%span= t('layout.build_lists.build_server_status.count_new_task') + ":"
%span= @build_server_status[:count_new_task]
.field
%span= t('layout.build_lists.build_server_status.count_build_task') + ":"
%span= @build_server_status[:count_build_task]
.inner .inner
= render :partial => "build_lists/filter", :action_url => @action_url = render :partial => "build_lists/filter", :action_url => @action_url

View File

@ -22,6 +22,26 @@
= t("activerecord.attributes.build_list.container_path") = t("activerecord.attributes.build_list.container_path")
\: \:
= @build_list.container_path = @build_list.container_path
%p
%b
= t("activerecord.attributes.build_list.bpl")
\:
= @build_list.bpl.name
%p
%b
= t("activerecord.attributes.build_list.pl")
\:
= @build_list.pl.name
%p
%b
= t("activerecord.attributes.build_list.update_type")
\:
= @build_list.update_type
%p
%b
= t("activerecord.attributes.build_list.build_requires")
\:
= @build_list.build_requires
%p %p
%b %b
= t("activerecord.attributes.build_list.status") = t("activerecord.attributes.build_list.status")

View File

@ -19,10 +19,10 @@
= f.select :project_version, @project_versions = f.select :project_version, @project_versions
.group.pl_ids_container .group.pl_ids_container
= f.label :pl, t("activerecord.attributes.build_list.pl"), :class => :label = f.label :bpl, t("activerecord.attributes.build_list.bpl"), :class => :label
- @pls.each do |pl| - @bpls.each do |bpl|
= f.check_box "pl[#{pl.id}]", :pl_id => pl.id, :class => 'build_pl_ids' = f.check_box "bpl[#{bpl.id}]", :bpl_id => bpl.id, :class => 'build_bpl_ids'
= pl.name = bpl.name
%br %br
.group .group
@ -43,8 +43,8 @@
%br %br
.group .group
= f.label :bpl, t("activerecord.attributes.build_list.bpl"), :class => :label = f.label :pl, t("activerecord.attributes.build_list.pl"), :class => :label
= f.select :bpl, @bpls = f.select :pl, @pls
.group.navform.wat-cf .group.navform.wat-cf
%button.button{:type => "submit"} %button.button{:type => "submit"}

View File

@ -229,6 +229,12 @@ ru:
cancel_successed: 'Сборка отменена.' cancel_successed: 'Сборка отменена.'
cancel_failed: 'При отмене сборки произошла ошибка!' cancel_failed: 'При отмене сборки произошла ошибка!'
build_server_status:
header: Статус сборочного сервера
client_count: Число клиентов
count_new_task: Число заданий в очереди
count_build_task: Число выполняемых заданий
items: items:
statuses: statuses:
build_error: ошибка сборки build_error: ошибка сборки
@ -305,8 +311,8 @@ ru:
destroyed: Платформа успешно удалена destroyed: Платформа успешно удалена
build_list: build_list:
saved: Билд лист для версии '%{project_version}', платформу '%{pl}' и архитектуры '%{arch}' создан успешно saved: Билд лист для версии '%{project_version}', платформы '%{bpl}' и архитектуры '%{arch}' создан успешно
save_error: Не удалось сохранить билд лист для версии '%{project_version}', платформу '%{pl}' и архитектуры '%{arch}' save_error: Не удалось сохранить билд лист для версии '%{project_version}', платформы '%{bpl}' и архитектуры '%{arch}'
no_project_version_selected: Выберите какую-нибудь версию no_project_version_selected: Выберите какую-нибудь версию
no_project_version_found: Выбранная версия '%{project_version}' не найдена no_project_version_found: Выбранная версия '%{project_version}' не найдена
no_arch_selected: Выберите хотя бы одну ахритектуру no_arch_selected: Выберите хотя бы одну ахритектуру
@ -465,10 +471,10 @@ ru:
additional_repos: Дополнительные репозитории additional_repos: Дополнительные репозитории
updated_at: Обновлен updated_at: Обновлен
created_at: Создан created_at: Создан
bpl: Репозиторий для сохранения пакетов pl: Репозиторий для сохранения пакетов
bpl_id: Репозиторий для сохранения пакетов pl_id: Репозиторий для сохранения пакетов
pl: Платформа bpl: Платформа
pl_id: Платформа bpl_id: Платформа
update_type: Критичность обновления update_type: Критичность обновления
build_requires: Пересборка с зависимостями build_requires: Пересборка с зависимостями
project_version: Версия project_version: Версия

View File

@ -76,6 +76,10 @@ class BuildServer
self.client.call('delete_build_list', idlist) self.client.call('delete_build_list', idlist)
end end
def get_status
self.client.call('get_status')
end
def self.freeze platform_name, new_repo_name = nil def self.freeze platform_name, new_repo_name = nil
self.client.call('freeze_platform', platform_name, new_repo_name) self.client.call('freeze_platform', platform_name, new_repo_name)
end end

View File

@ -15,26 +15,26 @@ function uncheck_by_ids(ids) {
$(document).ready(function() { $(document).ready(function() {
$('.pl_ids_container input[type="hidden"]').remove(); $('.pl_ids_container input[type="hidden"]').remove();
$('select#build_bpl').change(function() { $('select#build_pl').change(function() {
var is_bpl_main = false; var is_pl_main = false;
var granted_pl_id = ''; var granted_bpl_id = '';
var bpl_id = $('select#build_bpl').val(); var pl_id = $('select#build_pl').val();
$('input.build_pl_ids').each(function(i,el) { $('input.build_bpl_ids').each(function(i,el) {
var pl_id = $(el).attr('pl_id'); var bpl_id = $(el).attr('bpl_id');
if (pl_id == bpl_id) { if (pl_id == bpl_id) {
is_bpl_main = true; is_pl_main = true;
//granted_pl_id = $(el).attr('pl_id'); //granted_bpl_id = $(el).attr('bpl_id');
} }
}); });
if (is_bpl_main) { if (is_pl_main) {
$('input.build_pl_ids').attr('disabled', 'disabled'); $('input.build_bpl_ids').attr('disabled', 'disabled');
$('input.build_pl_ids[pl_id="'+bpl_id+'"]').removeAttr('disabled'); $('input.build_bpl_ids[bpl_id="'+pl_id+'"]').removeAttr('disabled');
} else { } else {
$('input.build_pl_ids').removeAttr('disabled'); $('input.build_bpl_ids').removeAttr('disabled');
} }
}); });
$('select#build_bpl').trigger('change'); $('select#build_pl').trigger('change');
}); });