#633: UI has been updated
This commit is contained in:
parent
5a699ad379
commit
a99bfee4a6
|
@ -1,27 +1,30 @@
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
// TODO: Refactor this handler!! It's too complicated.
|
// TODO: Refactor this handler!! It's too complicated.
|
||||||
$('#build_list_save_to_platform_id').change(function() {
|
$('#build_list_save_to_repository_id').change(function() {
|
||||||
var platform_id = $(this).val();
|
var selected_option = $(this).find("option:selected");
|
||||||
|
|
||||||
|
var platform_id = selected_option.attr('platform_id');
|
||||||
|
var rep_name = selected_option.text().match(/[\w-]+\/([\w-]+)/)[1];
|
||||||
var base_platforms = $('.all_platforms input[type=checkbox].build_bpl_ids');
|
var base_platforms = $('.all_platforms input[type=checkbox].build_bpl_ids');
|
||||||
|
|
||||||
base_platforms.each(function(){
|
base_platforms.each(function(){
|
||||||
|
var offset25 = $(this).parent().find('.offset25');
|
||||||
if ($.inArray(platform_id, base_platforms.map(function(){ return $(this).val(); }).get()) >= 0) {
|
if ($.inArray(platform_id, base_platforms.map(function(){ return $(this).val(); }).get()) >= 0) {
|
||||||
if ($(this).val() == platform_id) {
|
if ($(this).val() == platform_id) {
|
||||||
$(this).attr('checked', 'checked').removeAttr('disabled').trigger('change');
|
$(this).attr('checked', 'checked').attr('disabled', 'disabled').trigger('change');
|
||||||
$(this).parent().find('.offset25 input[type="checkbox"]').removeAttr('disabled');
|
offset25.find('input[type="checkbox"]').removeAttr('disabled');
|
||||||
|
|
||||||
var rep_name = $('#build_list_save_to_platform_id option[value="' + $(this).val() + '"]').text().match(/[\w-]+\/([\w-]+)/)[1];
|
|
||||||
if (rep_name != 'main') {
|
if (rep_name != 'main') {
|
||||||
$(this).parent().find('.offset25 input[type="checkbox"][rep_name="' + rep_name + '"]').attr('checked', 'checked');
|
offset25.find('input[type="checkbox"][rep_name="' + rep_name + '"]').attr('checked', 'checked');
|
||||||
}
|
}
|
||||||
$(this).parent().find('.offset25 input[type="checkbox"][rep_name="main"]').attr('checked', 'checked');
|
offset25.find('input[type="checkbox"][rep_name="main"]').attr('checked', 'checked');
|
||||||
} else {
|
} else {
|
||||||
$(this).removeAttr('checked').attr('disabled', 'disabled').trigger('change');
|
$(this).removeAttr('checked').attr('disabled', 'disabled').trigger('change');
|
||||||
$(this).parent().find('.offset25 input[type="checkbox"]').attr('disabled', 'disabled').removeAttr('checked');
|
offset25.find('input[type="checkbox"]').attr('disabled', 'disabled').removeAttr('checked');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$(this).removeAttr('disabled').removeAttr('checked').trigger('change');
|
$(this).removeAttr('disabled').removeAttr('checked').trigger('change');
|
||||||
$(this).parent().find('.offset25 input[type="checkbox"]').removeAttr('disabled').removeAttr('checked');
|
offset25.find('input[type="checkbox"]').removeAttr('disabled').removeAttr('checked');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -35,11 +38,7 @@ $(document).ready(function() {
|
||||||
checkAccessToAutomatedPublising();
|
checkAccessToAutomatedPublising();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.all_platforms .offset25 input').change(function() {
|
$('#build_list_save_to_repository_id').trigger('change');
|
||||||
checkAccessToAutomatedPublising();
|
|
||||||
});
|
|
||||||
|
|
||||||
$('#build_list_save_to_platform_id').trigger('change');
|
|
||||||
|
|
||||||
$('.offset25 label').click(function() {
|
$('.offset25 label').click(function() {
|
||||||
setPlChecked($(this).prev()[0], !$(this).prev().attr('checked'));
|
setPlChecked($(this).prev()[0], !$(this).prev().attr('checked'));
|
||||||
|
@ -54,13 +53,15 @@ $(document).ready(function() {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function getSaveToRepositoryOption() {
|
||||||
|
return $('#build_list_save_to_repository_id option:selected');
|
||||||
|
}
|
||||||
|
|
||||||
function checkAccessToAutomatedPublising() {
|
function checkAccessToAutomatedPublising() {
|
||||||
if ($('.all_platforms .offset25 input:checked[publish_without_qa="1"]').length > 0) {
|
if (getSaveToRepositoryOption().attr('publish_without_qa') == '1') {
|
||||||
$('#build_list_auto_publish').removeAttr('disabled').attr('checked', 'checked');
|
$('#build_list_auto_publish').removeAttr('disabled').attr('checked', 'checked');
|
||||||
//enableUpdateTypes();
|
|
||||||
} else {
|
} else {
|
||||||
$('#build_list_auto_publish').removeAttr('checked').attr('disabled', 'disabled');
|
$('#build_list_auto_publish').removeAttr('checked').attr('disabled', 'disabled');
|
||||||
//disableUpdateTypes();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,16 +70,17 @@ function setPlChecked(pointer, checked) {
|
||||||
var pl_id = pl_cbx.val();
|
var pl_id = pl_cbx.val();
|
||||||
if (checked && !$(pointer).attr('disabled')) {
|
if (checked && !$(pointer).attr('disabled')) {
|
||||||
pl_cbx.attr('checked', 'checked').trigger('change');
|
pl_cbx.attr('checked', 'checked').trigger('change');
|
||||||
} else if ($('input[pl_id=' + pl_id + '][checked="checked"]').size() === 0) {
|
} else if ($('input[save_to_platform_id=' + pl_id + '][checked="checked"]').size() === 0) {
|
||||||
pl_cbx.removeAttr('checked').trigger('change');
|
pl_cbx.removeAttr('checked').trigger('change');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setBranchSelected() {
|
function setBranchSelected() {
|
||||||
var pl_id = $('#build_list_save_to_platform_id').val();
|
var selected_option = getSaveToRepositoryOption();
|
||||||
|
var pl_id = selected_option.attr('platform_id');
|
||||||
// Checks if selected platform is main or not:
|
// Checks if selected platform is main or not:
|
||||||
if ( $('.all_platforms').find('input[type="checkbox"][value=' + pl_id + '].build_bpl_ids').size() > 0 ) {
|
if ( $('.all_platforms').find('input[type="checkbox"][value=' + pl_id + '].build_bpl_ids').size() > 0 ) {
|
||||||
var pl_name = $('#build_list_save_to_platform_id option[value="' + pl_id + '"]').text().match(/([\w-.]+)\/[\w-.]+/)[1];
|
var pl_name = selected_option.text().match(/([\w-.]+)\/[\w-.]+/)[1];
|
||||||
var branch_pl_opt = $('#build_list_project_version option[value="latest_' + pl_name + '"]');
|
var branch_pl_opt = $('#build_list_project_version option[value="latest_' + pl_name + '"]');
|
||||||
// If there is branch we need - set it selected:
|
// If there is branch we need - set it selected:
|
||||||
if ( branch_pl_opt.size() > 0 ) {
|
if ( branch_pl_opt.size() > 0 ) {
|
||||||
|
|
|
@ -44,15 +44,18 @@ class Projects::BuildListsController < Projects::BaseController
|
||||||
def create
|
def create
|
||||||
notices, errors = [], []
|
notices, errors = [], []
|
||||||
|
|
||||||
@platform = Platform.includes(:repositories).find params[:build_list][:save_to_platform_id]
|
@repository = Repository.find params[:build_list][:save_to_repository_id]
|
||||||
|
@platform = @repository.platform
|
||||||
|
|
||||||
@repository = @project.repositories.where(:id => @platform.repository_ids).first
|
params[:build_list][:save_to_platform_id] = @platform.id
|
||||||
|
|
||||||
params[:build_list][:save_to_repository_id] = @repository.id
|
|
||||||
params[:build_list][:auto_publish] = false unless @repository.publish_without_qa?
|
params[:build_list][:auto_publish] = false unless @repository.publish_without_qa?
|
||||||
|
|
||||||
|
|
||||||
|
build_for_platforms = Repository.select(:platform_id).
|
||||||
|
where(:id => params[:build_list][:include_repos]).group(:platform_id)
|
||||||
|
|
||||||
Arch.where(:id => params[:arches]).each do |arch|
|
Arch.where(:id => params[:arches]).each do |arch|
|
||||||
Platform.main.where(:id => params[:build_for_platforms]).each do |build_for_platform|
|
Platform.main.where(:id => build_for_platforms).each do |build_for_platform|
|
||||||
@build_list = @project.build_lists.build(params[:build_list])
|
@build_list = @project.build_lists.build(params[:build_list])
|
||||||
@build_list.commit_hash = @project.repo.commits(@build_list.project_version.match(/^latest_(.+)/).to_a.last ||
|
@build_list.commit_hash = @project.repo.commits(@build_list.project_version.match(/^latest_(.+)/).to_a.last ||
|
||||||
@build_list.project_version).first.id if @build_list.project_version
|
@build_list.project_version).first.id if @build_list.project_version
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
- platform.repositories.each do |repo|
|
- platform.repositories.each do |repo|
|
||||||
.both
|
.both
|
||||||
= check_box_tag "build_list[include_repos][]", repo.id, repo.name == 'main' || @project.repositories.map(&:id).include?(repo.id), :id => "include_repos_#{repo.id}", :save_to_platform_id => platform.id, :rep_name => repo.name, :publish_without_qa => repo.publish_without_qa? ? 1 : 0
|
= check_box_tag "build_list[include_repos][]", repo.id, repo.name == 'main' || @project.repositories.map(&:id).include?(repo.id), :id => "include_repos_#{repo.id}", :save_to_platform_id => platform.id, :rep_name => repo.name
|
||||||
= label_tag "include_repos_#{repo.id}", repo.name
|
= label_tag "include_repos_#{repo.id}", repo.name
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
= label_tag "bpls_#{pl.id}", pl.name
|
= label_tag "bpls_#{pl.id}", pl.name
|
||||||
.offset25{:style => 'padding-left: 25px'}= render 'include_repos', :platform => pl
|
.offset25{:style => 'padding-left: 25px'}= render 'include_repos', :platform => pl
|
||||||
%section.right
|
%section.right
|
||||||
%h3= t("activerecord.attributes.build_list.save_to_platform")
|
%h3= t("activerecord.attributes.build_list.save_to_repository")
|
||||||
.lineForm= f.select :save_to_platform_id, @project.repositories.collect{|r| ["#{r.platform.name}/#{r.name}", r.platform.id]}
|
.lineForm= f.select :save_to_repository_id, @project.repositories.collect{|r| ["#{r.platform.name}/#{r.name}", r.id, {:publish_without_qa => r.publish_without_qa? ? 1 : 0, :platform_id => r.platform.id}]}
|
||||||
%h3= t("activerecord.attributes.build_list.project_version")
|
%h3= t("activerecord.attributes.build_list.project_version")
|
||||||
.lineForm= f.select :project_version, versions_for_group_select(@project), :selected => params[:build_list].try(:fetch, :project_version) || "latest_" + @project.default_branch
|
.lineForm= f.select :project_version, versions_for_group_select(@project), :selected => params[:build_list].try(:fetch, :project_version) || "latest_" + @project.default_branch
|
||||||
%h3= t("activerecord.attributes.build_list.arch")
|
%h3= t("activerecord.attributes.build_list.arch")
|
||||||
|
|
|
@ -18,8 +18,7 @@ en:
|
||||||
additional_repos: Additional repositories
|
additional_repos: Additional repositories
|
||||||
include_repos: Included repositories
|
include_repos: Included repositories
|
||||||
created_at: Created on
|
created_at: Created on
|
||||||
save_to_platform: Platform
|
save_to_repository: Save to repository
|
||||||
save_to_repository: Repository
|
|
||||||
build_for_platform: Build for platform
|
build_for_platform: Build for platform
|
||||||
update_type: Update type
|
update_type: Update type
|
||||||
build_requires: Build with all the required packages
|
build_requires: Build with all the required packages
|
||||||
|
|
|
@ -18,8 +18,7 @@ ru:
|
||||||
additional_repos: Дополнительные репозитории
|
additional_repos: Дополнительные репозитории
|
||||||
include_repos: Подключаемые репозитории
|
include_repos: Подключаемые репозитории
|
||||||
created_at: Создан
|
created_at: Создан
|
||||||
save_to_platform: Платформа
|
save_to_repository: Сохранено в репозиторий
|
||||||
save_to_repository: Репозиторий
|
|
||||||
build_for_platform: Собрано для платформы
|
build_for_platform: Собрано для платформы
|
||||||
update_type: Критичность обновления
|
update_type: Критичность обновления
|
||||||
build_requires: Пересборка с зависимостями
|
build_requires: Пересборка с зависимостями
|
||||||
|
|
Loading…
Reference in New Issue