summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnnabel Dunstone <annabel.dunstone@gmail.com>2016-08-17 10:06:10 -0500
committerAnnabel Dunstone <annabel.dunstone@gmail.com>2016-08-17 10:09:25 -0500
commit4e66551a6614283f5b085a523bdbfbc552edb976 (patch)
treedd7b18b48e5e14646ea68583a9e6091b59b304d2
parent49e7070adfcb281938a43aceeb52cc0257601e1d (diff)
downloadgitlab-ce-4e66551a6614283f5b085a523bdbfbc552edb976.tar.gz
Add deploy btn in graph; fix JS to toggle one graph at a time if multiple pipelines
-rw-r--r--app/assets/javascripts/pipeline.js.es69
-rw-r--r--app/assets/stylesheets/pages/pipelines.scss8
-rw-r--r--app/helpers/ci_status_helper.rb4
-rw-r--r--app/views/projects/ci/builds/_build_pipeline.html.haml3
4 files changed, 17 insertions, 7 deletions
diff --git a/app/assets/javascripts/pipeline.js.es6 b/app/assets/javascripts/pipeline.js.es6
index 7054199ac89..ae7369004de 100644
--- a/app/assets/javascripts/pipeline.js.es6
+++ b/app/assets/javascripts/pipeline.js.es6
@@ -1,8 +1,11 @@
function toggleGraph() {
- $('.pipeline-graph, .toggle-pipeline-btn').toggleClass('graph-collapsed');
+ const indexOfBtn = $('.toggle-pipeline-btn').index($(this));
- const $btnText = $('.toggle-pipeline-btn .btn-text');
- const graphCollapsed = $('.pipeline-graph').hasClass('graph-collapsed');
+ $($('.pipeline-graph')[indexOfBtn]).toggleClass('graph-collapsed');
+ $($('.toggle-pipeline-btn')[indexOfBtn]).toggleClass('graph-collapsed');
+
+ const $btnText = $($('.toggle-pipeline-btn .btn-text')[indexOfBtn]);
+ const graphCollapsed = $($('.pipeline-graph')[indexOfBtn]).hasClass('graph-collapsed');
graphCollapsed ? $btnText.text('Expand') : $btnText.text('Hide')
}
diff --git a/app/assets/stylesheets/pages/pipelines.scss b/app/assets/stylesheets/pages/pipelines.scss
index ce9e3e95d3d..e49543d661f 100644
--- a/app/assets/stylesheets/pages/pipelines.scss
+++ b/app/assets/stylesheets/pages/pipelines.scss
@@ -298,6 +298,10 @@
width: 150px;
margin-bottom: 10px;
+ &.deployable {
+ background-color: $gray-light;
+ }
+
.build-content {
width: 130px;
white-space: nowrap;
@@ -315,6 +319,10 @@
margin-right: 5px;
}
+ .fa {
+ font-size: 13px;
+ }
+
// Connect first build in each stage with right horizontal line
&:first-child {
&::after {
diff --git a/app/helpers/ci_status_helper.rb b/app/helpers/ci_status_helper.rb
index 573cdef767e..eb385d58e3b 100644
--- a/app/helpers/ci_status_helper.rb
+++ b/app/helpers/ci_status_helper.rb
@@ -39,14 +39,14 @@ module CiStatusHelper
when 'running'
'icon_status_running'
when 'play'
- 'icon_status_warning'
+ 'play'
when 'created'
'icon_status_pending'
else
'icon_status_cancel'
end
- custom_icon(icon_name)
+ status == 'play' ? icon(icon_name + ' fw') : custom_icon(icon_name)
end
def render_commit_status(commit, tooltip_placement: 'auto left')
diff --git a/app/views/projects/ci/builds/_build_pipeline.html.haml b/app/views/projects/ci/builds/_build_pipeline.html.haml
index 8c8e0efc60f..6be75860db2 100644
--- a/app/views/projects/ci/builds/_build_pipeline.html.haml
+++ b/app/views/projects/ci/builds/_build_pipeline.html.haml
@@ -1,4 +1,4 @@
-%li.build
+%li.build{class: ("deployable" if subject.playable? && can?(current_user, :update_build, @project))}
.build-content
- 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
@@ -11,4 +11,3 @@
- else
= render_status_with_link('build', subject.status)
= ci_icon_for_status(subject.status)
-