summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-11-07 17:09:53 +0200
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-11-07 17:09:53 +0200
commitc453de895878df7f14f0cc1196d6c6e8b1644eca (patch)
treef2f66754a28468a9a943e185b1b18a04fe8ec34b
parent8323ab8a5b4ea14a63d6b8e7b99588eab690ef1a (diff)
downloadgitlab-ci-c453de895878df7f14f0cc1196d6c6e8b1644eca.tar.gz
Improve commits page UI/UX
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r--app/assets/stylesheets/sections/projects.scss3
-rw-r--r--app/controllers/builds_controller.rb6
-rw-r--r--app/models/commit.rb6
-rw-r--r--app/views/builds/_build.html.haml10
-rw-r--r--app/views/commits/show.html.haml22
5 files changed, 40 insertions, 7 deletions
diff --git a/app/assets/stylesheets/sections/projects.scss b/app/assets/stylesheets/sections/projects.scss
index bad6fd5..cef59c9 100644
--- a/app/assets/stylesheets/sections/projects.scss
+++ b/app/assets/stylesheets/sections/projects.scss
@@ -12,9 +12,6 @@
&.alert{
margin-bottom: 6px;
}
- td {
- border-bottom: 1px solid #fff;
- }
}
}
diff --git a/app/controllers/builds_controller.rb b/app/controllers/builds_controller.rb
index 28d6c06..24f4fd9 100644
--- a/app/controllers/builds_controller.rb
+++ b/app/controllers/builds_controller.rb
@@ -35,7 +35,11 @@ class BuildsController < ApplicationController
def retry
build = Build.retry(@build)
- redirect_to project_build_path(project, build)
+ if params[:return_to]
+ redirect_to params[:return_to]
+ else
+ redirect_to project_build_path(project, build)
+ end
end
def status
diff --git a/app/models/commit.rb b/app/models/commit.rb
index 3d005b1..f698e39 100644
--- a/app/models/commit.rb
+++ b/app/models/commit.rb
@@ -109,6 +109,10 @@ class Commit < ActiveRecord::Base
end
end
+ def retried_builds
+ @retried_builds ||= (builds - builds_without_retry)
+ end
+
def status
if success?
'success'
@@ -152,7 +156,7 @@ class Commit < ActiveRecord::Base
end
def duration
- @duration ||= builds.select(&:duration).sum(&:duration).to_i
+ @duration ||= builds_without_retry.select(&:duration).sum(&:duration).to_i
end
def finished_at
diff --git a/app/views/builds/_build.html.haml b/app/views/builds/_build.html.haml
index 4e04f62..94b9dce 100644
--- a/app/views/builds/_build.html.haml
+++ b/app/views/builds/_build.html.haml
@@ -22,3 +22,13 @@
%td.coverage
- if build.coverage
#{build.coverage}%
+
+ %td
+ - if defined?(controls)
+ .pull-right
+ - if build.active?
+ = link_to cancel_project_build_path(build.project, build, return_to: request.original_url), title: 'Cancel build' do
+ %i.icon-remove.cred
+ - else
+ = link_to retry_project_build_path(build.project, build, return_to: request.original_url), method: :post, title: 'Retry build' do
+ %i.icon-repeat
diff --git a/app/views/commits/show.html.haml b/app/views/commits/show.html.haml
index d42b338..a3c956a 100644
--- a/app/views/commits/show.html.haml
+++ b/app/views/commits/show.html.haml
@@ -1,4 +1,4 @@
-%h3.page-title
+%h4.page-title
= @project.name
@
#{gitlab_commit_link(@project, @commit.sha)}
@@ -62,4 +62,22 @@
%th Finished at
- if @project.coverage_enabled?
%th Coverage
- = render @builds
+ %th
+ = render @commit.builds_without_retry, controls: true
+
+- if @commit.retried_builds.any?
+ %h3
+ Retried builds
+
+ %table.builds
+ %thead
+ %tr
+ %th Status
+ %th Build ID
+ %th Job
+ %th Duration
+ %th Finished at
+ - if @project.coverage_enabled?
+ %th Coverage
+ %th
+ = render @commit.retried_builds