#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,9 +7,10 @@
|
||||||
|
|
||||||
%h3= t("layout.product_build_lists.main_data")
|
%h3= t("layout.product_build_lists.main_data")
|
||||||
.both
|
.both
|
||||||
|
%div{'ng-controller' => 'ProductBuildListController'}
|
||||||
= render 'show_field', :key => :id, :value => pbl.id
|
= render 'show_field', :key => :id, :value => pbl.id
|
||||||
= render 'show_field', :key => :status, :value => pbl.human_status
|
= hidden_field_tag :product_build_list_id, pbl.id
|
||||||
|
= render 'show_field', :key => :status, :value => '{{pbl.human_status}}'
|
||||||
- if pbl.user
|
- if pbl.user
|
||||||
= render 'show_field', :key => :user, :value => link_to(pbl.user.try(:fullname), pbl.user)
|
= render 'show_field', :key => :user, :value => link_to(pbl.user.try(:fullname), pbl.user)
|
||||||
|
|
||||||
|
@ -26,16 +27,21 @@
|
||||||
|
|
||||||
= 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 => l(pbl.updated_at, :format => :long)
|
= render 'show_field', :key => :notified_at, :value => '{{pbl.notified_at}}'
|
||||||
|
|
||||||
- if pbl.can_cancel? && can?(:cancel, pbl)
|
- if can?(:cancel, pbl)
|
||||||
= link_to t("layout.build_lists.cancel"), cancel_platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl),
|
= link_to t("layout.build_lists.cancel"),
|
||||||
:method => :put, :confirm => t("layout.confirm"), :class => 'button'
|
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
|
.both
|
||||||
%br
|
%br
|
||||||
|
|
||||||
- if pbl.build_completed? && can?(:update, pbl)
|
- if can?(:update, pbl)
|
||||||
= form_for pbl, :url => platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl) do |f|
|
= 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
|
.leftlist= f.label :not_delete
|
||||||
.rightlist
|
.rightlist
|
||||||
= f.select :not_delete, [false, true].collect{|status| [t("layout.#{status}_"), status]}, {:selected => pbl.not_delete}
|
= f.select :not_delete, [false, true].collect{|status| [t("layout.#{status}_"), status]}, {:selected => pbl.not_delete}
|
||||||
|
@ -43,8 +49,7 @@
|
||||||
%br
|
%br
|
||||||
= submit_tag t('layout.update'), :data => {'disable-with' => t('layout.processing')}
|
= submit_tag t('layout.update'), :data => {'disable-with' => t('layout.processing')}
|
||||||
.both
|
.both
|
||||||
- unless pbl.not_delete
|
.flash_notify{'ng-hide' => 'pbl.not_delete'}
|
||||||
.flash_notify
|
|
||||||
.alert.alert-error
|
.alert.alert-error
|
||||||
- days = pbl.autostarted? ? ProductBuildList::LIVE_TIME : ProductBuildList::MAX_LIVE_TIME
|
- days = pbl.autostarted? ? ProductBuildList::LIVE_TIME : ProductBuildList::MAX_LIVE_TIME
|
||||||
- days = (pbl.created_at.to_date - days.ago.to_date).to_i
|
- 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')
|
= t('layout.product_build_lists.will_be_removed_today')
|
||||||
.both
|
.both
|
||||||
|
|
||||||
- if pbl.build_started? || pbl.build_canceling?
|
%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 '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
|
:javascript
|
||||||
$(function(){
|
$(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 do
|
||||||
json.(@build_list, :id, :container_status, :status, :duration)
|
json.(@build_list, :id, :container_status, :status)
|
||||||
json.(@build_list, :update_type)
|
json.(@build_list, :update_type)
|
||||||
json.updated_at @build_list.updated_at.strftime('%Y-%m-%d %H:%M:%S UTC')
|
json.updated_at @build_list.updated_at.strftime('%Y-%m-%d %H:%M:%S UTC')
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue