#369: updated UI for MassBuilds (#index, #show actions)

This commit is contained in:
Vokhmin Alexey V 2014-10-28 01:09:18 +03:00
parent c505426d1f
commit 0cd7888469
6 changed files with 189 additions and 187 deletions

View File

@ -1,5 +1,6 @@
class Platforms::MassBuildsController < Platforms::BaseController
include DatatableHelper
layout 'bootstrap'
before_filter :authenticate_user!
skip_before_filter :authenticate_user!, only: [:index, :get_list] if APP_CONFIG['anonymous_access']
@ -42,16 +43,9 @@ class Platforms::MassBuildsController < Platforms::BaseController
end
def index
respond_to do |format|
format.html {}
format.json {
@mass_builds = @platform.mass_builds
@total_mass_builds = @mass_builds.count
@mass_builds = @mass_builds.order("id #{sort_dir}")
.search(params[:sSearch])
.paginate(page: page, per_page: per_page)
}
end
@mass_build = MassBuild.new(params[:mass_build])
@mass_builds = @platform.mass_builds.search(@mass_build.description).
order(id: :desc).paginate(page: params[:page])
end
def cancel

View File

@ -1,18 +0,0 @@
= render 'platforms/base/submenu'
= render 'platforms/base/sidebar'
= link_to t('layout.mass_builds.new'), new_platform_mass_build_path(@platform), class: 'button' if can? :create, @platform.mass_builds.build
= raw mass_builds_datatable(@platform)
%table#datatable.tablesorter{cellspacing: 0, cellpadding: 0}
%thead
%tr
%th.lpadding16= t('activerecord.attributes.mass_build.id')
%th.lpadding16= t('activerecord.attributes.mass_build.name')
%th.th2= t('activerecord.attributes.mass_build.description')
%th.lpadding16= t('activerecord.attributes.mass_build.created_at')
%th.buttons &nbsp;
%tbody
%br

View File

@ -0,0 +1,36 @@
= render 'platforms/base/submenu'
/ = render 'platforms/base/sidebar'
.container
.row
- if can? :create, @platform.mass_builds.build
a.btn.btn-primary href=new_platform_mass_build_path(@platform)
= t('layout.mass_builds.new')
hr
= simple_form_for @mass_build, url: platform_mass_builds_path(@platform), method: :get do |f|
fieldset
= f.input :description
.button_block
button type="submit" class="btn btn-default" data-disable-with=t('layout.processing')
= t('layout.search.header')
table.table.table-striped
thead
tr
th= t('activerecord.attributes.mass_build.id')
th= t('activerecord.attributes.mass_build.name')
th= t('activerecord.attributes.mass_build.description')
th= t('activerecord.attributes.mass_build.created_at')
th
tbody
- @mass_builds.each do |mass_build|
tr
td= mass_build.id
td= link_to_mass_build(mass_build)
td= mass_build.description
td= mass_build.created_at.to_s
td= link_to t('layout.show'), platform_mass_build_path(@platform, mass_build.id)
= will_paginate @mass_builds

View File

@ -1,18 +0,0 @@
mass_builds = @mass_builds.map do |mass_build|
[
mass_build.id,
link_to_mass_build(mass_build),
mass_build.description,
mass_build.created_at.to_s,
link_to(t('layout.show'), platform_mass_build_path(@platform, mass_build.id))
]
end
json.sEcho params[:sEcho].to_i || -1
json.iTotalRecords @total_mass_builds
json.iTotalDisplayRecords @mass_builds.count
json.aaData mass_builds || []

View File

@ -1,141 +0,0 @@
-set_meta_tags title: title_object(@mass_build)
= render 'submenu'
= render 'sidebar'
%h3.fix
= t 'activerecord.models.mass_build'
%table.tablesorter.unbordered
%tr
%td
%b= t('activerecord.attributes.mass_build.name')
%td= link_to_mass_build(@mass_build)
%tr
%td
%b= t('activerecord.attributes.mass_build.id')
%td= @mass_build.id
%tr
%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)
- if @mass_build.external_nodes.present?
%tr
%td
%b= t('activerecord.attributes.build_list.external_nodes')
%td= I18n.t("layout.build_lists.external_nodes.#{@mass_build.external_nodes}")
%tr
%td
%b= t('activerecord.attributes.mass_build.auto_publish_status')
%td= t("layout.build_lists.auto_publish_status.#{@mass_build.auto_publish_status}")
%tr
%td
%b= t('activerecord.attributes.mass_build.auto_create_container')
%td= t("layout.#{@mass_build.auto_create_container?}_")
%tr
%td
%b= t('activerecord.attributes.mass_build.increase_release_tag')
%td= t("layout.#{@mass_build.increase_release_tag?}_")
%tr
%td
%b= t('activerecord.attributes.mass_build.include_testing_subrepository')
%td= t("layout.#{@mass_build.include_testing_subrepository?}_")
%tr
%td
%b= t('activerecord.attributes.mass_build.use_cached_chroot')
%td= t("layout.#{@mass_build.use_cached_chroot?}_")
%tr
%td
%b= t('activerecord.attributes.mass_build.use_extra_tests')
%td= t("layout.#{@mass_build.use_extra_tests?}_")
%tr
%td
%b= t('activerecord.attributes.mass_build.created_at')
%td= @mass_build.created_at
%tr
%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
%tr
%td
%b= t('layout.mass_builds.statuses')
%td
- MassBuild::COUNT_STATUSES.each do |status|
- path = build_lists_path+"#?#{{filter: {mass_build_id: @mass_build.id, ownership: 'everything'}.merge(status != :build_lists ? {status: BuildList.status_by_human(status)} : {})}.to_param}"
%tr
%td
= link_to t("layout.build_lists.statuses.#{status}") + ": ", path
%td= @mass_build.send "#{status}_count"
%tr
%td
%td
%tr
%td
%b= t('layout.mass_builds.lists')
%td
- if @mass_build.projects_list.present?
= link_to_list @platform, @mass_build, 'projects_list'
.both
= link_to_list @platform, @mass_build, 'failed_builds_list'
.both
= link_to_list @platform, @mass_build, 'tests_failed_builds_list'
.both
= link_to_list @platform, @mass_build, 'success_builds_list'
.buttons_block
- if can?(:publish, @mass_build)
- unless @mass_build.auto_publish_status == BuildList::AUTO_PUBLISH_STATUS_DEFAULT
= link_to t('layout.mass_builds.publish_success'),
publish_platform_mass_build_path(@platform, @mass_build.id),
method: :post, data: { confirm: t("layout.confirm") }, class: 'button'
= link_to t('layout.mass_builds.publish_test_failed'),
publish_platform_mass_build_path(@platform, @mass_build.id, status: 'test_failed'),
method: :post, data: { confirm: t("layout.confirm") }, class: 'button'
- if can?(:cancel, @mass_build)
= link_to t('layout.cancel'),
cancel_platform_mass_build_path(@platform, @mass_build.id),
method: :post, class: 'button',
data: { confirm: t('layout.mass_builds.cancel_confirm') }
- if can? :create, @mass_build
= link_to t('layout.mass_builds.recreate'), new_platform_mass_build_path(@platform, mass_build_id: @mass_build.id), class: 'button'

View File

@ -0,0 +1,149 @@
-set_meta_tags title: title_object(@mass_build)
= render 'submenu'
.container
.row
h3
= t('activerecord.models.mass_build')
table.table.table-striped
tr
td
b= t('activerecord.attributes.mass_build.name')
td= link_to_mass_build(@mass_build)
tr
td
b= t('activerecord.attributes.mass_build.id')
td= @mass_build.id
tr
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)
- if @mass_build.external_nodes.present?
tr
td
b= t('activerecord.attributes.build_list.external_nodes')
td= I18n.t("layout.build_lists.external_nodes.#{@mass_build.external_nodes}")
tr
td
b= t('activerecord.attributes.mass_build.auto_publish_status')
td= t("layout.build_lists.auto_publish_status.#{@mass_build.auto_publish_status}")
tr
td
b= t('activerecord.attributes.mass_build.auto_create_container')
td= t("layout.#{@mass_build.auto_create_container?}_")
tr
td
b= t('activerecord.attributes.mass_build.increase_release_tag')
td= t("layout.#{@mass_build.increase_release_tag?}_")
tr
td
b= t('activerecord.attributes.mass_build.include_testing_subrepository')
td= t("layout.#{@mass_build.include_testing_subrepository?}_")
tr
td
b= t('activerecord.attributes.mass_build.use_cached_chroot')
td= t("layout.#{@mass_build.use_cached_chroot?}_")
tr
td
b= t('activerecord.attributes.mass_build.use_extra_tests')
td= t("layout.#{@mass_build.use_extra_tests?}_")
tr
td
b= t('activerecord.attributes.mass_build.created_at')
td= @mass_build.created_at
tr
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]
- 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)
- 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
- else
= t('layout.false_')
tr
td
td
tr
td
b= t('layout.mass_builds.statuses')
td
- MassBuild::COUNT_STATUSES.each do |status|
- path = build_lists_path+"#?#{{filter: {mass_build_id: @mass_build.id, ownership: 'everything'}.merge(status != :build_lists ? {status: BuildList.status_by_human(status)} : {})}.to_param}"
tr
td
= link_to t("layout.build_lists.statuses.#{status}") + ": ", path
td= @mass_build.send "#{status}_count"
tr
td
td
tr
td
b= t('layout.mass_builds.lists')
td
- if @mass_build.projects_list.present?
= link_to_list @platform, @mass_build, 'projects_list'
| &nbsp;
= link_to_list @platform, @mass_build, 'failed_builds_list'
| &nbsp;
= link_to_list @platform, @mass_build, 'tests_failed_builds_list'
| &nbsp;
= link_to_list @platform, @mass_build, 'success_builds_list'
.buttons_block
- if can?(:publish, @mass_build)
- unless @mass_build.auto_publish_status == BuildList::AUTO_PUBLISH_STATUS_DEFAULT
= link_to t('layout.mass_builds.publish_success'),
publish_platform_mass_build_path(@platform, @mass_build.id),
method: :post,
data: { confirm: t("layout.confirm") },
class: 'btn btn-success'
| &nbsp;
= link_to t('layout.mass_builds.publish_test_failed'),
publish_platform_mass_build_path(@platform, @mass_build.id, status: 'test_failed'),
method: :post,
data: { confirm: t("layout.confirm") },
class: 'btn btn-warning'
| &nbsp;
- if can?(:cancel, @mass_build)
= link_to t('layout.cancel'),
cancel_platform_mass_build_path(@platform, @mass_build.id),
method: :post,
class: 'btn btn-danger',
data: { confirm: t('layout.mass_builds.cancel_confirm') }
| &nbsp;
- if can? :create, @mass_build
= link_to t('layout.mass_builds.recreate'),
new_platform_mass_build_path(@platform, mass_build_id: @mass_build.id),
class: 'btn btn-primary'