#405: updated UI, added extra_mass_builds to MassBuild

This commit is contained in:
Vokhmin Alexey V 2014-06-27 23:08:14 +04:00
parent f4987ad67b
commit de2d08946f
13 changed files with 78 additions and 6 deletions

View File

@ -14,6 +14,17 @@ class AutocompletesController < ApplicationController
render json: results.to_json
end
def autocomplete_extra_mass_build
mb = MassBuild.where(id: params[:term]).first
results << {
id: mb.id,
value: mb.id,
label: "#{mb.id} - #{mb.name}",
path: platform_mass_build_path(mb.save_to_platform, mb)
} if mb && can?(:show, mb)
render json: results.to_json
end
def autocomplete_extra_repositories
# Only personal and build for platform repositories can be attached to the build
Platform.includes(:repositories).search(params[:term]).search_order

View File

@ -9,16 +9,16 @@ class MassBuild < ActiveRecord::Base
serialize :extra_repositories, Array
serialize :extra_build_lists, Array
serialize :extra_mass_builds, Array
scope :recent, -> { order(created_at: :desc) }
scope :by_platform, -> (platform) { where(save_to_platform_id: platform.id) }
scope :outdated, -> { where("#{table_name}.created_at < ?", Time.now + 1.day - BuildList::MAX_LIVE_TIME) }
scope :search, -> (q) { where("#{table_name}.description ILIKE ?", "%#{q}%") if q.present? }
scope :recent, -> { order(created_at: :desc) }
scope :outdated, -> { where("#{table_name}.created_at < ?", Time.now + 1.day - BuildList::MAX_LIVE_TIME) }
scope :search, -> (q) { where("#{table_name}.description ILIKE ?", "%#{q}%") if q.present? }
attr_accessor :arches
attr_accessible :arches, :auto_publish_status, :projects_list, :build_for_platform_id,
:extra_repositories, :extra_build_lists, :increase_release_tag,
:use_cached_chroot, :use_extra_tests, :description
:use_cached_chroot, :use_extra_tests, :description, :extra_mass_builds
validates :save_to_platform_id,
:build_for_platform_id,

View File

@ -36,6 +36,12 @@
placeholder: 'uxteam_personal',
subject: @mass_build,
autocomplete_path: autocomplete_extra_repositories_autocompletes_path
= render 'shared/autocomplete_form',
field: :extra_mass_builds,
field_class: MassBuild,
placeholder: '1000000',
subject: @mass_build,
autocomplete_path: autocomplete_extra_mass_build_autocompletes_path
= render 'shared/autocomplete_form',
field: :extra_build_lists,
field_class: BuildList,

View File

@ -18,6 +18,10 @@
%td
%b= t('activerecord.attributes.mass_build.arch_names')
%td= @mass_build.arch_names
%tr
%td
%b= t('activerecord.attributes.mass_build.build_for_platform')
%td= link_to @mass_build.build_for_platform.name, platform_path(@mass_build.build_for_platform)
%tr
%td
%b= t('activerecord.attributes.mass_build.auto_publish_status')
@ -42,6 +46,40 @@
%td
%b= t('activerecord.attributes.mass_build.description')
%td= @mass_build.description
%tr
%td
%b= t("activerecord.attributes.build_list.extra_repositories")
%td
- if @mass_build.extra_repositories.present?
- Repository.where(id: @mass_build.extra_repositories).each do |repo|
%p= link_to "#{repo.platform.name}/#{repo.name}", [repo.platform, repo]
.both
- else
= t('layout.false_')
%tr
%td
%b= t("activerecord.attributes.build_list.extra_mass_builds")
%td
- if @mass_build.extra_mass_builds.present?
- MassBuild.where(id: @mass_build.extra_mass_builds).each do |mb|
%p= link_to "#{mb.id} - #{mb.name}", platform_mass_build_path(mb.save_to_platform, mb)
.both
- else
= t('layout.false_')
%tr
%td
%b= t("activerecord.attributes.build_list.extra_build_lists")
%td
- if @mass_build.extra_build_lists.present?
- BuildList.where(id: @mass_build.extra_build_lists).each do |bl|
%p= link_to "#{bl.id} (#{bl.project.name} - #{bl.arch.name})", bl
.both
- else
= t('layout.false_')
%tr
%td
%td

View File

@ -0,0 +1,3 @@
:markdown
__Ability to attach at assembly packages of mass builds as additional sources of packages.__

View File

@ -0,0 +1,3 @@
:markdown
__Возможность подключить для сборки пакеты из массовой сборки как дополнительные источники пакетов.__

View File

@ -9,6 +9,7 @@ en:
name: Name
extra_repositories: Extra repositories
extra_build_lists: Extra build lists
extra_mass_builds: Extra mass builds
auto_create_container: Create container automatically
use_cached_chroot: Use cached chroot
use_extra_tests: Use extra tests

View File

@ -9,6 +9,7 @@ ru:
name: Название
extra_repositories: Дополнительные репозитории
extra_build_lists: Дополнительные сборки
extra_mass_builds: Дополнительные массовые сборки
auto_create_container: Создать контейнер автоматически
use_cached_chroot: Использовать кэшированный chroot
use_extra_tests: Использовать дополнительные тесты

View File

@ -37,3 +37,4 @@ en:
use_extra_tests: Use extra tests
repositories: Repositories
projects_list: Projects list
build_for_platform: Build for platform

View File

@ -38,3 +38,4 @@ ru:
use_extra_tests: Использовать дополнительные тесты
repositories: Репозитории
projects_list: Список проектов
build_for_platform: Собрано для платформы

View File

@ -230,6 +230,7 @@ Rosa::Application.routes.draw do
get :autocomplete_user_uname
get :autocomplete_group_uname
get :autocomplete_extra_build_list
get :autocomplete_extra_mass_build
get :autocomplete_extra_repositories
end
end

View File

@ -0,0 +1,5 @@
class AddExtraMassBuildsToMassBuilds < ActiveRecord::Migration
def change
add_column :mass_builds, :extra_mass_builds, :text
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20140627162053) do
ActiveRecord::Schema.define(version: 20140627173727) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -328,6 +328,7 @@ ActiveRecord::Schema.define(version: 20140627162053) do
t.boolean "use_extra_tests", default: false, null: false
t.string "description"
t.string "auto_publish_status", default: "none", null: false
t.text "extra_mass_builds"
end
create_table "users", force: true do |t|