Commit e2d5818e authored by Toon Claes's avatar Toon Claes

Show pipeline creator & created_at in heading

Instead of showing the commit author & authored_date that triggered
the pipeline, show the user and created_at in the heading of the
pipeline show.
parent 0068c449
.page-content-header .page-content-header
.header-main-content .header-main-content
= render 'ci/status/badge', status: @pipeline.detailed_status(current_user) = render 'ci/status/badge', status: @pipeline.detailed_status(current_user)
%strong Pipeline ##{@commit.pipelines.last.id} %strong Pipeline ##{@pipeline.id}
triggered #{time_ago_with_tooltip(@commit.authored_date)} by triggered #{time_ago_with_tooltip(@pipeline.created_at)}
= author_avatar(@commit, size: 24) - if @pipeline.user
= commit_author_link(@commit) by
= user_avatar(user: @pipeline.user, size: 24, css_class: 'hidden-xs')
= link_to(@pipeline.user.name, user_path(@pipeline.user.username), title: @pipeline.user.email, class: 'has-tooltip commit-committer-link')
.header-action-buttons .header-action-buttons
- if can?(current_user, :update_pipeline, @pipeline.project) - if can?(current_user, :update_pipeline, @pipeline.project)
- if @pipeline.retryable? - if @pipeline.retryable?
......
---
title: Show pipeline creator & created_at in heading
merge_request: 9936
author:
...@@ -11,12 +11,15 @@ describe 'Commits' do ...@@ -11,12 +11,15 @@ describe 'Commits' do
stub_ci_pipeline_to_return_yaml_file stub_ci_pipeline_to_return_yaml_file
end end
let(:creator) { create(:user) }
let!(:pipeline) do let!(:pipeline) do
create(:ci_pipeline, create(:ci_pipeline,
project: project, project: project,
user: creator,
ref: project.default_branch, ref: project.default_branch,
sha: project.commit.sha, sha: project.commit.sha,
status: :success) status: :success,
created_at: 5.months.ago)
end end
context 'commit status is Generic Commit Status' do context 'commit status is Generic Commit Status' do
...@@ -80,7 +83,8 @@ describe 'Commits' do ...@@ -80,7 +83,8 @@ describe 'Commits' do
it 'shows pipeline`s data' do it 'shows pipeline`s data' do
expect(page).to have_content pipeline.sha[0..7] expect(page).to have_content pipeline.sha[0..7]
expect(page).to have_content pipeline.git_commit_message expect(page).to have_content pipeline.git_commit_message
expect(page).to have_content pipeline.git_author_name expect(page).to have_content pipeline.user.name
expect(page).to have_content pipeline.created_at.strftime('%b %d, %Y')
end end
end end
...@@ -150,7 +154,7 @@ describe 'Commits' do ...@@ -150,7 +154,7 @@ describe 'Commits' do
it do it do
expect(page).to have_content pipeline.sha[0..7] expect(page).to have_content pipeline.sha[0..7]
expect(page).to have_content pipeline.git_commit_message expect(page).to have_content pipeline.git_commit_message
expect(page).to have_content pipeline.git_author_name expect(page).to have_content pipeline.user.name
expect(page).to have_link('Download artifacts') expect(page).to have_link('Download artifacts')
expect(page).not_to have_link('Cancel running') expect(page).not_to have_link('Cancel running')
expect(page).not_to have_link('Retry') expect(page).not_to have_link('Retry')
...@@ -169,7 +173,7 @@ describe 'Commits' do ...@@ -169,7 +173,7 @@ describe 'Commits' do
it do it do
expect(page).to have_content pipeline.sha[0..7] expect(page).to have_content pipeline.sha[0..7]
expect(page).to have_content pipeline.git_commit_message expect(page).to have_content pipeline.git_commit_message
expect(page).to have_content pipeline.git_author_name expect(page).to have_content pipeline.user.name
expect(page).not_to have_link('Download artifacts') expect(page).not_to have_link('Download artifacts')
expect(page).not_to have_link('Cancel running') expect(page).not_to have_link('Cancel running')
expect(page).not_to have_link('Retry') expect(page).not_to have_link('Retry')
......
...@@ -45,7 +45,7 @@ describe 'Pipeline', :feature, :js do ...@@ -45,7 +45,7 @@ describe 'Pipeline', :feature, :js do
include_context 'pipeline builds' include_context 'pipeline builds'
let(:project) { create(:project) } let(:project) { create(:project) }
let(:pipeline) { create(:ci_pipeline, project: project, ref: 'master', sha: project.commit.id) } let(:pipeline) { create(:ci_pipeline, project: project, ref: 'master', sha: project.commit.id, user: user) }
before { visit namespace_project_pipeline_path(project.namespace, project, pipeline) } before { visit namespace_project_pipeline_path(project.namespace, project, pipeline) }
......
...@@ -3,8 +3,9 @@ require 'spec_helper' ...@@ -3,8 +3,9 @@ require 'spec_helper'
describe 'projects/pipelines/show' do describe 'projects/pipelines/show' do
include Devise::Test::ControllerHelpers include Devise::Test::ControllerHelpers
let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:project) }
let(:pipeline) { create(:ci_empty_pipeline, project: project, sha: project.commit.id) } let(:pipeline) { create(:ci_empty_pipeline, project: project, sha: project.commit.id, user: user) }
before do before do
controller.prepend_view_path('app/views/projects') controller.prepend_view_path('app/views/projects')
...@@ -21,6 +22,7 @@ describe 'projects/pipelines/show' do ...@@ -21,6 +22,7 @@ describe 'projects/pipelines/show' do
assign(:project, project) assign(:project, project)
assign(:pipeline, pipeline) assign(:pipeline, pipeline)
assign(:commit, project.commit)
allow(view).to receive(:can?).and_return(true) allow(view).to receive(:can?).and_return(true)
end end
...@@ -31,6 +33,12 @@ describe 'projects/pipelines/show' do ...@@ -31,6 +33,12 @@ describe 'projects/pipelines/show' do
expect(rendered).to have_css('.js-pipeline-graph') expect(rendered).to have_css('.js-pipeline-graph')
expect(rendered).to have_css('.js-grouped-pipeline-dropdown') expect(rendered).to have_css('.js-grouped-pipeline-dropdown')
# header
expect(rendered).to have_text("##{pipeline.id}")
expect(rendered).to have_css('time', text: pipeline.created_at.strftime("%b %d, %Y"))
expect(rendered).to have_selector(%Q(img[alt$="#{pipeline.user.name}'s avatar"]))
expect(rendered).to have_link(pipeline.user.name, href: user_path(pipeline.user))
# stages # stages
expect(rendered).to have_text('Build') expect(rendered).to have_text('Build')
expect(rendered).to have_text('Test') expect(rendered).to have_text('Test')
......
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