summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-08-17 12:08:45 +0100
committerKamil Trzcinski <ayufan@ayufan.eu>2016-08-17 12:08:45 +0100
commit49e7070adfcb281938a43aceeb52cc0257601e1d (patch)
tree46a2dd6c907e8e1b030b6c576f05a8be5e4c7736
parentae5ec7918a7d6c13f0b4a6b1fd5a168646b39327 (diff)
downloadgitlab-ce-49e7070adfcb281938a43aceeb52cc0257601e1d.tar.gz
Add support for Play and Created jobs
-rw-r--r--app/helpers/ci_status_helper.rb26
-rw-r--r--app/views/projects/ci/builds/_build_pipeline.html.haml22
-rw-r--r--app/views/projects/commit/_pipeline.html.haml14
-rw-r--r--app/views/projects/generic_commit_statuses/_generic_commit_status_pipeline.html.haml14
4 files changed, 41 insertions, 35 deletions
diff --git a/app/helpers/ci_status_helper.rb b/app/helpers/ci_status_helper.rb
index ea2f5f9281a..573cdef767e 100644
--- a/app/helpers/ci_status_helper.rb
+++ b/app/helpers/ci_status_helper.rb
@@ -38,6 +38,10 @@ module CiStatusHelper
'icon_status_pending'
when 'running'
'icon_status_running'
+ when 'play'
+ 'icon_status_warning'
+ when 'created'
+ 'icon_status_pending'
else
'icon_status_cancel'
end
@@ -48,13 +52,13 @@ module CiStatusHelper
def render_commit_status(commit, tooltip_placement: 'auto left')
project = commit.project
path = builds_namespace_project_commit_path(project.namespace, project, commit)
- render_status_with_link('commit', commit.status, path, tooltip_placement)
+ render_status_with_link('commit', commit.status, path, tooltip_placement: tooltip_placement)
end
def render_pipeline_status(pipeline, tooltip_placement: 'auto left')
project = pipeline.project
path = namespace_project_pipeline_path(project.namespace, project, pipeline)
- render_status_with_link('pipeline', pipeline.status, path, tooltip_placement)
+ render_status_with_link('pipeline', pipeline.status, path, tooltip_placement: tooltip_placement)
end
def no_runners_for_project?(project)
@@ -62,13 +66,17 @@ module CiStatusHelper
Ci::Runner.shared.blank?
end
- private
+ def render_status_with_link(type, status, path = nil, tooltip_placement: 'auto left', cssclass: '')
+ klass = "ci-status-link ci-status-icon-#{status.dasherize} #{cssclass}"
+ title = "#{type.titleize}: #{ci_label_for_status(status)}"
+ data = { toggle: 'tooltip', placement: tooltip_placement }
- def render_status_with_link(type, status, path, tooltip_placement, cssclass: '')
- link_to ci_icon_for_status(status),
- path,
- class: "ci-status-link ci-status-icon-#{status.dasherize} #{cssclass}",
- title: "#{type.titleize}: #{ci_label_for_status(status)}",
- data: { toggle: 'tooltip', placement: tooltip_placement }
+ if path
+ link_to ci_icon_for_status(status), path,
+ class: klass, title: title, data: data
+ else
+ content_tag :span, ci_icon_for_status(status),
+ class: klass, title: title, data: data
+ end
end
end
diff --git a/app/views/projects/ci/builds/_build_pipeline.html.haml b/app/views/projects/ci/builds/_build_pipeline.html.haml
index 5149d75e5a2..8c8e0efc60f 100644
--- a/app/views/projects/ci/builds/_build_pipeline.html.haml
+++ b/app/views/projects/ci/builds/_build_pipeline.html.haml
@@ -1,12 +1,14 @@
%li.build
.build-content
- %span{class: "ci-status-link ci-status-icon-#{subject.status}"}
- - if subject.playable? && can?(current_user, :update_build, @project)
- = link_to play_namespace_project_build_path(subject.project.namespace, subject.project, subject, return_to: request.original_url), method: :post, title: 'Play' do
- = icon('play')
- - elsif can?(current_user, :read_build, @project) && subject.started?
- = link_to namespace_project_build_path(subject.project.namespace, subject.project, subject) do
- = ci_icon_for_status(subject.status)
- - else
- = ci_icon_for_status(subject.status)
- = subject.name
+ - if subject.playable? && can?(current_user, :update_build, @project)
+ = link_to play_namespace_project_build_path(subject.project.namespace, subject.project, subject, return_to: request.original_url), method: :post, title: 'Play' do
+ = render_status_with_link('build', 'play')
+ = subject.name
+ - elsif can?(current_user, :read_build, @project)
+ = link_to namespace_project_build_path(subject.project.namespace, subject.project, subject) do
+ = render_status_with_link('build', subject.status)
+ = subject.name
+ - else
+ = render_status_with_link('build', subject.status)
+ = ci_icon_for_status(subject.status)
+
diff --git a/app/views/projects/commit/_pipeline.html.haml b/app/views/projects/commit/_pipeline.html.haml
index 44250860020..9fa54057823 100644
--- a/app/views/projects/commit/_pipeline.html.haml
+++ b/app/views/projects/commit/_pipeline.html.haml
@@ -30,9 +30,8 @@
.row-content-block.build-content.middle-block.pipeline-graph
.pipeline-visualization
%ul.stage-column-list
- - pipeline.statuses.stages.each do |stage|
- - statuses = pipeline.statuses.where(stage: stage)
- - status = statuses.latest.status
+ - stages = pipeline.stages_with_latest_statuses
+ - stages.each do |stage, statuses|
%li.stage-column
.stage-name
%a{name: stage}
@@ -40,12 +39,9 @@
= stage.titleize
.builds-container
%ul
- - statuses.each do |build|
- %li.build
- .build-content
- %span{class: "ci-status-link ci-status-icon-#{status}"}
- = ci_icon_for_status(status)
- = link_to build.name, namespace_project_build_url(build.project.namespace, build.project, build)
+ - statuses.each do |status|
+ = render "projects/#{status.to_partial_path}_pipeline", subject: status
+
- if pipeline.yaml_errors.present?
.bs-callout.bs-callout-danger
diff --git a/app/views/projects/generic_commit_statuses/_generic_commit_status_pipeline.html.haml b/app/views/projects/generic_commit_statuses/_generic_commit_status_pipeline.html.haml
index 760918b18a3..584c0fa18ae 100644
--- a/app/views/projects/generic_commit_statuses/_generic_commit_status_pipeline.html.haml
+++ b/app/views/projects/generic_commit_statuses/_generic_commit_status_pipeline.html.haml
@@ -1,9 +1,9 @@
%li.build
.build-content
- %span{class: "ci-status-link ci-status-icon-#{subject.status}"}
- - if subject.target_url
- - link_to subject.target_url do
- = ci_icon_for_status(subject.status)
- - else
- = ci_icon_for_status(subject.status)
- = subject.name
+ - if subject.target_url
+ - link_to subject.target_url do
+ = render_status_with_link('commit status', subject.status)
+ = subject.name
+ - else
+ = render_status_with_link('commit status', subject.status)
+ = subject.name