#757: add migration, update UI, JS
This commit is contained in:
parent
7efae107eb
commit
20691dabc5
|
@ -34,6 +34,18 @@ $(document).ready(function() {
|
|||
});
|
||||
|
||||
$('#build_list_save_to_repository_id').trigger('change');
|
||||
|
||||
$('#extra-repos-and-containers #add').click(function() {
|
||||
var id = $('#extra_repo_field').val();
|
||||
if (id.length > 0) {
|
||||
$.get("/build_lists/add_extra", { extra_id: id })
|
||||
.done(function(data) {
|
||||
$("#extra-repos-and-containers table tbody").append(data);
|
||||
});
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
function setBranchSelected(selected_option) {
|
||||
|
|
|
@ -1785,3 +1785,8 @@ div.right.slim {
|
|||
font-size: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
#extra-repos-and-containers {
|
||||
width: 330px;
|
||||
.actions { width: 50px; }
|
||||
}
|
|
@ -112,6 +112,25 @@ class Projects::BuildListsController < Projects::BaseController
|
|||
}
|
||||
end
|
||||
|
||||
def autocomplete_to_extra
|
||||
platforms = Platform.includes(:repositories).search(params[:term]).search_order.limit(5)
|
||||
results = []
|
||||
platforms.each{ |p| p.repositories.each{ |r| results << {id: r.id, label: "#{p.name}/#{r.name}", value: "#{p.name}/#{r.name}"} } }
|
||||
|
||||
bl = BuildList.where(id: params[:term]).first
|
||||
results << {id: "#{bl.id}-build-list", value: bl.id, label: 'Build list'} if bl
|
||||
render json: results.to_json
|
||||
end
|
||||
|
||||
def add_extra
|
||||
if params[:extra_id] =~ /-build-list$/
|
||||
subject = BuildList.find(params[:extra_id].gsub(/-build-list$/, ''))
|
||||
else
|
||||
subject = Repository.find params[:extra_id]
|
||||
end
|
||||
render partial: 'extra', locals: {subject: subject}
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def find_build_list
|
||||
|
|
|
@ -47,7 +47,8 @@ class BuildList < ActiveRecord::Base
|
|||
|
||||
attr_accessible :include_repos, :auto_publish, :build_for_platform_id, :commit_hash,
|
||||
:arch_id, :project_id, :save_to_repository_id, :update_type,
|
||||
:save_to_platform_id, :project_version, :use_save_to_repository
|
||||
:save_to_platform_id, :project_version, :use_save_to_repository,
|
||||
:auto_create_container, :extra_repositories, :extra_containers
|
||||
LIVE_TIME = 4.week # for unpublished
|
||||
MAX_LIVE_TIME = 3.month # for published
|
||||
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
%tr
|
||||
- if subject.is_a?(BuildList)
|
||||
%td= link_to subject.id, subject
|
||||
- else
|
||||
%td= link_to "#{subject.platform.name}/#{subject.name}", [subject.platform, subject]
|
||||
%td.actions
|
||||
%span.delete
|
|
@ -22,13 +22,27 @@
|
|||
= label_tag "arches_#{arch.id}", arch.name
|
||||
%h3= t("activerecord.attributes.build_list.update_type")
|
||||
.lineForm= f.select :update_type, BuildList::UPDATE_TYPES
|
||||
|
||||
|
||||
|
||||
#extra-repos-and-containers
|
||||
%h3= t("activerecord.attributes.build_list.extra_repos")
|
||||
= autocomplete_field_tag 'extra_repos', nil, autocomplete_to_extra_build_lists_path, :id_element => '#extra_repo_field'
|
||||
= hidden_field_tag 'extra_repo', nil, :id => 'extra_repo_field'
|
||||
= submit_tag t("layout.add"), :class => 'button', :id => 'add'
|
||||
%table.tablesorter{:cellpadding => "0", :cellspacing => "0"}
|
||||
%tbody
|
||||
- Repository.where(id: @build_list.extra_repositories).each do |repo|
|
||||
= render 'extra', subject: repo
|
||||
|
||||
- BuildList.where(id: @build_list.extra_containers).each do |bl|
|
||||
= render 'extra', subject: bl
|
||||
|
||||
%h3= t("activerecord.attributes.build_list.preferences")
|
||||
.both
|
||||
= f.check_box :auto_publish
|
||||
= f.label :auto_publish
|
||||
.both
|
||||
= f.check_box :use_save_to_repository
|
||||
= f.label :use_save_to_repository
|
||||
- [:auto_publish, :auto_create_container, :use_save_to_repository].each do |kind|
|
||||
.both
|
||||
= f.check_box kind
|
||||
= f.label kind
|
||||
%br
|
||||
= f.submit t("layout.projects.build_button")
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ en:
|
|||
build_list:
|
||||
bs_id: Id
|
||||
name: Name
|
||||
extra_repos: Extra repositories and containers
|
||||
container_path: Container path
|
||||
status: Status
|
||||
project_id: Project
|
||||
|
|
|
@ -7,6 +7,7 @@ ru:
|
|||
build_list:
|
||||
bs_id: Id
|
||||
name: Название
|
||||
extra_repos: Дополнительные репозитории и контейнеры
|
||||
container_path: Путь до контейнера
|
||||
status: Статус
|
||||
project_id: Проект
|
||||
|
|
|
@ -220,7 +220,11 @@ Rosa::Application.routes.draw do
|
|||
put :create_container
|
||||
get :log
|
||||
end
|
||||
collection { post :search }
|
||||
collection {
|
||||
get :autocomplete_to_extra
|
||||
get :add_extra
|
||||
post :search
|
||||
}
|
||||
end
|
||||
|
||||
resources :projects, :only => [:index, :new, :create]
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
class AddExtraRepositoriesAndContainersToBuildList < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :build_lists, :auto_create_container, :boolean
|
||||
add_column :build_lists, :extra_repositories, :text
|
||||
add_column :build_lists, :extra_containers, :text
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20130214101404) do
|
||||
ActiveRecord::Schema.define(:version => 20130218135847) do
|
||||
|
||||
create_table "activity_feeds", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
|
@ -134,6 +134,9 @@ ActiveRecord::Schema.define(:version => 20130214101404) do
|
|||
t.string "last_published_commit_hash"
|
||||
t.integer "container_status"
|
||||
t.boolean "use_save_to_repository", :default => true
|
||||
t.boolean "auto_create_container"
|
||||
t.text "extra_repositories"
|
||||
t.text "extra_containers"
|
||||
end
|
||||
|
||||
add_index "build_lists", ["advisory_id"], :name => "index_build_lists_on_advisory_id"
|
||||
|
|
Loading…
Reference in New Issue