Generate list with tests failed build_lists

This commit is contained in:
Vokhmin Alexey V 2014-02-03 19:32:31 +04:00
parent 6958c463c6
commit a35448a210
6 changed files with 41 additions and 24 deletions

View File

@ -42,9 +42,9 @@ class Platforms::MassBuildsController < Platforms::BaseController
end
def get_list
text = if params[:kind] == 'failed_builds_list'
@mass_build.generate_failed_builds_list
elsif ['projects_list', 'missed_projects_list'].include? params[:kind]
text = if %w(failed_builds_list tests_failed_builds_list).include? params[:kind]
@mass_build.send "generate_#{params[:kind]}"
elsif %w(projects_list missed_projects_list).include? params[:kind]
@mass_build.send params[:kind]
end
render text: text

View File

@ -62,19 +62,11 @@ class MassBuild < ActiveRecord::Base
later :build_all, queue: :clone_build
def generate_failed_builds_list
report = ""
BuildList.select('build_lists.id, projects.name as project_name, arches.name as arch_name').
where(
status: BuildList::BUILD_ERROR,
mass_build_id: self.id
).joins(:project, :arch).find_in_batches(batch_size: 100) do |build_lists|
build_lists.each do |build_list|
report << "ID: #{build_list.id}; "
report << "PROJECT_NAME: #{build_list.project_name}; "
report << "ARCH: #{build_list.arch_name}\n"
end
end
report
generate_list BuildList::BUILD_ERROR
end
def generate_tests_failed_builds_list
generate_list BuildList::TESTS_FAILED
end
def cancel_all
@ -97,6 +89,22 @@ class MassBuild < ActiveRecord::Base
private
def generate_list(status)
report = ""
BuildList.select('build_lists.id, projects.name as project_name, arches.name as arch_name').
where(
status: status,
mass_build_id: self.id
).joins(:project, :arch).find_in_batches(batch_size: 100) do |build_lists|
build_lists.each do |build_list|
report << "ID: #{build_list.id}; "
report << "PROJECT_NAME: #{build_list.project_name}; "
report << "ARCH: #{build_list.arch_name}\n"
end
end
report
end
def publish(user, *statuses)
builds = build_lists.where(status: statuses)
builds.update_all(publisher_id: user.id)

View File

@ -9,7 +9,7 @@
%th.lpadding16= t('activerecord.attributes.mass_build.id')
%th.lpadding16= t('activerecord.attributes.mass_build.name')
%th.lpadding16= t("layout.mass_builds.statuses")
%th.lpadding16= t("layout.mass_builds.failed_builds_list")
%th.lpadding16= t("layout.mass_builds.lists")
%th.lpadding16= t("layout.mass_builds.actions")
%th.lpadding16= t("layout.mass_builds.extended_data")
- @mass_builds.each do |mass_build|
@ -25,7 +25,15 @@
=link_to_list @platform, mass_build, 'missed_projects_list'
= mass_build.read_attribute 'missed_projects_count'
%td
=link_to_list @platform, mass_build, 'failed_builds_list'
- if mass_build.projects_list.present?
= link_to_list @platform, mass_build, 'projects_list'
.both
%br
= link_to_list @platform, mass_build, 'failed_builds_list'
.both
%br
= link_to_list @platform, mass_build, 'tests_failed_builds_list'
%td.right.mass-build-actions
- if can?(:publish, mass_build)
- unless mass_build.auto_publish?
@ -43,9 +51,6 @@
%td
%a.toggle_btn{href: "#toggle_#{ mass_build.id }", :'data-target' => "#toggle_#{ mass_build.id }"}= t("layout.mass_builds.extended_data")
.toggle{id: "toggle_#{ mass_build.id }"}
-if mass_build.projects_list.present?
= link_to_list @platform, mass_build, 'projects_list'
.both
= t('activerecord.attributes.mass_build.user') + ": "
= link_to mass_build.user.fullname, mass_build.user
- [:arch_names, :auto_publish, :increase_release_tag, :created_at].each do |field|

View File

@ -6,7 +6,9 @@ en:
publish_test_failed: Publish test failed builds
repositories: Repositories
extended_data: Extended data
lists: Lists
failed_builds_list: Failed Builds List
tests_failed_builds_list: Tests failed Builds List
statuses: Statuses
actions: Actions
cancel_confirm: Are you sure you want to cancel mass build?

View File

@ -6,11 +6,13 @@ ru:
publish_test_failed: Опубликовать сборки с проваленными тестами
repositories: Репозитории
extended_data: Параметры задания
failed_builds_list: Список ошибок сборок
lists: Списки
failed_builds_list: Сборки с ошибками
tests_failed_builds_list: Сборки с ошибками в тестах
statuses: Статусы
actions: Действия
cancel_confirm: Вы уверены, что хотите отменить массовую сборку?
projects_list: Список проектов
projects_list: Проекты
missed_projects_list: 'Несуществующие проекты: '
activerecord:
models:

View File

@ -186,7 +186,7 @@ Rosa::Application.routes.draw do
member do
post :cancel
post :publish
get '/:kind.:format' => "mass_builds#get_list", as: :get_list, kind: /failed_builds_list|missed_projects_list|projects_list/
get '/:kind.:format' => "mass_builds#get_list", as: :get_list, kind: /failed_builds_list|missed_projects_list|projects_list|tests_failed_builds_list/
end
end