#757: update name of methods, API
This commit is contained in:
parent
c4113c11fb
commit
65b98a2d00
|
@ -40,7 +40,7 @@ $(document).ready(function() {
|
|||
$('#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 })
|
||||
$.get("/build_lists/add_extra_repos_and_containers", { extra_id: id })
|
||||
.done(function(data) {
|
||||
$("#extra-repos-and-containers table tbody").append(data);
|
||||
});
|
||||
|
|
|
@ -112,7 +112,7 @@ class Projects::BuildListsController < Projects::BaseController
|
|||
}
|
||||
end
|
||||
|
||||
def autocomplete_to_extra
|
||||
def autocomplete_to_extra_repos_and_containers
|
||||
platforms = Platform.includes(:repositories).search(params[:term]).
|
||||
accessible_by(current_ability, :read).search_order.limit(5)
|
||||
results = []
|
||||
|
@ -124,7 +124,7 @@ class Projects::BuildListsController < Projects::BaseController
|
|||
render json: results.to_json
|
||||
end
|
||||
|
||||
def add_extra
|
||||
def add_extra_repos_and_containers
|
||||
if params[:extra_id] =~ /-build-list$/
|
||||
id = params[:extra_id].gsub(/-build-list$/, '')
|
||||
subject = BuildList.where(:id => id).published_container
|
||||
|
|
|
@ -77,11 +77,12 @@ module BuildListsHelper
|
|||
end
|
||||
end
|
||||
|
||||
def container_url(full_path = true)
|
||||
def container_url(full_path = true, build_list = nil)
|
||||
build_list ||= @build_list
|
||||
p = ''
|
||||
p << "http://#{request.host_with_port}" if full_path
|
||||
p << "/downloads/#{@build_list.save_to_platform.name}/container/#{@build_list.id}"
|
||||
p << "/#{@build_list.arch.name}/#{@build_list.save_to_repository.name}/release" if full_path && @build_list.build_for_platform.distrib_type == 'mdv'
|
||||
p << "/downloads/#{build_list.save_to_platform.name}/container/#{build_list.id}"
|
||||
p << "/#{build_list.arch.name}/#{build_list.save_to_repository.name}/release" if full_path && build_list.build_for_platform.distrib_type == 'mdv'
|
||||
p.html_safe
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
json.build_lists @build_lists do |json, build_list|
|
||||
json.(build_list, :id, :name, :status)
|
||||
json.(build_list, :id, :status)
|
||||
json.url api_v1_build_list_path(build_list, :format => :json)
|
||||
end
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
json.build_list do |json|
|
||||
json.(@build_list, :id, :name, :container_status, :status, :duration)
|
||||
json.(@build_list, :is_circle, :update_type, :priority, :new_core)
|
||||
json.(@build_list, :id, :container_status, :status, :duration)
|
||||
json.(@build_list, :update_type, :priority, :new_core)
|
||||
json.(@build_list, :advisory, :mass_build, :use_save_to_repository)
|
||||
json.(@build_list, :auto_publish, :package_version, :commit_hash, :last_published_commit_hash)
|
||||
json.(@build_list, :auto_publish, :package_version, :commit_hash, :last_published_commit_hash, :auto_create_container)
|
||||
json.build_log_url log_build_list_path(@build_list)
|
||||
|
||||
if @build_list.container_published?
|
||||
|
@ -55,6 +55,27 @@ json.build_list do |json|
|
|||
end
|
||||
end
|
||||
|
||||
extra_repos = Repository.includes(:platform).where(:id => @build_list.extra_repositories)
|
||||
json.extra_repos extra_repos do |json_extra_repos, repo|
|
||||
json.partial! 'api/v1/repositories/repository',
|
||||
:repository => repo,
|
||||
:json => json_extra_repos
|
||||
|
||||
json_extra_repos.platform do |json_str_platform|
|
||||
json.partial! 'api/v1/platforms/platform',
|
||||
:platform => repo.platform,
|
||||
:json => json_str_platform
|
||||
end
|
||||
end
|
||||
|
||||
extra_containers = BuildList.where(:id => @build_list.extra_containers)
|
||||
json.extra_containers extra_containers do |json_extra_containers, bl|
|
||||
json_extra_containers.(bl, :id, :status)
|
||||
json_extra_containers.container_path container_url(false, bl)
|
||||
json_extra_containers.url api_v1_build_list_path(bl, :format => :json)
|
||||
end
|
||||
|
||||
|
||||
json.advisory do |json_advisory|
|
||||
json_advisory.name @build_list.advisory.advisory_id
|
||||
json_advisory.(@build_list.advisory, :description)
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
#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'
|
||||
= autocomplete_field_tag 'extra_repos', nil, autocomplete_to_extra_repos_and_containers_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"}
|
||||
|
|
|
@ -221,8 +221,8 @@ Rosa::Application.routes.draw do
|
|||
get :log
|
||||
end
|
||||
collection {
|
||||
get :autocomplete_to_extra
|
||||
get :add_extra
|
||||
get :autocomplete_to_extra_repos_and_containers
|
||||
get :add_extra_repos_and_containers
|
||||
post :search
|
||||
}
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue