#267: updated ProductBuildList#show UI
This commit is contained in:
parent
b9778300d5
commit
afb9ad581d
|
@ -0,0 +1,28 @@
|
|||
RosaABF.controller('ProductBuildListController', ['$scope', '$http', '$timeout', function($scope, $http, $timeout) {
|
||||
|
||||
$scope.id = $('#product_build_list_id').val();
|
||||
$scope.pbl = null;
|
||||
$scope.subject = {}; // See: shared/build_results
|
||||
|
||||
$scope.getProductBuildList = function() {
|
||||
$http.get(Routes.product_build_list_path($scope.id, {format: 'json'})).success(function(results) {
|
||||
$scope.pbl = $scope.subject = results.product_build_list;
|
||||
});
|
||||
}
|
||||
|
||||
$scope.cancelRefresh = null;
|
||||
$scope.refresh = function() {
|
||||
if (!$scope.pbl ||
|
||||
!(
|
||||
$scope.pbl.status == <%=ProductBuildList::BUILD_COMPLETED%> ||
|
||||
$scope.pbl.status == <%=ProductBuildList::BUILD_FAILED%> ||
|
||||
$scope.pbl.status == <%=ProductBuildList::BUILD_CANCELED%>
|
||||
)
|
||||
) {
|
||||
$scope.getProductBuildList();
|
||||
}
|
||||
$scope.cancelRefresh = $timeout($scope.refresh, 10000);
|
||||
}
|
||||
$scope.refresh();
|
||||
|
||||
}]);
|
|
@ -1,21 +0,0 @@
|
|||
%h3= subject.class.human_attribute_name(subject.is_a?(BuildList) ? 'logs' : 'results')
|
||||
- unless subject.results.present?
|
||||
%h4.nomargin= t('layout.no_')
|
||||
- else
|
||||
%table.tablesorter.width565{:cellpadding => "0", :cellspacing => "0"}
|
||||
%thead
|
||||
%tr
|
||||
%th= t("activerecord.attributes.product_build_list/results.file_name")
|
||||
%th= t("activerecord.attributes.product_build_list/results.sha1")
|
||||
%th= t("activerecord.attributes.product_build_list/results.size")
|
||||
%tbody
|
||||
- subject.results.each do |item|
|
||||
%tr
|
||||
- sha1 = item['sha1']
|
||||
- filename = item['file_name']
|
||||
- url = "#{APP_CONFIG['file_store_url']}/api/v1/file_stores/#{sha1}"
|
||||
- url << '.log?show=true' if filename =~ /.*\.(log|txt)$/
|
||||
%td= link_to filename, url
|
||||
%td= sha1
|
||||
%td= item['size']
|
||||
.both
|
|
@ -7,44 +7,49 @@
|
|||
|
||||
%h3= t("layout.product_build_lists.main_data")
|
||||
.both
|
||||
%div{'ng-controller' => 'ProductBuildListController'}
|
||||
= render 'show_field', :key => :id, :value => pbl.id
|
||||
= hidden_field_tag :product_build_list_id, pbl.id
|
||||
= render 'show_field', :key => :status, :value => '{{pbl.human_status}}'
|
||||
- if pbl.user
|
||||
= render 'show_field', :key => :user, :value => link_to(pbl.user.try(:fullname), pbl.user)
|
||||
|
||||
= render 'show_field', :key => :id, :value => pbl.id
|
||||
= render 'show_field', :key => :status, :value => pbl.human_status
|
||||
- if pbl.user
|
||||
= render 'show_field', :key => :user, :value => link_to(pbl.user.try(:fullname), pbl.user)
|
||||
= render 'show_field', :key => :product, :value => link_to(pbl.product.name, platform_product_path(platform, product))
|
||||
|
||||
= render 'show_field', :key => :product, :value => link_to(pbl.product.name, platform_product_path(platform, product))
|
||||
= render 'show_field', :key => :project, :value => link_to(pbl.project.name_with_owner, project_path(pbl.project))
|
||||
|
||||
= render 'show_field', :key => :project, :value => link_to(pbl.project.name_with_owner, project_path(pbl.project))
|
||||
= render 'show_field', :key => :project_version, :value => product_build_list_version_link(pbl, true)
|
||||
|
||||
= render 'show_field', :key => :project_version, :value => product_build_list_version_link(pbl, true)
|
||||
- [:main_script, :params].each do |el|
|
||||
= render 'show_field', :key => el, :value => pbl.send(el)
|
||||
|
||||
- [:main_script, :params].each do |el|
|
||||
= render 'show_field', :key => el, :value => pbl.send(el)
|
||||
= render 'show_field', :key => :time_living, :value => (pbl.time_living / 60)
|
||||
|
||||
= render 'show_field', :key => :time_living, :value => (pbl.time_living / 60)
|
||||
= render 'show_field', :key => :autostarted, :value => t("layout.#{pbl.autostarted}_")
|
||||
|
||||
= render 'show_field', :key => :autostarted, :value => t("layout.#{pbl.autostarted}_")
|
||||
= render 'show_field', :key => :notified_at, :value => '{{pbl.notified_at}}'
|
||||
|
||||
= render 'show_field', :key => :notified_at, :value => l(pbl.updated_at, :format => :long)
|
||||
|
||||
- if pbl.can_cancel? && can?(:cancel, pbl)
|
||||
= link_to t("layout.build_lists.cancel"), cancel_platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl),
|
||||
:method => :put, :confirm => t("layout.confirm"), :class => 'button'
|
||||
.both
|
||||
%br
|
||||
|
||||
- if pbl.build_completed? && can?(:update, pbl)
|
||||
= form_for pbl, :url => platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl) do |f|
|
||||
.leftlist= f.label :not_delete
|
||||
.rightlist
|
||||
= f.select :not_delete, [false, true].collect{|status| [t("layout.#{status}_"), status]}, {:selected => pbl.not_delete}
|
||||
.both
|
||||
%br
|
||||
= submit_tag t('layout.update'), :data => {'disable-with' => t('layout.processing')}
|
||||
- if can?(:cancel, pbl)
|
||||
= link_to t("layout.build_lists.cancel"),
|
||||
cancel_platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl),
|
||||
:method => :put, :confirm => t("layout.confirm"), :class => 'button',
|
||||
'ng-show' => 'pbl.can_cancel'
|
||||
.both
|
||||
- unless pbl.not_delete
|
||||
.flash_notify
|
||||
%br
|
||||
|
||||
- if can?(:update, pbl)
|
||||
= form_for pbl,
|
||||
:url => platform_product_product_build_list_path(pbl.product.platform,pbl.product, pbl),
|
||||
:html => {'ng-show' => "pbl.status == #{ProductBuildList::BUILD_COMPLETED}"} do |f|
|
||||
|
||||
.leftlist= f.label :not_delete
|
||||
.rightlist
|
||||
= f.select :not_delete, [false, true].collect{|status| [t("layout.#{status}_"), status]}, {:selected => pbl.not_delete}
|
||||
.both
|
||||
%br
|
||||
= submit_tag t('layout.update'), :data => {'disable-with' => t('layout.processing')}
|
||||
.both
|
||||
.flash_notify{'ng-hide' => 'pbl.not_delete'}
|
||||
.alert.alert-error
|
||||
- days = pbl.autostarted? ? ProductBuildList::LIVE_TIME : ProductBuildList::MAX_LIVE_TIME
|
||||
- days = (pbl.created_at.to_date - days.ago.to_date).to_i
|
||||
|
@ -54,10 +59,10 @@
|
|||
= t('layout.product_build_lists.will_be_removed_today')
|
||||
.both
|
||||
|
||||
- if pbl.build_started? || pbl.build_canceling?
|
||||
= render 'shared/log', { :build_started => true, :get_log_path => log_platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl) }
|
||||
%div{'ng-show' => "pbl.status == #{ProductBuildList::BUILD_STARTED}"}
|
||||
= render 'shared/log', { :build_started => true, :get_log_path => log_platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl) }
|
||||
|
||||
= render 'results', :subject => pbl
|
||||
= render 'shared/build_results', :subject => pbl
|
||||
|
||||
:javascript
|
||||
$(function(){
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
json.product_build_list do
|
||||
json.(@product_build_list, :id, :status, :human_status, :not_delete)
|
||||
json.notified_at l(@product_build_list.updated_at, :format => :long)
|
||||
|
||||
json.can_cancel @product_build_list.can_cancel?
|
||||
|
||||
json.results @product_build_list.results do |result|
|
||||
json.file_name result['file_name']
|
||||
json.sha1 result['sha1']
|
||||
json.size result['size']
|
||||
json.url "#{APP_CONFIG['file_store_url']}/api/v1/file_stores/#{result['sha1']}"
|
||||
end if @product_build_list.results.present?
|
||||
|
||||
end
|
|
@ -1,5 +1,5 @@
|
|||
json.build_list do
|
||||
json.(@build_list, :id, :container_status, :status, :duration)
|
||||
json.(@build_list, :id, :container_status, :status)
|
||||
json.(@build_list, :update_type)
|
||||
json.updated_at @build_list.updated_at.strftime('%Y-%m-%d %H:%M:%S UTC')
|
||||
|
||||
|
|
Loading…
Reference in New Issue