Added flash message about ability to publish build

This commit is contained in:
Vokhmin Alexey V 2014-06-17 22:32:48 +04:00
parent c05e06b308
commit 3c670c369a
4 changed files with 17 additions and 9 deletions

View File

@ -609,18 +609,18 @@ class BuildList < ActiveRecord::Base
end
later :delayed_add_job_to_abf_worker_queue, delay: 60, queue: :middle
protected
def valid_branch_for_publish?
return true if save_to_platform.personal? ||
save_to_repository.publish_builds_only_from_branch.blank? ||
( project_version == save_to_repository.publish_builds_only_from_branch )
project.repo.git.native(:branch, {}, '--contains', commit_hash).
gsub(/\*/, '').split(/\n/).map(&:strip).
include?(save_to_repository.publish_builds_only_from_branch)
@valid_branch_for_publish ||= begin
save_to_platform.personal? ||
save_to_repository.publish_builds_only_from_branch.blank? ||
( project_version == save_to_repository.publish_builds_only_from_branch ) ||
project.repo.git.native(:branch, {}, '--contains', commit_hash).
gsub(/\*/, '').split(/\n/).map(&:strip).
include?(save_to_repository.publish_builds_only_from_branch)
end
end
protected
def create_container
AbfWorker::BuildListsPublishTaskManager.create_container_for self

View File

@ -171,6 +171,12 @@
.flash_notify
.alert.alert-error= t('layout.build_lists.publish_with_extra_fail')
.both
- unless @build_list.valid_branch_for_publish?
.flash_notify
.alert.alert-error= t('layout.build_lists.wrong_branch_for_publish_html', branch: @build_list.save_to_repository.publish_builds_only_from_branch)
.both
%div{'ng-show' => 'build_list.can_publish && build_list.can_publish_in_future && !build_list.can_publish_into_repository'}
.flash_notify
.alert.alert-error= t('flash.build_list.not_all_build_lists_success')

View File

@ -105,6 +105,7 @@ en:
new_header: New build
main_data: Main data
tests_failed: Some tests failed. Be careful!
wrong_branch_for_publish_html: Build can be published only from <b>%{branch}</b> branch
human_current_duration: Build currently takes %{hours} h. %{minutes} min.
human_duration: Built in %{hours} h. %{minutes} min.

View File

@ -104,6 +104,7 @@ ru:
new_header: Новая сборка
main_data: Основные данные
tests_failed: Некоторые тесты провалились. Будьте осторожны!
wrong_branch_for_publish_html: Публикация разрешена только для сборок из <b>%{branch}</b> ветки
human_current_duration: Сборка длится уже %{hours} ч. %{minutes} мин.
human_duration: Собрано за %{hours} ч. %{minutes} мин.