#369: updated UI of product_build_lists (#index)
This commit is contained in:
parent
e7b2da6220
commit
db4948957c
|
@ -1,5 +1,6 @@
|
|||
class Platforms::ProductBuildListsController < Platforms::BaseController
|
||||
include FileStoreHelper
|
||||
layout 'bootstrap'
|
||||
|
||||
before_filter :authenticate_user!
|
||||
skip_before_filter :authenticate_user!, only: [:index, :show, :log] if APP_CONFIG['anonymous_access']
|
||||
|
@ -73,11 +74,14 @@ class Platforms::ProductBuildListsController < Platforms::BaseController
|
|||
end
|
||||
|
||||
def index
|
||||
if params[:product_id].present?
|
||||
@product_build_lists = @product_build_lists.where(id: params[:product_id])
|
||||
@product_build_list = ProductBuildList.new(params[:product_build_list])
|
||||
@product_build_list.status = nil if params[:product_build_list].blank?
|
||||
if @product_build_list.product_id.present?
|
||||
@product_build_lists = @product_build_lists.where(id: @product_build_list.product_id)
|
||||
else
|
||||
@product_build_lists = @product_build_lists.scoped_to_product_name(params[:product_name]) if params[:product_name].present?
|
||||
@product_build_lists = @product_build_lists.for_status(params[:status]) if params[:status].present?
|
||||
@product_build_lists = @product_build_lists.
|
||||
scoped_to_product_name(@product_build_list.product_name).
|
||||
for_status(@product_build_list.status)
|
||||
end
|
||||
@product_build_lists = @product_build_lists.recent.paginate page: params[:page]
|
||||
@build_server_status = AbfWorkerStatusPresenter.new.products_status
|
||||
|
|
|
@ -53,7 +53,7 @@ class ProductBuildList < ActiveRecord::Base
|
|||
validates :status, inclusion: { in: STATUSES }
|
||||
validates :main_script, :params, length: { maximum: 255 }
|
||||
|
||||
attr_accessor :base_url
|
||||
attr_accessor :base_url, :product_name
|
||||
attr_accessible :status,
|
||||
:base_url,
|
||||
:branch,
|
||||
|
@ -63,16 +63,20 @@ class ProductBuildList < ActiveRecord::Base
|
|||
:project_version,
|
||||
:commit_hash,
|
||||
:product_id,
|
||||
:not_delete
|
||||
:not_delete,
|
||||
:product_name
|
||||
|
||||
attr_readonly :product_id
|
||||
serialize :results, Array
|
||||
|
||||
|
||||
scope :default_order, -> { order(updated_at: :desc) }
|
||||
scope :for_status, ->(status) { where(status: status) }
|
||||
scope :for_user, ->(user) { where(user_id: user.id) }
|
||||
scope :scoped_to_product_name, ->(product_name) { joins(:product).where('products.name LIKE ?', "%#{product_name}%") }
|
||||
scope :recent, -> { order(updated_at: :desc) }
|
||||
scope :default_order, -> { order(updated_at: :desc) }
|
||||
scope :for_status, -> (status) { where(status: status) if status.present? }
|
||||
scope :for_user, -> (user) { where(user_id: user.id) }
|
||||
scope :scoped_to_product_name, -> (product_name) {
|
||||
joins(:product).where('products.name LIKE ?', "%#{product_name}%") if product_name.present?
|
||||
}
|
||||
scope :recent, -> { order(updated_at: :desc) }
|
||||
scope :outdated, -> {
|
||||
where(not_delete: false).
|
||||
where("(#{table_name}.created_at < ? AND #{table_name}.autostarted is TRUE) OR #{table_name}.created_at < ?",
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
- unless @platform.personal?
|
||||
= f.input :released, as: :boolean
|
||||
/ TODO: autocomplete
|
||||
= f.input :admin_id,
|
||||
url: autocomplete_user_uname_autocompletes_path,
|
||||
as: :autocomplete,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
-set_meta_tags title: [title_object(@platform), t('layout.platforms.members')]
|
||||
= render 'submenu'
|
||||
|
||||
.container
|
||||
.container.col-md-offset-2.col-md-8
|
||||
.row
|
||||
= render "shared/members_table",
|
||||
remove_members_path: remove_members_platform_path(@platform),
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
- content_for :sidebar do
|
||||
= render 'server_status'
|
||||
|
||||
= form_tag product_build_lists_path, method: :get, html: {class: :form} do
|
||||
.block
|
||||
%h3.small= t("activerecord.attributes.product_build_list.status")
|
||||
.lineForm.aside= select_tag :status, options_for_select(ProductBuildList::STATUSES.map{|s| [ProductBuildList.human_status(s), s]}, params[:status]), {include_blank: true, class: 'sel80 aside'}
|
||||
%h3.small= t("layout.product_build_lists.product_name_search")
|
||||
= text_field_tag :product_name, params[:product_name]
|
||||
%h3.small= t("layout.product_build_lists.id_search")
|
||||
= text_field_tag :product_id, params[:product_id]
|
||||
%br
|
||||
%br
|
||||
= submit_tag t('layout.search.header'), data: {'disable-with' => t('layout.processing')}
|
|
@ -0,0 +1,20 @@
|
|||
- html_options = { class: 'form-control' }
|
||||
accordion close-others='false' ng-cloak=true
|
||||
accordion-group is-open='$parent.isOpenServerStatus'
|
||||
accordion-heading
|
||||
= t 'layout.build_lists.build_server_status.header'
|
||||
span.pull-right.fa ng-class="{'fa-chevron-down': isOpenServerStatus, 'fa-chevron-up': !isOpenServerStatus}"
|
||||
= render 'server_status'
|
||||
|
||||
.container
|
||||
.row.well
|
||||
= simple_form_for @product_build_list, url: product_build_lists_path, method: :get do |f|
|
||||
.row
|
||||
.col-md-2
|
||||
= f.input :status, collection: ProductBuildList::STATUSES.map{|s| [ProductBuildList.human_status(s), s]}, label: false, prompt: t('simple_form.placeholders.product_build_list.status')
|
||||
.col-md-4
|
||||
= f.input :product_name, label: false
|
||||
.col-md-4
|
||||
= f.input :product_id, label: false
|
||||
.col-md-2
|
||||
= f.button :submit, t('layout.search.header')
|
|
@ -1,19 +0,0 @@
|
|||
.bordered.nopadding
|
||||
%h3.medium= t('layout.build_lists.build_server_status.header')
|
||||
|
||||
.table
|
||||
.lefter= t("layout.build_lists.build_server_status.iso_workers")
|
||||
.both
|
||||
.table
|
||||
.lefter= t("layout.build_lists.build_server_status.amount")
|
||||
.righter= @build_server_status[:iso][:workers]
|
||||
.both
|
||||
- [:tasks, :build_tasks].each do |metric|
|
||||
.table
|
||||
.lefter= t("layout.build_lists.build_server_status.#{metric}")
|
||||
.righter= @build_server_status[:iso][metric]
|
||||
.both
|
||||
%br
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
.row
|
||||
.col-md-6.col-sm-6
|
||||
h5= t 'layout.build_lists.build_server_status.iso_workers'
|
||||
ul.list-unstyled
|
||||
li
|
||||
= t 'layout.build_lists.build_server_status.amount'
|
||||
ul
|
||||
li
|
||||
= t 'layout.build_lists.build_server_status.abf'
|
||||
span.bg-primary.badge.pull-right
|
||||
= @build_server_status[:iso][:workers]
|
||||
.col-md-6.col-sm-6
|
||||
h5= t 'layout.build_lists.build_server_status.tasks'
|
||||
ul.list-unstyled
|
||||
li
|
||||
ul
|
||||
- %i(tasks build_tasks).each do |metric|
|
||||
li
|
||||
= t "layout.build_lists.build_server_status.#{metric}"
|
||||
span.bg-primary.badge.pull-right
|
||||
= @build_server_status[:iso][metric]
|
|
@ -1,17 +0,0 @@
|
|||
-set_meta_tags title: t('.title')
|
||||
%table.tablesorter{cellpadding: "0", cellspacing: "0"}
|
||||
%thead
|
||||
%tr
|
||||
%th.lpadding16= t("activerecord.attributes.product_build_list.id")
|
||||
%th.lpadding16= t("activerecord.attributes.product_build_list.status")
|
||||
%th.lpadding16= t("activerecord.attributes.product_build_list.container_path")
|
||||
%th.lpadding16= t("activerecord.attributes.product_build_list.product")
|
||||
%th= t("layout.product_build_lists.action")
|
||||
%th.lpadding16= t("activerecord.attributes.product_build_list.notified_at")
|
||||
%tbody= render partial: 'platforms/product_build_lists/product_build_list', collection: @product_build_lists
|
||||
.both
|
||||
|
||||
= will_paginate @product_build_lists
|
||||
|
||||
= render 'filter'
|
||||
= render 'projects/build_lists/submenu'
|
|
@ -0,0 +1,24 @@
|
|||
- set_meta_tags title: t('.title')
|
||||
|
||||
= render 'projects/build_lists/submenu'
|
||||
|
||||
.container
|
||||
|
||||
.row.offset20
|
||||
= render 'filter'
|
||||
.row
|
||||
table.table.table-striped
|
||||
thead
|
||||
tr
|
||||
th= t("activerecord.attributes.product_build_list.id")
|
||||
th= t("activerecord.attributes.product_build_list.status")
|
||||
th= t("activerecord.attributes.product_build_list.container_path")
|
||||
th= t("activerecord.attributes.product_build_list.product")
|
||||
th= t("layout.product_build_lists.action")
|
||||
th= t("activerecord.attributes.product_build_list.notified_at")
|
||||
tbody
|
||||
= render partial: 'platforms/product_build_lists/product_build_list', collection: @product_build_lists
|
||||
.both
|
||||
|
||||
= will_paginate @product_build_lists
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
= f.input :name
|
||||
= f.input :description, as: :text
|
||||
|
||||
/ TODO: fix autocomplete + project_version
|
||||
/ TODO: autocomplete + project_version
|
||||
= f.input :project,
|
||||
url: autocomplete_project_platform_products_path(@platform),
|
||||
as: :autocomplete,
|
||||
|
|
|
@ -15,18 +15,15 @@
|
|||
a.btn.btn-primary href=edit_platform_product_path(@platform, @product)
|
||||
= t('layout.edit')
|
||||
|
|
||||
/ = link_to image_tag("code.png", alt: t("layout.edit")) + " " + t("layout.edit"), edit_platform_product_path(@platform, @product), class: "button"
|
||||
- if can? :destroy, @product
|
||||
a.btn.btn-danger[ href = platform_product_path(@platform, @product)
|
||||
method = 'delete'
|
||||
data-confirm = t('layout.products.confirm_delete') ]
|
||||
= t('layout.delete')
|
||||
|
|
||||
/ = link_to image_tag("x.png", alt: t("layout.delete")) + " " + t("layout.delete"), platform_product_path(@platform, @product), method: "delete", class: "button", data: { confirm: t("layout.products.confirm_delete") }
|
||||
- if can?(:create, @product.product_build_lists.build)
|
||||
a.btn.btn-primary href=new_platform_product_product_build_list_path(@platform, @product)
|
||||
= t('layout.products.build')
|
||||
/ = link_to t("layout.products.build"), new_platform_product_product_build_list_path(@platform, @product), class: "button"
|
||||
|
||||
hr
|
||||
|
||||
|
|
|
@ -1,39 +1,41 @@
|
|||
|
||||
|
||||
|
||||
= form_tag remove_members_path, id: 'members_form', method: :post do
|
||||
%table.tablesorter{cellpadding: "0", cellspacing: "0"}
|
||||
%thead
|
||||
%tr
|
||||
table.table.table-striped
|
||||
thead
|
||||
tr
|
||||
- if can? :remove_members, editable_object
|
||||
%th
|
||||
\
|
||||
%th
|
||||
th
|
||||
th
|
||||
= t("layout.collaborators.members")
|
||||
- if can? :remove_member, editable_object
|
||||
%th.buttons
|
||||
th.buttons
|
||||
= t("layout.remove")
|
||||
%tbody
|
||||
tbody
|
||||
- members.each_with_index do |user, num|
|
||||
%tr{id: "admin-table-members-row#{num}", class: cycle(:odd, :even)}
|
||||
tr id="admin-table-members-row#{num}"
|
||||
- if can? :remove_members, editable_object
|
||||
%td
|
||||
%span.niceCheck-main{id: "niceCheckbox#{num}", style: "background-position: 0px 0px; "}
|
||||
= check_box_tag "user_remove[#{user.id}][]"
|
||||
%td
|
||||
.img
|
||||
td
|
||||
= check_box_tag "user_remove[#{user.id}][]"
|
||||
td
|
||||
span
|
||||
= image_tag avatar_url(user)
|
||||
.forimg= link_to user.fullname, user_path(user)
|
||||
|
|
||||
= link_to user.fullname, user_path(user)
|
||||
- if can? :remove_member, editable_object
|
||||
%td.buttons
|
||||
td
|
||||
= link_to "#{remove_member_path}?member_id=#{user.id}", method: :delete, data: { confirm: t("layout.confirm") } do
|
||||
%span.delete
|
||||
span.glyphicon.glyphicon-remove
|
||||
|
|
||||
- if can? :remove_members, editable_object
|
||||
= submit_tag t("layout.delete"), class: 'button', data: {'disable-with' => t('layout.processing')}
|
||||
.both
|
||||
= submit_tag t('layout.delete'), class: 'btn btn-danger', data: {'disable-with' => t('layout.processing')}
|
||||
|
||||
- if can? :add_member, editable_object
|
||||
.hr.top
|
||||
hr
|
||||
/ TODO: autocomplete
|
||||
= form_tag add_member_path do
|
||||
.admin-search
|
||||
= autocomplete_field_tag 'member_id', params[:member_id], autocomplete_user_uname_autocompletes_path, id_element: '#member_id_field'
|
||||
= hidden_field_tag 'member_id', nil, id: 'member_id_field'
|
||||
= submit_tag t('layout.add'), class: 'button', data: {'disable-with' => t('layout.processing')}
|
||||
.both
|
|
@ -60,3 +60,12 @@ en:
|
|||
delete_error: Unable to delete product build list
|
||||
updated: Product build list updated
|
||||
update_error: Unable to update product build list
|
||||
|
||||
simple_form:
|
||||
labels:
|
||||
product_build_list:
|
||||
placeholders:
|
||||
product_build_list:
|
||||
status: Select a status
|
||||
product_name: Enter the name of product here.
|
||||
product_id: Enter the ID of product build list here.
|
||||
|
|
|
@ -60,3 +60,12 @@ ru:
|
|||
delete_error: Не удалось удалить cборочный лист продукта
|
||||
updated: Cборочный лист продукта успешно обновлен
|
||||
update_error: Не удалось обновить cборочный лист продукта
|
||||
|
||||
simple_form:
|
||||
labels:
|
||||
product_build_list:
|
||||
placeholders:
|
||||
product_build_list:
|
||||
status: Выберите статус
|
||||
product_name: Введите название продукта здесь.
|
||||
product_id: Введите Id сборочного листа продукта здесь.
|
||||
|
|
Loading…
Reference in New Issue