[#369] some fixes new build list page
This commit is contained in:
parent
4ba6506450
commit
8748caea02
|
@ -1,40 +1,58 @@
|
||||||
RosaABF.controller('NewBuildListController', ['$scope', '$http', '$timeout',
|
RosaABF.controller('NewBuildListController', ['$scope', '$http', '$timeout', function($scope, $http, $timeout) {
|
||||||
function($scope, $http, $timeout) {
|
|
||||||
|
|
||||||
$scope.save_to_repository = null;
|
$scope.save_to_repository_id = null;
|
||||||
$scope.build_for_platform = null;
|
|
||||||
|
|
||||||
var save_to_repository_id = $('#build_list_save_to_repository_id');
|
var save_to_repository = $('#build_list_save_to_repository_id');
|
||||||
var all_repositories = $('.all_platforms input');
|
var all_repositories = $('.all_platforms input');
|
||||||
var auto_create_container = $('#build_list_auto_create_container');
|
var auto_create_container = $('#build_list_auto_create_container');
|
||||||
var extra_repos = $('.autocomplete-form.extra_repositories');
|
var extra_repos = $('.autocomplete-form.extra_repositories');
|
||||||
var build_list_auto_publish_status = $('#build_list_auto_publish_status');
|
var build_list_auto_publish_status = $('#build_list_auto_publish_status');
|
||||||
var bl_version_sel = $('#build_list_project_version');
|
var bl_version_sel = $('#build_list_project_version');
|
||||||
var all_platforms_name = $('h4.build_for_pl');
|
var all_platforms_name = $('h4.build_for_pl');
|
||||||
|
var build_for_platform_id = null;
|
||||||
|
var build_platform = null;
|
||||||
|
|
||||||
|
$scope.init = function(pl_id, save_to_repository_id) {
|
||||||
|
build_for_platform_id = pl_id;
|
||||||
|
build_platform = $('#build_for_pl_' + pl_id);
|
||||||
|
$scope.save_to_repository_id = save_to_repository_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.getPlatformClass = function(pl_id) {
|
||||||
|
if (build_platform.size() > 0 && build_for_platform_id !== pl_id) {
|
||||||
|
return 'text-muted';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.needHidePlatform = function(pl_id) {
|
||||||
|
if (build_platform.size() > 0 && build_for_platform_id !== pl_id) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$scope.change_save_to_repository = function() {
|
$scope.change_save_to_repository = function() {
|
||||||
|
|
||||||
var selected_option = save_to_repository_id.find("option:selected");
|
var selected_option = save_to_repository.find('option:selected');
|
||||||
var platform_id = selected_option.attr('platform_id');
|
|
||||||
var rep_name = selected_option.text().match(/[\w-]+\/([\w-]+)/)[1];
|
var rep_name = selected_option.text().match(/[\w-]+\/([\w-]+)/)[1];
|
||||||
|
|
||||||
var build_platform = $('#build_for_pl_' + platform_id);
|
build_for_platform_id = selected_option.attr('platform_id');
|
||||||
|
build_platform = $('#build_for_pl_' + build_for_platform_id);
|
||||||
|
|
||||||
all_repositories.removeAttr('checked');
|
all_repositories.removeAttr('checked');
|
||||||
|
|
||||||
updateExtraReposAndBuildLists(platform_id);
|
updateExtraReposAndBuildLists(build_for_platform_id);
|
||||||
updatedDefaultArches(selected_option);
|
updatedDefaultArches(selected_option);
|
||||||
$('.autocomplete-form table tbody').empty();
|
$('.autocomplete-form table tbody').empty();
|
||||||
if (build_platform.size() == 0) {
|
if (build_platform.size() == 0) {
|
||||||
all_repositories.removeAttr('disabled');
|
all_repositories.removeAttr('disabled');
|
||||||
all_platforms_name.removeClass('text-muted');
|
|
||||||
auto_create_container.removeAttr('checked');
|
auto_create_container.removeAttr('checked');
|
||||||
addPersonalPlatformToExtraRepos(selected_option, extra_repos);
|
addPersonalPlatformToExtraRepos(selected_option, extra_repos);
|
||||||
extra_repos.show();
|
extra_repos.show();
|
||||||
} else {
|
} else {
|
||||||
all_repositories.attr('disabled', 'disabled');
|
all_repositories.attr('disabled', 'disabled');
|
||||||
all_platforms_name.addClass('text-muted');
|
|
||||||
build_platform.removeClass('text-muted');
|
|
||||||
extra_repos.hide();
|
extra_repos.hide();
|
||||||
var parent = build_platform.parent();
|
var parent = build_platform.parent();
|
||||||
parent.find('input').removeAttr('disabled');
|
parent.find('input').removeAttr('disabled');
|
||||||
|
|
|
@ -4,20 +4,22 @@
|
||||||
%h3= t 'activerecord.attributes.build_list.build_for_platform'
|
%h3= t 'activerecord.attributes.build_list.build_for_platform'
|
||||||
- build_for_platform = params[:build_list].try :[], :build_for_platform
|
- build_for_platform = params[:build_list].try :[], :build_for_platform
|
||||||
- build_for_platform_id = build_for_platform.try(:id).presence || 'null'
|
- build_for_platform_id = build_for_platform.try(:id).presence || 'null'
|
||||||
.all_platforms{ 'ng-init' => "build_for_platform = #{build_for_platform_id}" }
|
- save_to_repository_id = params[:build_list].try(:[], :save_to_repository_id).presence || 'null'
|
||||||
|
.all_platforms{ 'ng-init' => "init('#{build_for_platform_id}', #{save_to_repository_id})" }
|
||||||
- availables_main_platforms.each do |pl|
|
- availables_main_platforms.each do |pl|
|
||||||
.clearfix
|
%div{ 'ng-hide' => "needHidePlatform('#{pl.id}')" }
|
||||||
%h4{ id: "build_for_pl_#{pl.id}", class: 'build_for_pl',
|
%h4{ id: "build_for_pl_#{pl.id}", class: 'build_for_pl', 'ng-class' => "getPlatformClass('#{pl.id}')" }= pl.name
|
||||||
'ng-class' => "{text-muted: }" }= pl.name
|
|
||||||
= render 'include_repos', platform: pl, build_for_platform: build_for_platform
|
= render 'include_repos', platform: pl, build_for_platform: build_for_platform
|
||||||
.col-md-5
|
.col-md-5
|
||||||
%h3= t 'activerecord.attributes.build_list.save_to_repository'
|
%h3= t 'activerecord.attributes.build_list.save_to_repository'
|
||||||
- selected = params[:build_list].try(:[], :save_to_repository_id).presence || 'null'
|
= f.select :save_to_repository_id, save_to_repositories(project),
|
||||||
= f.select :save_to_repository_id, save_to_repositories(project), {}, class: 'form-control',
|
{ selected: params[:build_list].try(:[], :save_to_repository_id) },
|
||||||
'ng-model' => 'save_to_repository', 'ng-change' => 'change_save_to_repository()',
|
class: 'form-control', 'ng-change' => 'change_save_to_repository()',
|
||||||
'ng-init' => ""
|
'ng-model' => 'save_to_repository_id'
|
||||||
%h3= t 'activerecord.attributes.build_list.project_version'
|
%h3= t 'activerecord.attributes.build_list.project_version'
|
||||||
= f.select :project_version, versions_for_group_select(project), {selected: params[:build_list].try(:[], :project_version) || project.default_branch}, class: 'form-control'
|
= f.select :project_version, versions_for_group_select(project),
|
||||||
|
{ selected: params[:build_list].try(:[], :project_version) || project.default_branch },
|
||||||
|
class: 'form-control'
|
||||||
%h3= t 'activerecord.attributes.build_list.arch'
|
%h3= t 'activerecord.attributes.build_list.arch'
|
||||||
- Arch.recent.each do |arch|
|
- Arch.recent.each do |arch|
|
||||||
- checked = (params[:arches]||[]).include?(arch.id.to_s) || (params[:arches].blank? && controller.action_name == 'new' && Arch::DEFAULT.include?(arch.name))
|
- checked = (params[:arches]||[]).include?(arch.id.to_s) || (params[:arches].blank? && controller.action_name == 'new' && Arch::DEFAULT.include?(arch.name))
|
||||||
|
|
Loading…
Reference in New Issue