From 71777a4a184945d6b58170af55d9fd9fef821ac9 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Tue, 16 May 2017 19:41:15 +0800 Subject: Rename BuildsController to JobsController Rename other URL generators admin_builds_path -> admin_jobs_path Fix tests and more renaming Fix more tests Also change build_id to job_id in the controller --- .../projects/artifacts/_tree_directory.html.haml | 2 +- app/views/projects/artifacts/_tree_file.html.haml | 2 +- app/views/projects/artifacts/browse.html.haml | 8 +- app/views/projects/artifacts/file.html.haml | 8 +- app/views/projects/builds/_header.html.haml | 31 ----- app/views/projects/builds/_sidebar.html.haml | 142 --------------------- app/views/projects/builds/_table.html.haml | 25 ---- app/views/projects/builds/_user.html.haml | 7 - app/views/projects/builds/index.html.haml | 23 ---- app/views/projects/builds/show.html.haml | 86 ------------- app/views/projects/ci/builds/_build.html.haml | 10 +- app/views/projects/jobs/_header.html.haml | 31 +++++ app/views/projects/jobs/_sidebar.html.haml | 142 +++++++++++++++++++++ app/views/projects/jobs/_table.html.haml | 25 ++++ app/views/projects/jobs/_user.html.haml | 7 + app/views/projects/jobs/index.html.haml | 23 ++++ app/views/projects/jobs/show.html.haml | 86 +++++++++++++ app/views/projects/pipelines/_head.html.haml | 2 +- app/views/projects/pipelines/_with_tabs.html.haml | 2 +- 19 files changed, 331 insertions(+), 331 deletions(-) delete mode 100644 app/views/projects/builds/_header.html.haml delete mode 100644 app/views/projects/builds/_sidebar.html.haml delete mode 100644 app/views/projects/builds/_table.html.haml delete mode 100644 app/views/projects/builds/_user.html.haml delete mode 100644 app/views/projects/builds/index.html.haml delete mode 100644 app/views/projects/builds/show.html.haml create mode 100644 app/views/projects/jobs/_header.html.haml create mode 100644 app/views/projects/jobs/_sidebar.html.haml create mode 100644 app/views/projects/jobs/_table.html.haml create mode 100644 app/views/projects/jobs/_user.html.haml create mode 100644 app/views/projects/jobs/index.html.haml create mode 100644 app/views/projects/jobs/show.html.haml (limited to 'app/views/projects') diff --git a/app/views/projects/artifacts/_tree_directory.html.haml b/app/views/projects/artifacts/_tree_directory.html.haml index 34d5c3b7285..e2966ec33c2 100644 --- a/app/views/projects/artifacts/_tree_directory.html.haml +++ b/app/views/projects/artifacts/_tree_directory.html.haml @@ -1,4 +1,4 @@ -- path_to_directory = browse_namespace_project_build_artifacts_path(@project.namespace, @project, @build, path: directory.path) +- path_to_directory = browse_namespace_project_job_artifacts_path(@project.namespace, @project, @build, path: directory.path) %tr.tree-item{ 'data-link' => path_to_directory } %td.tree-item-file-name diff --git a/app/views/projects/artifacts/_tree_file.html.haml b/app/views/projects/artifacts/_tree_file.html.haml index ce7e25d774b..ea0b43b85cf 100644 --- a/app/views/projects/artifacts/_tree_file.html.haml +++ b/app/views/projects/artifacts/_tree_file.html.haml @@ -1,4 +1,4 @@ -- path_to_file = file_namespace_project_build_artifacts_path(@project.namespace, @project, @build, path: file.path) +- path_to_file = file_namespace_project_job_artifacts_path(@project.namespace, @project, @build, path: file.path) %tr.tree-item{ 'data-link' => path_to_file } - blob = file.blob diff --git a/app/views/projects/artifacts/browse.html.haml b/app/views/projects/artifacts/browse.html.haml index 9fbb30f7c7c..961c805dc7c 100644 --- a/app/views/projects/artifacts/browse.html.haml +++ b/app/views/projects/artifacts/browse.html.haml @@ -1,22 +1,22 @@ - page_title @path.presence, 'Artifacts', "#{@build.name} (##{@build.id})", 'Jobs' = render "projects/pipelines/head" -= render "projects/builds/header", show_controls: false += render "projects/jobs/header", show_controls: false .tree-holder .nav-block .tree-controls - = link_to download_namespace_project_build_artifacts_path(@project.namespace, @project, @build), + = link_to download_namespace_project_job_artifacts_path(@project.namespace, @project, @build), rel: 'nofollow', download: '', class: 'btn btn-default download' do = icon('download') Download artifacts archive %ul.breadcrumb.repo-breadcrumb %li - = link_to 'Artifacts', browse_namespace_project_build_artifacts_path(@project.namespace, @project, @build) + = link_to 'Artifacts', browse_namespace_project_job_artifacts_path(@project.namespace, @project, @build) - path_breadcrumbs do |title, path| %li - = link_to truncate(title, length: 40), browse_namespace_project_build_artifacts_path(@project.namespace, @project, @build, path) + = link_to truncate(title, length: 40), browse_namespace_project_job_artifacts_path(@project.namespace, @project, @build, path) .tree-content-holder %table.table.tree-table diff --git a/app/views/projects/artifacts/file.html.haml b/app/views/projects/artifacts/file.html.haml index d8da83b9a80..b25c7c95196 100644 --- a/app/views/projects/artifacts/file.html.haml +++ b/app/views/projects/artifacts/file.html.haml @@ -1,21 +1,21 @@ - page_title @path, 'Artifacts', "#{@build.name} (##{@build.id})", 'Jobs' = render "projects/pipelines/head" -= render "projects/builds/header", show_controls: false += render "projects/jobs/header", show_controls: false #tree-holder.tree-holder .nav-block %ul.breadcrumb.repo-breadcrumb %li - = link_to 'Artifacts', browse_namespace_project_build_artifacts_path(@project.namespace, @project, @build) + = link_to 'Artifacts', browse_namespace_project_job_artifacts_path(@project.namespace, @project, @build) - path_breadcrumbs do |title, path| - title = truncate(title, length: 40) %li - if path == @path - = link_to file_namespace_project_build_artifacts_path(@project.namespace, @project, @build, path) do + = link_to file_namespace_project_job_artifacts_path(@project.namespace, @project, @build, path) do %strong= title - else - = link_to title, browse_namespace_project_build_artifacts_path(@project.namespace, @project, @build, path) + = link_to title, browse_namespace_project_job_artifacts_path(@project.namespace, @project, @build, path) %article.file-holder diff --git a/app/views/projects/builds/_header.html.haml b/app/views/projects/builds/_header.html.haml deleted file mode 100644 index d4cdb709b97..00000000000 --- a/app/views/projects/builds/_header.html.haml +++ /dev/null @@ -1,31 +0,0 @@ -- show_controls = local_assigns.fetch(:show_controls, true) -- pipeline = @build.pipeline - -.content-block.build-header.top-area - .header-content - = render 'ci/status/badge', status: @build.detailed_status(current_user), link: false, title: @build.status_title - %strong - Job - = link_to "##{@build.id}", namespace_project_build_path(@project.namespace, @project, @build), class: 'js-build-id' - in pipeline - %strong - = link_to "##{pipeline.id}", pipeline_path(pipeline) - for - %strong - = link_to pipeline.short_sha, namespace_project_commit_path(@project.namespace, @project, pipeline.sha), class: 'commit-sha' - from - %strong - = link_to @build.ref, project_ref_path(@project, @build.ref), class: 'ref-name' - - = render "projects/builds/user" if @build.user - - = time_ago_with_tooltip(@build.created_at) - - - if show_controls - .nav-controls - - if can?(current_user, :create_issue, @project) && @build.failed? - = link_to "New issue", new_namespace_project_issue_path(@project.namespace, @project, issue: build_failed_issue_options), class: 'btn btn-new btn-inverted' - - if can?(current_user, :update_build, @build) && @build.retryable? - = link_to "Retry job", retry_namespace_project_build_path(@project.namespace, @project, @build), class: 'btn btn-inverted-secondary', method: :post - %button.btn.btn-default.pull-right.visible-xs-block.visible-sm-block.build-gutter-toggle.js-sidebar-build-toggle{ role: "button", type: "button" } - = icon('angle-double-left') diff --git a/app/views/projects/builds/_sidebar.html.haml b/app/views/projects/builds/_sidebar.html.haml deleted file mode 100644 index 8032d81cd91..00000000000 --- a/app/views/projects/builds/_sidebar.html.haml +++ /dev/null @@ -1,142 +0,0 @@ -- builds = @build.pipeline.builds.to_a - -%aside.right-sidebar.right-sidebar-expanded.build-sidebar.js-build-sidebar.js-right-sidebar{ data: { "offset-top" => "101", "spy" => "affix" } } - .block.build-sidebar-header.visible-xs-block.visible-sm-block.append-bottom-default - Job - %strong ##{@build.id} - %a.gutter-toggle.pull-right.js-sidebar-build-toggle{ href: "#" } - = icon('angle-double-right') - - if @build.coverage - .block.coverage - .title - Test coverage - %p.build-detail-row - #{@build.coverage}% - - .blocks-container - - if can?(current_user, :read_build, @project) && (@build.artifacts? || @build.artifacts_expired?) - .block{ class: ("block-first" if !@build.coverage) } - .title - Job artifacts - - if @build.artifacts_expired? - %p.build-detail-row - The artifacts were removed - #{time_ago_with_tooltip(@build.artifacts_expire_at)} - - elsif @build.has_expiring_artifacts? - %p.build-detail-row - The artifacts will be removed in - %span.js-artifacts-remove= @build.artifacts_expire_at - - - if @build.artifacts? - .btn-group.btn-group-justified{ role: :group } - - if @build.has_expiring_artifacts? && can?(current_user, :update_build, @build) - = link_to keep_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default', method: :post do - Keep - - = link_to download_namespace_project_build_artifacts_path(@project.namespace, @project, @build), rel: 'nofollow', download: '', class: 'btn btn-sm btn-default' do - Download - - - if @build.artifacts_metadata? - = link_to browse_namespace_project_build_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default' do - Browse - - .block{ class: ("block-first" if !@build.coverage && !(can?(current_user, :read_build, @project) && (@build.artifacts? || @build.artifacts_expired?))) } - .title - Job details - - if can?(current_user, :update_build, @build) && @build.retryable? - = link_to "Retry job", retry_namespace_project_build_path(@project.namespace, @project, @build), class: 'pull-right retry-link', method: :post - - if @build.merge_request - %p.build-detail-row - %span.build-light-text Merge Request: - = link_to "#{@build.merge_request.to_reference}", merge_request_path(@build.merge_request), class: 'bold' - - if @build.duration - %p.build-detail-row - %span.build-light-text Duration: - = time_interval_in_words(@build.duration) - - if @build.finished_at - %p.build-detail-row - %span.build-light-text Finished: - #{time_ago_with_tooltip(@build.finished_at)} - - if @build.erased_at - %p.build-detail-row - %span.build-light-text Erased: - #{time_ago_with_tooltip(@build.erased_at)} - %p.build-detail-row - %span.build-light-text Runner: - - if @build.runner && current_user && current_user.admin - = link_to "##{@build.runner.id}", admin_runner_path(@build.runner.id) - - elsif @build.runner - \##{@build.runner.id} - .btn-group.btn-group-justified{ role: :group } - - if @build.has_trace? - = link_to 'Raw', raw_namespace_project_build_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default' - - if @build.active? - = link_to "Cancel", cancel_namespace_project_build_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default', method: :post - - if can?(current_user, :update_build, @project) && @build.erasable? - = link_to erase_namespace_project_build_path(@project.namespace, @project, @build), - class: "btn btn-sm btn-default", method: :post, - data: { confirm: "Are you sure you want to erase this build?" } do - Erase - - - if @build.trigger_request - .build-widget - %h4.title - Trigger - - %p - %span.build-light-text Token: - #{@build.trigger_request.trigger.short_token} - - - if @build.trigger_request.variables - %p - %button.btn.group.btn-group-justified.reveal-variables Reveal Variables - - - - @build.trigger_request.variables.each do |key, value| - .hide.js-build - .js-build-variable= key - .js-build-value= value - - .block - .title - Commit title - %p.build-light-text.append-bottom-0 - #{@build.pipeline.git_commit_title} - - - if @build.tags.any? - .block - .title - Tags - - @build.tag_list.each do |tag| - %span.label.label-primary - = tag - - - if @build.pipeline.stages_count > 1 - .dropdown.build-dropdown - .title Stage - %button.dropdown-menu-toggle{ type: 'button', 'data-toggle' => 'dropdown' } - %span.stage-selection More - = icon('chevron-down') - %ul.dropdown-menu - - @build.pipeline.stages.each do |stage| - %li - %a.stage-item= stage.name - - .builds-container - - HasStatus::ORDERED_STATUSES.each do |build_status| - - builds.select{|build| build.status == build_status}.each do |build| - .build-job{ class: sidebar_build_class(build, @build), data: { stage: build.stage } } - = link_to namespace_project_build_path(@project.namespace, @project, build) do - = icon('arrow-right') - %span{ class: "ci-status-icon-#{build.status}" } - = ci_icon_for_status(build.status) - %span - - if build.name - = build.name - - else - = build.id - - if build.retried? - %i.fa.fa-refresh.has-tooltip{ data: { container: 'body', placement: 'bottom' }, title: 'Job was retried' } - -:javascript - new Sidebar(); diff --git a/app/views/projects/builds/_table.html.haml b/app/views/projects/builds/_table.html.haml deleted file mode 100644 index 82806f022ee..00000000000 --- a/app/views/projects/builds/_table.html.haml +++ /dev/null @@ -1,25 +0,0 @@ -- admin = local_assigns.fetch(:admin, false) - -- if builds.blank? - %div - .nothing-here-block No jobs to show -- else - .table-holder - %table.table.ci-table.builds-page - %thead - %tr - %th Status - %th Job - %th Pipeline - - if admin - %th Project - %th Runner - %th Stage - %th Name - %th - %th Coverage - %th - - = render partial: "projects/ci/builds/build", collection: builds, as: :build, locals: { commit_sha: true, ref: true, pipeline_link: true, stage: true, allow_retry: true, admin: admin } - - = paginate builds, theme: 'gitlab' diff --git a/app/views/projects/builds/_user.html.haml b/app/views/projects/builds/_user.html.haml deleted file mode 100644 index 83f299da651..00000000000 --- a/app/views/projects/builds/_user.html.haml +++ /dev/null @@ -1,7 +0,0 @@ -by -%a{ href: user_path(@build.user) } - %span.hidden-xs - = image_tag avatar_icon(@build.user, 24), class: "avatar s24" - %strong{ data: { toggle: 'tooltip', placement: 'top', title: @build.user.to_reference } } - = @build.user.name - %strong.visible-xs-inline= @build.user.to_reference diff --git a/app/views/projects/builds/index.html.haml b/app/views/projects/builds/index.html.haml deleted file mode 100644 index 65162aacda1..00000000000 --- a/app/views/projects/builds/index.html.haml +++ /dev/null @@ -1,23 +0,0 @@ -- @no_container = true -- page_title "Jobs" -= render "projects/pipelines/head" - -%div{ class: container_class } - .top-area - - build_path_proc = ->(scope) { project_builds_path(@project, scope: scope) } - = render "shared/builds/tabs", build_path_proc: build_path_proc, all_builds: @all_builds, scope: @scope - - .nav-controls - - if can?(current_user, :update_build, @project) - - if @all_builds.running_or_pending.any? - = link_to 'Cancel running', cancel_all_namespace_project_builds_path(@project.namespace, @project), - data: { confirm: 'Are you sure?' }, class: 'btn btn-danger', method: :post - - - unless @repository.gitlab_ci_yml - = link_to 'Get started with CI/CD Pipelines', help_page_path('ci/quick_start/README'), class: 'btn btn-info' - - = link_to ci_lint_path, class: 'btn btn-default' do - %span CI lint - - .content-list.builds-content-list - = render "table", builds: @builds, project: @project diff --git a/app/views/projects/builds/show.html.haml b/app/views/projects/builds/show.html.haml deleted file mode 100644 index 7cb2ec83cc7..00000000000 --- a/app/views/projects/builds/show.html.haml +++ /dev/null @@ -1,86 +0,0 @@ -- @no_container = true -- page_title "#{@build.name} (##{@build.id})", "Jobs" -= render "projects/pipelines/head" - -%div{ class: container_class } - .build-page - = render "header" - - - if @build.stuck? - - unless @build.any_runners_online? - .bs-callout.bs-callout-warning - %p - - if no_runners_for_project?(@build.project) - This job is stuck, because the project doesn't have any runners online assigned to it. - - elsif @build.tags.any? - This job is stuck, because you don't have any active runners online with any of these tags assigned to them: - - @build.tags.each do |tag| - %span.label.label-primary - = tag - - else - This job is stuck, because you don't have any active runners that can run this job. - - %br - Go to - = link_to namespace_project_runners_path(@build.project.namespace, @build.project) do - Runners page - - - if @build.starts_environment? - .prepend-top-default - .environment-information - - if @build.outdated_deployment? - = ci_icon_for_status('success_with_warnings') - - else - = ci_icon_for_status(@build.status) - - - environment = environment_for_build(@build.project, @build) - - if @build.success? && @build.last_deployment.present? - - if @build.last_deployment.last? - This job is the most recent deployment to #{environment_link_for_build(@build.project, @build)}. - - else - This job is an out-of-date deployment to #{environment_link_for_build(@build.project, @build)}. - View the most recent deployment #{deployment_link(environment.last_deployment)}. - - elsif @build.complete? && !@build.success? - The deployment of this job to #{environment_link_for_build(@build.project, @build)} did not succeed. - - else - This job is creating a deployment to #{environment_link_for_build(@build.project, @build)} - - if environment.try(:last_deployment) - and will overwrite the #{deployment_link(environment.last_deployment, text: 'latest deployment')} - - .prepend-top-default - - if @build.erased? - .erased.alert.alert-warning - - if @build.erased_by_user? - Job has been erased by #{link_to(@build.erased_by_name, user_path(@build.erased_by))} #{time_ago_with_tooltip(@build.erased_at)} - - else - Job has been erased #{time_ago_with_tooltip(@build.erased_at)} - - else - #js-build-scroll.scroll-controls - .scroll-step - %a.scroll-link.scroll-top{ href: '#up-build-trace', id: 'scroll-top', title: 'Scroll to top' } - = custom_icon('scroll_up') - = custom_icon('scroll_up_hover_active') - %a.scroll-link.scroll-bottom{ href: '#down-build-trace', id: 'scroll-bottom', title: 'Scroll to bottom' } - = custom_icon('scroll_down') - = custom_icon('scroll_down_hover_active') - - if @build.active? - .autoscroll-container - %span.status-message#autoscroll-status{ data: { state: 'disabled' } } - %span.status-text Autoscroll active - %i.status-icon - = custom_icon('scroll_down_hover_active') - #up-build-trace - %pre.build-trace#build-trace - .js-truncated-info.truncated-info.hidden< - Showing last - %span.js-truncated-info-size.truncated-info-size>< - KiB of log - - %a.js-raw-link.raw-link{ :href => raw_namespace_project_build_path(@project.namespace, @project, @build) }>< Complete Raw - %code.bash.js-build-output - .build-loader-animation.js-build-refresh - - #down-build-trace - - = render "sidebar" - -.js-build-options{ data: javascript_build_options } diff --git a/app/views/projects/ci/builds/_build.html.haml b/app/views/projects/ci/builds/_build.html.haml index e796920ac82..bec72bb1f7a 100644 --- a/app/views/projects/ci/builds/_build.html.haml +++ b/app/views/projects/ci/builds/_build.html.haml @@ -14,7 +14,7 @@ %td.branch-commit - if can?(current_user, :read_build, job) - = link_to namespace_project_build_url(job.project.namespace, job.project, job) do + = link_to namespace_project_job_url(job.project.namespace, job.project, job) do %span.build-link ##{job.id} - else %span.build-link ##{job.id} @@ -95,16 +95,16 @@ %td .pull-right - if can?(current_user, :read_build, job) && job.artifacts? - = link_to download_namespace_project_build_artifacts_path(job.project.namespace, job.project, job), rel: 'nofollow', download: '', title: 'Download artifacts', class: 'btn btn-build' do + = link_to download_namespace_project_job_artifacts_path(job.project.namespace, job.project, job), rel: 'nofollow', download: '', title: 'Download artifacts', class: 'btn btn-build' do = icon('download') - if can?(current_user, :update_build, job) - if job.active? - = link_to cancel_namespace_project_build_path(job.project.namespace, job.project, job, return_to: request.original_url), method: :post, title: 'Cancel', class: 'btn btn-build' do + = link_to cancel_namespace_project_job_path(job.project.namespace, job.project, job, return_to: request.original_url), method: :post, title: 'Cancel', class: 'btn btn-build' do = icon('remove', class: 'cred') - elsif allow_retry - if job.playable? && !admin && can?(current_user, :update_build, job) - = link_to play_namespace_project_build_path(job.project.namespace, job.project, job, return_to: request.original_url), method: :post, title: 'Play', class: 'btn btn-build' do + = link_to play_namespace_project_job_path(job.project.namespace, job.project, job, return_to: request.original_url), method: :post, title: 'Play', class: 'btn btn-build' do = custom_icon('icon_play') - elsif job.retryable? - = link_to retry_namespace_project_build_path(job.project.namespace, job.project, job, return_to: request.original_url), method: :post, title: 'Retry', class: 'btn btn-build' do + = link_to retry_namespace_project_job_path(job.project.namespace, job.project, job, return_to: request.original_url), method: :post, title: 'Retry', class: 'btn btn-build' do = icon('repeat') diff --git a/app/views/projects/jobs/_header.html.haml b/app/views/projects/jobs/_header.html.haml new file mode 100644 index 00000000000..ad72ab5b199 --- /dev/null +++ b/app/views/projects/jobs/_header.html.haml @@ -0,0 +1,31 @@ +- show_controls = local_assigns.fetch(:show_controls, true) +- pipeline = @build.pipeline + +.content-block.build-header.top-area + .header-content + = render 'ci/status/badge', status: @build.detailed_status(current_user), link: false, title: @build.status_title + %strong + Job + = link_to "##{@build.id}", namespace_project_job_path(@project.namespace, @project, @build), class: 'js-build-id' + in pipeline + %strong + = link_to "##{pipeline.id}", pipeline_path(pipeline) + for + %strong + = link_to pipeline.short_sha, namespace_project_commit_path(@project.namespace, @project, pipeline.sha), class: 'commit-sha' + from + %strong + = link_to @build.ref, project_ref_path(@project, @build.ref), class: 'ref-name' + + = render "projects/jobs/user" if @build.user + + = time_ago_with_tooltip(@build.created_at) + + - if show_controls + .nav-controls + - if can?(current_user, :create_issue, @project) && @build.failed? + = link_to "New issue", new_namespace_project_issue_path(@project.namespace, @project, issue: build_failed_issue_options), class: 'btn btn-new btn-inverted' + - if can?(current_user, :update_build, @build) && @build.retryable? + = link_to "Retry job", retry_namespace_project_job_path(@project.namespace, @project, @build), class: 'btn btn-inverted-secondary', method: :post + %button.btn.btn-default.pull-right.visible-xs-block.visible-sm-block.build-gutter-toggle.js-sidebar-build-toggle{ role: "button", type: "button" } + = icon('angle-double-left') diff --git a/app/views/projects/jobs/_sidebar.html.haml b/app/views/projects/jobs/_sidebar.html.haml new file mode 100644 index 00000000000..8cd4144952b --- /dev/null +++ b/app/views/projects/jobs/_sidebar.html.haml @@ -0,0 +1,142 @@ +- builds = @build.pipeline.builds.to_a + +%aside.right-sidebar.right-sidebar-expanded.build-sidebar.js-build-sidebar.js-right-sidebar{ data: { "offset-top" => "101", "spy" => "affix" } } + .block.build-sidebar-header.visible-xs-block.visible-sm-block.append-bottom-default + Job + %strong ##{@build.id} + %a.gutter-toggle.pull-right.js-sidebar-build-toggle{ href: "#" } + = icon('angle-double-right') + - if @build.coverage + .block.coverage + .title + Test coverage + %p.build-detail-row + #{@build.coverage}% + + .blocks-container + - if can?(current_user, :read_build, @project) && (@build.artifacts? || @build.artifacts_expired?) + .block{ class: ("block-first" if !@build.coverage) } + .title + Job artifacts + - if @build.artifacts_expired? + %p.build-detail-row + The artifacts were removed + #{time_ago_with_tooltip(@build.artifacts_expire_at)} + - elsif @build.has_expiring_artifacts? + %p.build-detail-row + The artifacts will be removed in + %span.js-artifacts-remove= @build.artifacts_expire_at + + - if @build.artifacts? + .btn-group.btn-group-justified{ role: :group } + - if @build.has_expiring_artifacts? && can?(current_user, :update_build, @build) + = link_to keep_namespace_project_job_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default', method: :post do + Keep + + = link_to download_namespace_project_job_artifacts_path(@project.namespace, @project, @build), rel: 'nofollow', download: '', class: 'btn btn-sm btn-default' do + Download + + - if @build.artifacts_metadata? + = link_to browse_namespace_project_job_artifacts_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default' do + Browse + + .block{ class: ("block-first" if !@build.coverage && !(can?(current_user, :read_build, @project) && (@build.artifacts? || @build.artifacts_expired?))) } + .title + Job details + - if can?(current_user, :update_build, @build) && @build.retryable? + = link_to "Retry job", retry_namespace_project_job_path(@project.namespace, @project, @build), class: 'pull-right retry-link', method: :post + - if @build.merge_request + %p.build-detail-row + %span.build-light-text Merge Request: + = link_to "#{@build.merge_request.to_reference}", merge_request_path(@build.merge_request), class: 'bold' + - if @build.duration + %p.build-detail-row + %span.build-light-text Duration: + = time_interval_in_words(@build.duration) + - if @build.finished_at + %p.build-detail-row + %span.build-light-text Finished: + #{time_ago_with_tooltip(@build.finished_at)} + - if @build.erased_at + %p.build-detail-row + %span.build-light-text Erased: + #{time_ago_with_tooltip(@build.erased_at)} + %p.build-detail-row + %span.build-light-text Runner: + - if @build.runner && current_user && current_user.admin + = link_to "##{@build.runner.id}", admin_runner_path(@build.runner.id) + - elsif @build.runner + \##{@build.runner.id} + .btn-group.btn-group-justified{ role: :group } + - if @build.has_trace? + = link_to 'Raw', raw_namespace_project_job_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default' + - if @build.active? + = link_to "Cancel", cancel_namespace_project_job_path(@project.namespace, @project, @build), class: 'btn btn-sm btn-default', method: :post + - if can?(current_user, :update_build, @project) && @build.erasable? + = link_to erase_namespace_project_job_path(@project.namespace, @project, @build), + class: "btn btn-sm btn-default", method: :post, + data: { confirm: "Are you sure you want to erase this build?" } do + Erase + + - if @build.trigger_request + .build-widget + %h4.title + Trigger + + %p + %span.build-light-text Token: + #{@build.trigger_request.trigger.short_token} + + - if @build.trigger_request.variables + %p + %button.btn.group.btn-group-justified.reveal-variables Reveal Variables + + + - @build.trigger_request.variables.each do |key, value| + .hide.js-build + .js-build-variable= key + .js-build-value= value + + .block + .title + Commit title + %p.build-light-text.append-bottom-0 + #{@build.pipeline.git_commit_title} + + - if @build.tags.any? + .block + .title + Tags + - @build.tag_list.each do |tag| + %span.label.label-primary + = tag + + - if @build.pipeline.stages_count > 1 + .dropdown.build-dropdown + .title Stage + %button.dropdown-menu-toggle{ type: 'button', 'data-toggle' => 'dropdown' } + %span.stage-selection More + = icon('chevron-down') + %ul.dropdown-menu + - @build.pipeline.stages.each do |stage| + %li + %a.stage-item= stage.name + + .builds-container + - HasStatus::ORDERED_STATUSES.each do |build_status| + - builds.select{|build| build.status == build_status}.each do |build| + .build-job{ class: sidebar_build_class(build, @build), data: { stage: build.stage } } + = link_to namespace_project_job_path(@project.namespace, @project, build) do + = icon('arrow-right') + %span{ class: "ci-status-icon-#{build.status}" } + = ci_icon_for_status(build.status) + %span + - if build.name + = build.name + - else + = build.id + - if build.retried? + %i.fa.fa-refresh.has-tooltip{ data: { container: 'body', placement: 'bottom' }, title: 'Job was retried' } + +:javascript + new Sidebar(); diff --git a/app/views/projects/jobs/_table.html.haml b/app/views/projects/jobs/_table.html.haml new file mode 100644 index 00000000000..82806f022ee --- /dev/null +++ b/app/views/projects/jobs/_table.html.haml @@ -0,0 +1,25 @@ +- admin = local_assigns.fetch(:admin, false) + +- if builds.blank? + %div + .nothing-here-block No jobs to show +- else + .table-holder + %table.table.ci-table.builds-page + %thead + %tr + %th Status + %th Job + %th Pipeline + - if admin + %th Project + %th Runner + %th Stage + %th Name + %th + %th Coverage + %th + + = render partial: "projects/ci/builds/build", collection: builds, as: :build, locals: { commit_sha: true, ref: true, pipeline_link: true, stage: true, allow_retry: true, admin: admin } + + = paginate builds, theme: 'gitlab' diff --git a/app/views/projects/jobs/_user.html.haml b/app/views/projects/jobs/_user.html.haml new file mode 100644 index 00000000000..83f299da651 --- /dev/null +++ b/app/views/projects/jobs/_user.html.haml @@ -0,0 +1,7 @@ +by +%a{ href: user_path(@build.user) } + %span.hidden-xs + = image_tag avatar_icon(@build.user, 24), class: "avatar s24" + %strong{ data: { toggle: 'tooltip', placement: 'top', title: @build.user.to_reference } } + = @build.user.name + %strong.visible-xs-inline= @build.user.to_reference diff --git a/app/views/projects/jobs/index.html.haml b/app/views/projects/jobs/index.html.haml new file mode 100644 index 00000000000..70b53e4ca77 --- /dev/null +++ b/app/views/projects/jobs/index.html.haml @@ -0,0 +1,23 @@ +- @no_container = true +- page_title "Jobs" += render "projects/pipelines/head" + +%div{ class: container_class } + .top-area + - build_path_proc = ->(scope) { project_jobs_path(@project, scope: scope) } + = render "shared/builds/tabs", build_path_proc: build_path_proc, all_builds: @all_builds, scope: @scope + + .nav-controls + - if can?(current_user, :update_build, @project) + - if @all_builds.running_or_pending.any? + = link_to 'Cancel running', cancel_all_namespace_project_jobs_path(@project.namespace, @project), + data: { confirm: 'Are you sure?' }, class: 'btn btn-danger', method: :post + + - unless @repository.gitlab_ci_yml + = link_to 'Get started with CI/CD Pipelines', help_page_path('ci/quick_start/README'), class: 'btn btn-info' + + = link_to ci_lint_path, class: 'btn btn-default' do + %span CI lint + + .content-list.builds-content-list + = render "table", builds: @builds, project: @project diff --git a/app/views/projects/jobs/show.html.haml b/app/views/projects/jobs/show.html.haml new file mode 100644 index 00000000000..113da4d7a0c --- /dev/null +++ b/app/views/projects/jobs/show.html.haml @@ -0,0 +1,86 @@ +- @no_container = true +- page_title "#{@build.name} (##{@build.id})", "Jobs" += render "projects/pipelines/head" + +%div{ class: container_class } + .build-page + = render "header" + + - if @build.stuck? + - unless @build.any_runners_online? + .bs-callout.bs-callout-warning + %p + - if no_runners_for_project?(@build.project) + This job is stuck, because the project doesn't have any runners online assigned to it. + - elsif @build.tags.any? + This job is stuck, because you don't have any active runners online with any of these tags assigned to them: + - @build.tags.each do |tag| + %span.label.label-primary + = tag + - else + This job is stuck, because you don't have any active runners that can run this job. + + %br + Go to + = link_to namespace_project_runners_path(@build.project.namespace, @build.project) do + Runners page + + - if @build.starts_environment? + .prepend-top-default + .environment-information + - if @build.outdated_deployment? + = ci_icon_for_status('success_with_warnings') + - else + = ci_icon_for_status(@build.status) + + - environment = environment_for_build(@build.project, @build) + - if @build.success? && @build.last_deployment.present? + - if @build.last_deployment.last? + This job is the most recent deployment to #{environment_link_for_build(@build.project, @build)}. + - else + This job is an out-of-date deployment to #{environment_link_for_build(@build.project, @build)}. + View the most recent deployment #{deployment_link(environment.last_deployment)}. + - elsif @build.complete? && !@build.success? + The deployment of this job to #{environment_link_for_build(@build.project, @build)} did not succeed. + - else + This job is creating a deployment to #{environment_link_for_build(@build.project, @build)} + - if environment.try(:last_deployment) + and will overwrite the #{deployment_link(environment.last_deployment, text: 'latest deployment')} + + .prepend-top-default + - if @build.erased? + .erased.alert.alert-warning + - if @build.erased_by_user? + Job has been erased by #{link_to(@build.erased_by_name, user_path(@build.erased_by))} #{time_ago_with_tooltip(@build.erased_at)} + - else + Job has been erased #{time_ago_with_tooltip(@build.erased_at)} + - else + #js-build-scroll.scroll-controls + .scroll-step + %a.scroll-link.scroll-top{ href: '#up-build-trace', id: 'scroll-top', title: 'Scroll to top' } + = custom_icon('scroll_up') + = custom_icon('scroll_up_hover_active') + %a.scroll-link.scroll-bottom{ href: '#down-build-trace', id: 'scroll-bottom', title: 'Scroll to bottom' } + = custom_icon('scroll_down') + = custom_icon('scroll_down_hover_active') + - if @build.active? + .autoscroll-container + %span.status-message#autoscroll-status{ data: { state: 'disabled' } } + %span.status-text Autoscroll active + %i.status-icon + = custom_icon('scroll_down_hover_active') + #up-build-trace + %pre.build-trace#build-trace + .js-truncated-info.truncated-info.hidden< + Showing last + %span.js-truncated-info-size.truncated-info-size>< + KiB of log - + %a.js-raw-link.raw-link{ :href => raw_namespace_project_job_path(@project.namespace, @project, @build) }>< Complete Raw + %code.bash.js-build-output + .build-loader-animation.js-build-refresh + + #down-build-trace + + = render "sidebar" + +.js-build-options{ data: javascript_build_options } diff --git a/app/views/projects/pipelines/_head.html.haml b/app/views/projects/pipelines/_head.html.haml index db9d77dba16..a33da149c62 100644 --- a/app/views/projects/pipelines/_head.html.haml +++ b/app/views/projects/pipelines/_head.html.haml @@ -11,7 +11,7 @@ - if project_nav_tab? :builds = nav_link(controller: [:builds, :artifacts]) do - = link_to project_builds_path(@project), title: 'Jobs', class: 'shortcuts-builds' do + = link_to project_jobs_path(@project), title: 'Jobs', class: 'shortcuts-builds' do %span Jobs diff --git a/app/views/projects/pipelines/_with_tabs.html.haml b/app/views/projects/pipelines/_with_tabs.html.haml index 075ddc0025c..fd2f2c4c72c 100644 --- a/app/views/projects/pipelines/_with_tabs.html.haml +++ b/app/views/projects/pipelines/_with_tabs.html.haml @@ -55,5 +55,5 @@ %span.stage = build.stage.titleize %span.build-name - = link_to build.name, pipeline_build_url(pipeline, build) + = link_to build.name, pipeline_job_url(pipeline, build) %pre.build-log= build_summary(build, skip: index >= 10) -- cgit v1.2.1