From fdd79aec0789c9df41a225afdb6aa6fe35a358a9 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Fri, 31 Oct 2014 02:46:16 +0300 Subject: [PATCH] #369: updated UI for ProductBuildListsController#show --- .../build_log_controller.js.coffee | 23 ++ .../product_build_list_controller.js.erb | 40 +++ .../stylesheets/new_application.css.scss | 8 + .../stylesheets/views/shared/log.css.sass | 3 + .../product_build_lists_controller.rb | 4 +- app/helpers/product_build_lists_helper.rb | 7 + .../product_build_lists/show.html.haml | 71 ---- .../product_build_lists/show.html.slim | 132 ++++++++ app/views/projects/build_lists/show.html.slim | 313 ++++++++++++++++++ app/views/shared/_build_results.html.haml | 16 - app/views/shared/_build_results.html.slim | 22 ++ app/views/shared/_log.html.haml | 43 --- app/views/shared/_log.html.slim | 9 + 13 files changed, 559 insertions(+), 132 deletions(-) create mode 100644 app/assets/javascripts/angular-new/controllers/build_log_controller.js.coffee create mode 100644 app/assets/javascripts/angular-new/controllers/product_build_list_controller.js.erb create mode 100644 app/assets/stylesheets/views/shared/log.css.sass create mode 100644 app/helpers/product_build_lists_helper.rb delete mode 100644 app/views/platforms/product_build_lists/show.html.haml create mode 100644 app/views/platforms/product_build_lists/show.html.slim create mode 100644 app/views/projects/build_lists/show.html.slim delete mode 100644 app/views/shared/_build_results.html.haml create mode 100644 app/views/shared/_build_results.html.slim delete mode 100644 app/views/shared/_log.html.haml create mode 100644 app/views/shared/_log.html.slim diff --git a/app/assets/javascripts/angular-new/controllers/build_log_controller.js.coffee b/app/assets/javascripts/angular-new/controllers/build_log_controller.js.coffee new file mode 100644 index 000000000..5fd7ca3f7 --- /dev/null +++ b/app/assets/javascripts/angular-new/controllers/build_log_controller.js.coffee @@ -0,0 +1,23 @@ +RosaABF.controller 'BuildLogController', ['$scope', '$http', '$timeout', ($scope, $http, $timeout) -> + + $scope.path = null + $scope.log = null + $scope.build_started = true + + $scope.init = (path) -> + $scope.path = path + $scope.getLog() + + $scope.getLog = -> + return unless $scope.build_started + + if $('.build-log').is(':visible') + $http.get($scope.path).success (res) -> + $scope.log = res.log + $scope.build_started = res.building + .error -> + $scope.log = null + + $timeout($scope.getLog, 10000); + +] \ No newline at end of file diff --git a/app/assets/javascripts/angular-new/controllers/product_build_list_controller.js.erb b/app/assets/javascripts/angular-new/controllers/product_build_list_controller.js.erb new file mode 100644 index 000000000..07d6eb181 --- /dev/null +++ b/app/assets/javascripts/angular-new/controllers/product_build_list_controller.js.erb @@ -0,0 +1,40 @@ +RosaABF.controller('ProductBuildListController', ['$scope', '$http', '$timeout', 'SoundNotificationsHelper', function($scope, $http, $timeout, SoundNotificationsHelper) { + + $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) { + var product_build_list = results.product_build_list; + if ($scope.pbl && $scope.pbl.status != product_build_list.status) + SoundNotificationsHelper.buildStatusChanged(); + $scope.pbl = $scope.subject = 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(); + + $scope.updateStatus = function() { + $http.put( + Routes.product_build_list_path($scope.id), + {product_build_list: {not_delete: $scope.pbl.not_delete}, format: 'json'} + ).success(function(results) { + $scope.pbl = $scope.subject = results.product_build_list; + }); + } + +}]); \ No newline at end of file diff --git a/app/assets/stylesheets/new_application.css.scss b/app/assets/stylesheets/new_application.css.scss index d3f50f68e..02b71a579 100644 --- a/app/assets/stylesheets/new_application.css.scss +++ b/app/assets/stylesheets/new_application.css.scss @@ -1,3 +1,11 @@ +/* + * This is a manifest file that'll automatically include all the stylesheets available in this directory + * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at + * the top of the compiled file, but it's generally better to create a new file per style scope. + *= require_self + *= require_tree ./views +*/ + //$body-bg: #1F60A1; $navbar-height: 37px; $navbar-border-radius: 0px; diff --git a/app/assets/stylesheets/views/shared/log.css.sass b/app/assets/stylesheets/views/shared/log.css.sass new file mode 100644 index 000000000..b45334228 --- /dev/null +++ b/app/assets/stylesheets/views/shared/log.css.sass @@ -0,0 +1,3 @@ +accordion .build-log + height: 300px + overflow-y: auto \ No newline at end of file diff --git a/app/controllers/platforms/product_build_lists_controller.rb b/app/controllers/platforms/product_build_lists_controller.rb index 110a98e35..a3ddea912 100644 --- a/app/controllers/platforms/product_build_lists_controller.rb +++ b/app/controllers/platforms/product_build_lists_controller.rb @@ -41,9 +41,9 @@ class Platforms::ProductBuildListsController < Platforms::BaseController def log worker_log = @product_build_list.abf_worker_log - + worker_log = "\n1111\n2222" * 100 render json: { - log: ( Pygments.highlight(worker_log, lexer: 'sh') rescue worker_log), + log: (Pygments.highlight(worker_log, lexer: 'sh') rescue worker_log), building: @product_build_list.build_started? } end diff --git a/app/helpers/product_build_lists_helper.rb b/app/helpers/product_build_lists_helper.rb new file mode 100644 index 000000000..915487e79 --- /dev/null +++ b/app/helpers/product_build_lists_helper.rb @@ -0,0 +1,7 @@ +module ProductBuildListsHelper + + def product_build_list_delete_options + [false, true].map{ |status| [t("layout.#{status}_"), status] } + end + +end diff --git a/app/views/platforms/product_build_lists/show.html.haml b/app/views/platforms/product_build_lists/show.html.haml deleted file mode 100644 index 170194d36..000000000 --- a/app/views/platforms/product_build_lists/show.html.haml +++ /dev/null @@ -1,71 +0,0 @@ --set_meta_tags title: [title_object(@product_build_list.product), t('layout.product_build_lists.show')] -= render 'submenu' - -- pbl = @product_build_list -- product = pbl.product -- platform = product.platform - -%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: :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_version, value: product_build_list_version_link(pbl, true) - - - [: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: :autostarted, value: t("layout.#{pbl.autostarted}_") - - = render 'show_field', key: :notified_at, value: '{{pbl.notified_at}}' - - - 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, data: { confirm: t("layout.confirm") }, class: 'button', - 'ng-show' => 'pbl.can_cancel' - .both - %br - - - if can?(:update, pbl) - %div{'ng-show' => "pbl.status == #{ProductBuildList::BUILD_COMPLETED}"} - .leftlist= t('activerecord.attributes.product_build_list.not_delete') - .rightlist - = select_tag 'not_delete', options_for_select([false, true].map{|status| [t("layout.#{status}_"), status]}), {'ng-model' => "pbl.not_delete", 'ng-change' => 'updateStatus()'} - .both - - if can?(:destroy, pbl) - = link_to t('layout.product_build_lists.delete'), - platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl), - method: :delete, data: { confirm: t("layout.confirm") }, class: 'button', - 'ng-show' => 'pbl.can_destroy' - .both - %br - .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 - - if days > 1 - = t('layout.product_build_lists.will_be_removed_n_days', n: days) - - else - = t('layout.product_build_lists.will_be_removed_today') - .both - - %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/build_results', subject: pbl - -:javascript - $(function(){ - $('article .all').addClass('bigpadding'); - }); diff --git a/app/views/platforms/product_build_lists/show.html.slim b/app/views/platforms/product_build_lists/show.html.slim new file mode 100644 index 000000000..f272e6fd1 --- /dev/null +++ b/app/views/platforms/product_build_lists/show.html.slim @@ -0,0 +1,132 @@ +- set_meta_tags title: [title_object(@product_build_list.product), t('layout.product_build_lists.show')] += render 'submenu' + +- pbl = @product_build_list +- product = pbl.product +- platform = product.platform + +.container.col-md-offset-2.col-md-8 ng-controller='ProductBuildListController' + .row + h3 + = t('layout.product_build_lists.main_data') + + .row + = hidden_field_tag :product_build_list_id, pbl.id + .col-md-6 + b + = t('activerecord.attributes.product_build_list.id') + .col-md-6 + = pbl.id + + .row + .col-md-6 + b + = t('activerecord.attributes.product_build_list.status') + .col-md-6 + | {{pbl.human_status}} + + - if pbl.user + .row + .col-md-6 + b + = t('activerecord.attributes.product_build_list.user') + .col-md-6 + = link_to pbl.user.try(:fullname), pbl.user + + .row + .col-md-6 + b + = t('activerecord.attributes.product_build_list.product') + .col-md-6 + = link_to pbl.product.name, platform_product_path(platform, product) + + .row + .col-md-6 + b + = t('activerecord.attributes.product_build_list.project') + .col-md-6 + = link_to pbl.project.name_with_owner, project_path(pbl.project) + + .row + .col-md-6 + b + = t('activerecord.attributes.product_build_list.project_version') + .col-md-6 + = product_build_list_version_link(pbl, true) + + .row + .col-md-6 + b + = t('activerecord.attributes.product_build_list.main_script') + .col-md-6 + = pbl.main_script + + .row + .col-md-6 + b + = t('activerecord.attributes.product_build_list.params') + .col-md-6 + = pbl.params + + .row + .col-md-6 + b + = t('activerecord.attributes.product_build_list.time_living') + .col-md-6 + = pbl.time_living / 60 + + .row + .col-md-6 + b + = t('activerecord.attributes.product_build_list.autostarted') + .col-md-6 + = t("layout.#{pbl.autostarted}_") + + .row + .col-md-6 + b + = t('activerecord.attributes.product_build_list.notified_at') + .col-md-6 + | {{pbl.notified_at}} + + - if can?(:update, pbl) + .row ng-show="pbl.status == #{ ProductBuildList::BUILD_COMPLETED }" + .col-md-6 + b + = t('activerecord.attributes.product_build_list.not_delete') + .col-md-6 + = select_tag 'not_delete', + options_for_select(product_build_list_delete_options), + { ng_model: "pbl.not_delete", ng_change: 'updateStatus()'} + + .row.alert.alert-danger.offset20 ng-hide='pbl.not_delete' + - days = pbl.autostarted? ? ProductBuildList::LIVE_TIME : ProductBuildList::MAX_LIVE_TIME + - days = (pbl.created_at.to_date - days.ago.to_date).to_i + - if days > 1 + = t('layout.product_build_lists.will_be_removed_n_days', n: days) + - else + = t('layout.product_build_lists.will_be_removed_today') + + .row + hr + - if can?(:cancel, pbl) + a.btn.btn-warning[href=cancel_platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl) + method = 'put' + data-confirm = t('layout.confirm') + ng-show = 'pbl.can_cancel' ] + = t('layout.build_lists.cancel') + |   + + - if can?(:destroy, pbl) + a.btn.btn-danger[ href=platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl) + method = 'delete' + data-confirm = t('layout.confirm') + ng-show = 'pbl.can_destroy' ] + = t('layout.product_build_lists.delete') + + .row.offset20 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) } + + .row + = render 'shared/build_results', subject: pbl + diff --git a/app/views/projects/build_lists/show.html.slim b/app/views/projects/build_lists/show.html.slim new file mode 100644 index 000000000..04556d591 --- /dev/null +++ b/app/views/projects/build_lists/show.html.slim @@ -0,0 +1,313 @@ +-set_meta_tags title: [title_object(@build_list.project), t('activerecord.models.build_list')] + + + + + + +.build-list{'ng-controller' => 'BuildListController'} + .notify.blue + %div{class: '{{build_list.status_color}}'} + %p {{build_list.human_status | i18n}} + %p{'am-time-ago' => 'build_list.updated_at', title: '{{build_list.updated_at_utc}}'} + .both + =form_for @build_list, url: publish_build_list_path(@build_list), html: { class: :form } do |f| + %h3= t("layout.build_lists.main_data") + .leftlist= t("activerecord.attributes.build_list.container_path") + .rightlist{'ng-show' => "build_list.container_status == #{BuildList::BUILD_PUBLISHED}"} + - url = container_url + = link_to url, url + .rightlist{'ng-show' => "build_list.container_status == #{BuildList::BUILD_PUBLISH}"} + = t("layout.build_lists.creating") + .both + + .leftlist= t("activerecord.attributes.build_list.id") + .rightlist + = @build_list.id + = hidden_field_tag :build_list_id, @build_list.id + .both + .leftlist= t("activerecord.attributes.build_list.user") + .rightlist + = link_to @build_list.user.try(:fullname), @build_list.user + .both + .leftlist= t("activerecord.attributes.build_list.publisher") + .rightlist{'ng-show' => 'build_list.publisher'} + %a{'ng-href' => '{{build_list.publisher.path}}' } {{build_list.publisher.fullname}} + .both + .leftlist= t("activerecord.attributes.build_list.build_for_platform") + .rightlist + - if bfp = @build_list.build_for_platform + = link_to(bfp.name, bfp) + - else + = t("layout.build_lists.platform_deleted") + .both + .leftlist= t("activerecord.attributes.build_list.save_to_repository") + .rightlist + = link_to "#{@build_list.save_to_platform.name}/#{@build_list.save_to_repository.name}", [@build_list.save_to_platform, @build_list.save_to_repository] + .both + .leftlist= t("activerecord.attributes.build_list.include_testing_subrepository") + .rightlist= t("layout.#{@build_list.include_testing_subrepository?}_") + .both + .leftlist= t("activerecord.attributes.build_list.include_repos") + .rightlist= (@build_list.include_repos||[]).map{|r| Repository.where(id: r).first.try(:name)}.join(', ') + .both + .leftlist= t("activerecord.attributes.build_list.update_type") + .rightlist + = f.select :update_type, options_for_select(build_list_classified_update_types, + @build_list.update_type), {}, 'ng-model' => 'build_list.update_type', + 'ng-change' => 'updateTypeChanged()', 'ng-show' => 'build_list.can_publish' + %div{'ng-hide' => 'build_list.can_publish'}= @build_list.update_type + .ng-hide{ 'ng-show' => 'update_type_errors' } + .flash_notify + .alert{ 'ng-class' => "{ 'alert-error': update_type_errors }" } + {{ update_type_errors }} + .both + .both + .leftlist= t("activerecord.attributes.build_list.auto_publish_status") + .rightlist= t("layout.build_lists.auto_publish_status.#{@build_list.auto_publish_status}") + .both + .leftlist= t("activerecord.attributes.build_list.auto_create_container") + .rightlist= t("layout.#{@build_list.auto_create_container?}_") + .both + .leftlist= t("activerecord.attributes.build_list.use_cached_chroot") + .rightlist= t("layout.#{@build_list.use_cached_chroot?}_") + .both + .leftlist= t("activerecord.attributes.build_list.use_extra_tests") + .rightlist= t("layout.#{@build_list.use_extra_tests?}_") + .both + .leftlist= t("activerecord.attributes.build_list.save_buildroot") + .rightlist= t("layout.#{@build_list.save_buildroot?}_") + .both + .leftlist= t("activerecord.attributes.build_list.project_version") + .rightlist= link_to @build_list.project_version, tree_path(@build_list.project, @build_list.project_version) + .both + .leftlist= t("diff") + .rightlist= build_list_version_link(@build_list, true) + .both + .leftlist= t("activerecord.attributes.build_list.arch") + .rightlist= @build_list.arch.name + .both + .leftlist= t("activerecord.attributes.build_list.updated_at") + .rightlist {{build_list.updated_at_utc}} + .both + - if @build_list.external_nodes.present? + .leftlist= t("activerecord.attributes.build_list.external_nodes") + .rightlist= I18n.t("layout.build_lists.external_nodes.#{@build_list.external_nodes}") + .both + .leftlist= t("activerecord.attributes.build_list.builder") + .rightlist{'ng-show' => 'build_list.builder'} + %a{'ng-href' => '{{build_list.builder.path}}' } {{build_list.builder.fullname}} + .both + .leftlist= t("activerecord.attributes.build_list.is_circle") + .rightlist= t("layout.#{@build_list.is_circle?}_") + .both + .leftlist= t("activerecord.attributes.build_list.new_core") + .rightlist= t("layout.#{@build_list.new_core?}_") + .both + - if @build_list.extra_build_lists.present? || @build_list.extra_repositories.present? + .leftlist= t("activerecord.attributes.build_list.extra_repositories") + .rightlist + - Repository.where(id: @build_list.extra_repositories).each do |repo| + %p= link_to "#{repo.platform.name}/#{repo.name}", [repo.platform, repo] + - BuildList.where(id: @build_list.extra_build_lists).each do |bl| + %p= link_to "#{bl.id} (#{bl.project.name} - #{bl.arch.name})", bl + .both + + - if @build_list.extra_params.present? + .leftlist + %h4.nomargin= t('activerecord.attributes.build_list.extra_params.label') + .rightlist + .both + - @build_list.extra_params.each do |k, v| + .leftlist= t("activerecord.attributes.build_list.extra_params.#{k}") + .rightlist= v + .both + + + - if @build_list.mass_build_id.present? + .leftlist= t("activerecord.attributes.mass_build_id") + - path = platform_mass_build_path(@build_list.save_to_platform, @build_list.mass_build_id) + .rightlist= link_to @build_list.mass_build.name, path + + .both + + %div{'ng-show' => 'build_list.advisory'} + .leftlist= t("layout.build_lists.attached_advisory") + .rightlist + %a{'ng-href' => '{{build_list.advisory.path}}' } + {{build_list.advisory.advisory_id}} + .both + + %div{'ng-show' => 'build_list.human_duration'} + %br + .leftlist + .rightlist {{build_list.human_duration }} + .both + + - if @build_list.save_to_platform.released + #advisory_block{'ng-show' => 'build_list.can_publish && !build_list.advisory'} + .leftlist= label_tag :attach_advisory, t("layout.build_lists.attached_advisory") + .rightlist + = select_tag :attach_advisory, advisories_select_options(@advisories), 'ng-model' => 'attach_advisory', 'ng-change' => 'attachAdvisoryChanged()' + %p.hint_text= t("layout.advisories.publication_info", update_types: BuildList::RELEASE_UPDATE_TYPES.join(', ')) + .both + + #advisory_search_block{'ng-show' => 'attach_advisory != "no" && attach_advisory != "new"'} + %h3= t("layout.advisories.search_by_id") + .leftlist= label_tag :advisory_search, t("layout.advisories.search_hint") + .rightlist + %input#advisory_search{type: 'text', 'ng-model' => 'term', 'ng-keyup' => 'search()'} + %p.hint_text= t("layout.advisories.advisory_id_info", advisory_format: advisory_id_for_hint) + .both + - I18n.t('layout.advisories.banners').keys.each do |key| + .info{class: key, 'ng-show' => "search_status == '#{key}'"} + %p= t("layout.advisories.banners.#{key}") + + #new_advisory_form{'ng-show' => 'attach_advisory == "new"'} + = f.fields_for @build_list.build_advisory do |f| + = render partial: 'advisories/form', locals: {f: f} + + #advisory_preview{'ng-show' => 'attach_advisory != "no" && attach_advisory != "new"'} + %h3= t('activerecord.models.advisory') << ' {{advisory.advisory_id}}' + + .leftlist= t('activerecord.attributes.advisory.description') + .rightlist.descr {{advisory.description}} + .both + + .leftlist= t('activerecord.attributes.advisory.references') + .rightlist.refs {{advisory.references}} + .both + + %div{'ng-hide' => 'build_list.extra_build_lists_published'} + .flash_notify + .alert.alert-error= t('layout.build_lists.publish_with_extra_fail') + .both + + - unless @build_list.valid_branch_for_publish? + .flash_notify + .alert.alert-error= t('layout.build_lists.wrong_branch_for_publish_html', branch: @build_list.save_to_repository.publish_builds_only_from_branch) + .both + + %div{'ng-show' => 'build_list.can_publish && build_list.can_publish_in_future && !build_list.can_publish_into_repository'} + .flash_notify + .alert.alert-error= t('flash.build_list.not_all_build_lists_success') + .both + + - if can?(:cancel, @build_list) + = link_to t("layout.build_lists.cancel"), cancel_build_list_path(@build_list), + method: :put, data: { confirm: t("layout.confirm") }, class: 'button', + 'ng-show' => 'build_list.can_cancel' + = submit_tag t('layout.publish_again'), + data: { confirm: t("layout.publish_again_warning") }, + name: 'publish', + 'ng-show' => "build_list.can_publish && build_list.status == #{BuildList::BUILD_PUBLISHED}" + = submit_tag t("layout.publish"), + data: { confirm: t('layout.build_lists.tests_failed') }, name: 'publish', + 'ng-show' => "build_list.can_publish && build_list.can_publish_in_future && build_list.extra_build_lists_published && build_list.status == #{BuildList::TESTS_FAILED}" + = submit_tag t("layout.publish"), + data: { confirm: t('layout.confirm') }, name: 'publish', + 'ng-show' => "build_list.can_publish && build_list.can_publish_in_future && build_list.extra_build_lists_published && build_list.status != #{BuildList::TESTS_FAILED} && build_list.status != #{BuildList::BUILD_PUBLISHED}" + = link_to t('layout.publish_into_testing'), publish_into_testing_build_list_path(@build_list), + method: :put, data: { confirm: t("layout.confirm") }, + class: 'button', + 'ng-show' => 'build_list.can_publish_into_testing' + - if can?(:reject_publish, @build_list) + = link_to t('layout.reject_publish'), reject_publish_build_list_path(@build_list), + method: :put, data: { confirm: t("layout.confirm") }, + class: 'button', + 'ng-show' => 'build_list.can_reject_publish' + - if can?(:rerun_tests, @build_list) + = link_to t('layout.build_lists.rerun_tests'), + rerun_tests_build_list_path(@build_list), + method: :put, + data: { confirm: t("layout.confirm") }, + class: 'button', + 'ng-show' => "build_list.status == #{BuildList::TESTS_FAILED} || build_list.status == #{BuildList::SUCCESS}" + - if can?(:create_container, @build_list) + = link_to t("layout.build_lists.create_container"), + create_container_build_list_path(@build_list), + method: :put, data: { confirm: t("layout.confirm") }, + class: 'button', + 'ng-show' => 'build_list.can_create_container' + - if can? :create, @build_list + = link_to t('layout.build_lists.recreate_build_list'), new_project_build_list_path(@build_list.project, build_list_id: @build_list.id), class: 'button' + - if can_run_dependent_build_lists?(@build_list) + = link_to t('projects.build_lists.dependent_projects.title'), + dependent_projects_build_list_path(@build_list), + class: 'button', + 'ng-show' => 'build_list.dependent_projects_exists' + + %div{'ng-show' => "build_list.status == #{BuildList::BUILD_STARTED}"} + = render 'shared/log', { build_started: true, get_log_path: log_build_list_path(@build_list) } + + .hr + %h3= t("layout.build_lists.items_header") + %h4.nomargin{'ng-hide' => 'build_list.item_groups'} + = t("layout.build_lists.no_items_data") + %div{'ng-repeat' => 'group in build_list.item_groups'} + %div{'ng-repeat' => 'item in group'} + %h4.nomargin {{item.name + ' #' + item.level}} + %table.tablesorter.width565{cellpadding: "0", cellspacing: "0"} + %thead + %tr + %th= t("activerecord.attributes.build_list/item.name") + %th= t("activerecord.attributes.build_list/item.version") + %th= t("activerecord.attributes.build_list/item.status") + %tbody + %tr{class: "{{build_list.itemStatusColor(item.status)}}"} + %td {{item.name}} + %td + %a{'ng-href' => '{{item.path.href}}' } {{item.path.text}} + %td {{build_list.humanStatus(item.status) | i18n}} + .both + + %div{'ng-show' => 'build_list.packages'} + .hr + %h3= t('layout.build_lists.packages_header') + %table.tablesorter.width565{cellpadding: "0", cellspacing: "0"} + %thead + %tr + %th= t("activerecord.attributes.build_list/package.fullname") + %th= t("activerecord.attributes.build_list/package.name") + %th= t("activerecord.attributes.build_list/package.epoch") + %th= t("activerecord.attributes.build_list/package.version") + %th= t("activerecord.attributes.build_list/package.release") + %tbody + %tr{'ng-repeat-start' => 'package in build_list.packages'} + %td.package + %a.expand{'ng-show' => 'package.dependent_projects' } + %span.icon-chevron-up{'ng-show' => 'package.show_dependent_projects', + 'ng-click' => 'package.show_dependent_projects = false' } + %span.icon-chevron-down{'ng-hide' => 'package.show_dependent_projects', + 'ng-click' => 'package.show_dependent_projects = true' } + %div{'ng-if' => '!package.url'} {{package.fullname}} + %a{ 'ng-if' => 'package.url', + 'ng-href' => "{{package.url}}" } + {{package.fullname}} + + %td {{package.name}} + %td {{package.epoch}} + %td {{package.version}} + %td {{package.release}} + + %tr{'ng-repeat-end' => '', + 'ng-show' => 'package.show_dependent_projects', + 'ng-repeat' => 'project in package.dependent_projects' } + %td + %a{'ng-href' => "{{project.url}}" } {{project.name}} + %td + %p{'ng-repeat' => 'package in project.dependent_packages'} + {{package}} + %td{ colspan: 3 } + %a{'ng-href' => '{{project.new_url}}' } + = t('layout.build_lists.create_build_list') + .both + + - if @build_list.new_core? + .hr + = render 'shared/build_results', subject: @build_list + +:javascript + $('article .all').addClass('bigpadding'); + += render 'submenu' diff --git a/app/views/shared/_build_results.html.haml b/app/views/shared/_build_results.html.haml deleted file mode 100644 index 713c8c75d..000000000 --- a/app/views/shared/_build_results.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -%h3= subject.class.human_attribute_name(subject.is_a?(BuildList) ? 'logs' : 'results') -%h4{ 'ng-hide' => 'subject.results' }= t('layout.no_') -%table.table.table-hover{ 'ng-show' => 'subject.results' } - %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' - %th= t 'activerecord.attributes.product_build_list/results.created_at' - %tbody - %tr{ 'ng-repeat' => 'item in subject.results' } - %td - %a{ 'ng-href' => '{{item.url}}' } {{item.file_name}} - %td {{item.sha1}} - %td {{item.size}} - %td {{item.created_at}} diff --git a/app/views/shared/_build_results.html.slim b/app/views/shared/_build_results.html.slim new file mode 100644 index 000000000..215242507 --- /dev/null +++ b/app/views/shared/_build_results.html.slim @@ -0,0 +1,22 @@ +h3 + = subject.class.human_attribute_name(subject.is_a?(BuildList) ? 'logs' : 'results') +h4 ng-hide='subject.results' + = t('layout.no_') +table.table.table-hover ng-show='subject.results' + 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' + th= t 'activerecord.attributes.product_build_list/results.created_at' + tbody + tr ng-repeat='item in subject.results' + td + a ng-href='{{item.url}}' + | {{item.file_name}} + td + | {{item.sha1}} + td + | {{item.size}} + td + | {{item.created_at}} diff --git a/app/views/shared/_log.html.haml b/app/views/shared/_log.html.haml deleted file mode 100644 index e0b140a59..000000000 --- a/app/views/shared/_log.html.haml +++ /dev/null @@ -1,43 +0,0 @@ --# - params: - - build_started - - download_log_url - - get_log_path - -- download_log_url ||= false - -%hr -%a{name: 'log'} -.log-wrapper - .log-header - .text-wrap - = link_to({anchor: :log}, {id: 'log_anchor'}) do - %h3= t("layout.build_lists.log.build_log") - %span - .both - .log-body.hidden - .reloader - %table.options - %tr.top - %td.first - = label_tag :word_wrap do - = check_box_tag :word_wrap - = t("layout.word_wrap") - %td.last{ class: build_started ? nil : :hidden } - = label_tag :autoreload do - = check_box_tag :autoreload, true, build_started - = t("layout.build_lists.log.autoreload") - = select_tag :reload_interval, log_reload_time_options - - .both - #output.cm-s-default.log{ readonly: :readonly, - data: { url: get_log_path, log_type: :build } } - %pre#code - .both -.both - - -:javascript - $(function() { - initLogWrapper(); - }); diff --git a/app/views/shared/_log.html.slim b/app/views/shared/_log.html.slim new file mode 100644 index 000000000..160f22714 --- /dev/null +++ b/app/views/shared/_log.html.slim @@ -0,0 +1,9 @@ +/ params: get_log_path + +accordion close-others='false' ng-cloak=true + accordion-group is-open='$parent.isOpenBuildLog' + accordion-heading + = t('layout.build_lists.log.build_log') + span.pull-right.fa ng-class="{'fa-chevron-down': isOpenBuildLog, 'fa-chevron-up': !isOpenBuildLog}" + .row.build-log ng-controller='BuildLogController' ng-init="init('#{ get_log_path }')" + .col-md-12 ng-bind-html='log'