Commit 80c86bcc authored by Katarzyna Kobierska's avatar Katarzyna Kobierska

Create shared partial for project and admin builds

parent 27c3a871
- project = build.project
%tr.build.commit
%td.status
= ci_status_with_icon(build.status)
%td
.branch-commit
- if can?(current_user, :read_build, build.project)
= link_to namespace_project_build_url(build.project.namespace, build.project, build) do
%span.build-link ##{build.id}
- else
%span.build-link ##{build.id}
- if build.ref
.icon-container
= build.tag? ? icon('tag') : icon('code-fork')
= link_to build.ref, namespace_project_commits_path(build.project.namespace, build.project, build.ref), class: "monospace branch-name"
- else
.light none
.icon-container
= custom_icon("icon_commit")
= link_to build.short_sha, namespace_project_commit_path(build.project.namespace, build.project, build.sha), class: "monospace commit-id"
- if build.stuck?
%i.fa.fa-warning.text-warning
.label-container
- if build.tags.any?
- build.tags.each do |tag|
%span.label.label-primary
= tag
- if build.try(:trigger_request)
%span.label.label-info triggered
- if build.try(:allow_failure)
%span.label.label-danger allowed to fail
%td
- if project
= link_to project.name_with_namespace, admin_namespace_project_path(project.namespace, project)
%td
- if build.try(:runner)
= runner_link(build.runner)
- else
.light none
%td
= build.stage
%td
= build.name
%td
- if build.duration
%p.duration
= custom_icon("icon_timer")
= duration_in_numbers(build.duration)
- if build.finished_at
%p.finished-at
= icon("calendar")
%span #{time_ago_with_tooltip(build.finished_at)}
%td.coverage
- if defined?(coverage) && coverage
- if build.try(:coverage)
#{build.coverage}%
%td
.pull-right
- if can?(current_user, :read_build, project) && build.artifacts?
= link_to download_namespace_project_build_artifacts_path(build.project.namespace, build.project, build), title: 'Download artifacts', class: 'btn btn-build' do
%i.fa.fa-download
- if can?(current_user, :update_build, build.project)
- if build.active?
= link_to cancel_namespace_project_build_path(build.project.namespace, build.project, build, return_to: request.original_url), method: :post, title: 'Cancel', class: 'btn btn-build' do
%i.fa.fa-remove.cred
- elsif defined?(allow_retry) && allow_retry && build.retryable?
= link_to retry_namespace_project_build_path(build.project.namespace, build.project, build, return_to: request.original_url), method: :post, title: 'Retry', class: 'btn btn-build' do
%i.fa.fa-refresh
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
.top-area .top-area
- build_path = ->(scope) { admin_builds_path(scope: scope) } - build_path = ->(scope) { admin_builds_path(scope: scope) }
= render "shared/builds_tabs", build_path: build_path, all_builds: @all_builds, scope: @scope = render "shared/builds/tabs", build_path: build_path, all_builds: @all_builds, scope: @scope
.nav-controls .nav-controls
- if @all_builds.running_or_pending.any? - if @all_builds.running_or_pending.any?
......
- admin = false unless admin
- if builds.blank? - if builds.blank?
%li %li
.nothing-here-block No builds to show .nothing-here-block No builds to show
...@@ -20,9 +21,8 @@ ...@@ -20,9 +21,8 @@
%th %th
- if admin - if admin
- builds.each do |build| = render partial: "shared/builds/build", collection: builds, as: :build, locals: { commit_sha: true, ref: true, stage: true, allow_retry: true, runner: true, admin: true }
= render "admin/builds/build", build: build
- else - else
= render builds, commit_sha: true, ref: true, stage: true, allow_retry: true, coverage: project.build_coverage_enabled? = render partial: "shared/builds/build", collection: builds, as: :build, locals: {commit_sha: true, ref: true, stage: true, allow_retry: true, coverage: project.build_coverage_enabled? }
= paginate builds, theme: 'gitlab' = paginate builds, theme: 'gitlab'
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
%div{ class: container_class } %div{ class: container_class }
.top-area .top-area
- build_path = ->(scope) { project_builds_path(@project, scope: scope) } - build_path = ->(scope) { project_builds_path(@project, scope: scope) }
= render "shared/builds_tabs", build_path: build_path, all_builds: @all_builds, scope: @scope = render "shared/builds/tabs", build_path: build_path, all_builds: @all_builds, scope: @scope
.nav-controls .nav-controls
- if can?(current_user, :update_build, @project) - if can?(current_user, :update_build, @project)
...@@ -20,4 +20,4 @@ ...@@ -20,4 +20,4 @@
%span CI Lint %span CI Lint
%ul.content-list.builds-content-list %ul.content-list.builds-content-list
= render "table", builds: @builds, project: @project, admin: false = render "table", builds: @builds, project: @project
- admin = false unless admin
- if admin
- project = build.project
%tr.build.commit %tr.build.commit
%td.status %td.status
- if can?(current_user, :read_build, build) - if can?(current_user, :read_build, build)
...@@ -9,9 +13,9 @@ ...@@ -9,9 +13,9 @@
.branch-commit .branch-commit
- if can?(current_user, :read_build, build) - if can?(current_user, :read_build, build)
= link_to namespace_project_build_url(build.project.namespace, build.project, build) do = link_to namespace_project_build_url(build.project.namespace, build.project, build) do
%span ##{build.id} %span.build-link ##{build.id}
- else - else
%span ##{build.id} %span.build-link ##{build.id}
- if defined?(ref) && ref - if defined?(ref) && ref
- if build.ref - if build.ref
...@@ -45,6 +49,11 @@ ...@@ -45,6 +49,11 @@
- if build.manual? - if build.manual?
%span.label.label-info manual %span.label.label-info manual
- if admin
%td
- if project
= link_to project.name_with_namespace, admin_namespace_project_path(project.namespace, project)
- if defined?(runner) && runner - if defined?(runner) && runner
%td %td
- if build.try(:runner) - if build.try(:runner)
...@@ -53,8 +62,7 @@ ...@@ -53,8 +62,7 @@
.light none .light none
%td %td
- if defined?(stage) && stage = build.stage
= build.stage
%td %td
= build.name = build.name
...@@ -64,13 +72,14 @@ ...@@ -64,13 +72,14 @@
%p.duration %p.duration
= custom_icon("icon_timer") = custom_icon("icon_timer")
= duration_in_numbers(build.duration) = duration_in_numbers(build.duration)
- if build.finished_at - if build.finished_at
%p.finished-at %p.finished-at
= icon("calendar") = icon("calendar")
%span #{time_ago_with_tooltip(build.finished_at)} %span #{time_ago_with_tooltip(build.finished_at)}
- if defined?(coverage) && coverage %td.coverage
%td.coverage - if defined?(coverage) && coverage
- if build.try(:coverage) - if build.try(:coverage)
#{build.coverage}% #{build.coverage}%
...@@ -87,6 +96,6 @@ ...@@ -87,6 +96,6 @@
- if build.retryable? - if build.retryable?
= link_to retry_namespace_project_build_path(build.project.namespace, build.project, build, return_to: request.original_url), method: :post, title: 'Retry', class: 'btn btn-build' do = link_to retry_namespace_project_build_path(build.project.namespace, build.project, build, return_to: request.original_url), method: :post, title: 'Retry', class: 'btn btn-build' do
= icon('repeat') = icon('repeat')
- elsif build.playable? - elsif build.playable? && !admin
= link_to play_namespace_project_build_path(build.project.namespace, build.project, build, return_to: request.original_url), method: :post, title: 'Play', class: 'btn btn-build' do = link_to play_namespace_project_build_path(build.project.namespace, build.project, build, return_to: request.original_url), method: :post, title: 'Play', class: 'btn btn-build' do
= custom_icon('icon_play') = custom_icon('icon_play')
%ul.nav-links
%li{class: ('active' if scope.nil?)}
= link_to build_path[nil] do
All
%span.badge.js-totalbuilds-count
= number_with_delimiter(all_builds.count(:id))
%li{class: ('active' if scope == 'pending')}
= link_to build_path[:pending] do
Pending
%span.badge
= number_with_delimiter(all_builds.pending.count(:id))
%li{class: ('active' if scope == 'running')}
= link_to build_path[:running] do
Running
%span.badge
= number_with_delimiter(all_builds.running.count(:id))
%li{class: ('active' if scope == 'finished')}
= link_to build_path[:finished] do
Finished
%span.badge
= number_with_delimiter(all_builds.finished.count(:id))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment