summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-05-09 23:39:48 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2016-05-09 23:39:48 +0300
commit1ad0c968d579fe6ac0b2fc00a1dae32449ceb2c3 (patch)
treed2fdd097dc4f529f723066ba508938b601d81935
parentcb90368a692149b4e01b50d7c6682c48cffa438b (diff)
downloadgitlab-ce-1ad0c968d579fe6ac0b2fc00a1dae32449ceb2c3.tar.gz
Make a build views nicer
-rw-r--r--app/models/commit_status.rb2
-rw-r--r--app/views/projects/ci/builds/_build.html.haml52
-rw-r--r--app/views/projects/ci/commits/_commit.html.haml6
-rw-r--r--app/views/projects/commit/_ci_commit.html.haml28
-rw-r--r--app/views/projects/pipelines/index.html.haml7
5 files changed, 61 insertions, 34 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb
index aa56314aa16..c0ae30820ee 100644
--- a/app/models/commit_status.rb
+++ b/app/models/commit_status.rb
@@ -89,7 +89,7 @@ class CommitStatus < ActiveRecord::Base
def self.stages
order_by = 'max(stage_idx)'
- group('stage').order(order_by).pluck(:stage, order_by).map(&:first).compact
+ CommitStatus.where(id: all).group('stage').order(order_by).pluck(:stage, order_by).map(&:first).compact
end
def self.stages_status
diff --git a/app/views/projects/ci/builds/_build.html.haml b/app/views/projects/ci/builds/_build.html.haml
index 745ff461d76..7e7e54c68a3 100644
--- a/app/views/projects/ci/builds/_build.html.haml
+++ b/app/views/projects/ci/builds/_build.html.haml
@@ -42,25 +42,43 @@
%td
= build.name
- .label-container
- - if build.tags.any?
- - build.tags.each do |tag|
- %span.label.label-primary
- = tag
- - if build.try(:trigger_request)
- %span.label.label-info triggered
- - if build.try(:allow_failure)
- %span.label.label-danger allowed to fail
- - if defined?(retried) && retried
- %span.label.label-warning retried
+ .pull-right
+ .label-container
+ - if build.tags.any?
+ - build.tags.each do |tag|
+ %span.label.label-primary
+ = tag
+ - if build.try(:trigger_request)
+ %span.label.label-info triggered
+ - if build.try(:allow_failure)
+ %span.label.label-danger allowed to fail
+ - if defined?(retried) && retried
+ %span.label.label-warning retried
- %td.duration
- - if build.duration
- #{duration_in_words(build.finished_at, build.started_at)}
+ - if defined?(new_duration) && new_duration
+ %td.duration
+ - if build.duration
+ %p
+ %i.fa.fa-clock-o
+ &nbsp;
+ #{duration_in_words(build.finished_at, build.started_at)}
+ - if build.finished_at
+ %p
+ %i.fa.fa-calendar
+ &nbsp;
+ #{time_ago_with_tooltip(build.finished_at)}
+ - else
+ %td.duration
+ - if build.duration
+ %i.fa.fa-clock-o
+ &nbsp;
+ #{duration_in_words(build.finished_at, build.started_at)}
- %td.timestamp
- - if build.finished_at
- %span #{time_ago_with_tooltip(build.finished_at)}
+ %td.timestamp
+ - if build.finished_at
+ %i.fa.fa-calendar
+ &nbsp;
+ %span #{time_ago_with_tooltip(build.finished_at)}
- if defined?(coverage) && coverage
%td.coverage
diff --git a/app/views/projects/ci/commits/_commit.html.haml b/app/views/projects/ci/commits/_commit.html.haml
index 32f85cb8f8c..d5dd6c7b0aa 100644
--- a/app/views/projects/ci/commits/_commit.html.haml
+++ b/app/views/projects/ci/commits/_commit.html.haml
@@ -35,7 +35,8 @@
- stages.each do |stage|
%td
- if status = stages_status[stage]
- %span.has-tooltip(title="#{stage.titleize}: #{status}"){class: "ci-status-icon-#{status}"}
+ - tooltip = "#{stage.titleize}: #{status}"
+ %span.has-tooltip(title="#{tooltip}"){class: "ci-status-icon-#{status}"}
= ci_icon_for_status(status)
%td
@@ -52,7 +53,7 @@
%td
.controls.hidden-xs.pull-right
- - artifacts = commit.builds.latest
+ - artifacts = commit.builds.latest.select { |b| b.artifacts? }
- if artifacts.present?
.dropdown.inline
%button.dropdown-toggle.btn{type: 'button', 'data-toggle' => 'dropdown'}
@@ -66,6 +67,7 @@
%span #{build.name}
- if can?(current_user, :update_pipeline, @project)
+ &nbsp;
- if commit.retryable? && commit.builds.failed.any?
= link_to retry_namespace_project_pipeline_path(@project.namespace, @project, commit.id), class: 'btn has-tooltip', title: "Retry", method: :post do
= icon("repeat")
diff --git a/app/views/projects/commit/_ci_commit.html.haml b/app/views/projects/commit/_ci_commit.html.haml
index 21a30080868..ba0baa1e2a2 100644
--- a/app/views/projects/commit/_ci_commit.html.haml
+++ b/app/views/projects/commit/_ci_commit.html.haml
@@ -36,17 +36,19 @@
.table-holder
%table.table.builds
- %thead
- %tr
- %th Status
- %th Build ID
- %th Stage
- %th Name
- %th Duration
- %th Finished at
- - if @project.build_coverage_enabled?
- %th Coverage
- %th
- builds = ci_commit.statuses.latest.ordered
- = render builds, coverage: @project.build_coverage_enabled?, stage: true, ref: false, allow_retry: true
- = render ci_commit.retried, coverage: @project.build_coverage_enabled?, stage: true, ref: false, retried: true
+ - CommitStatus.where(id: builds).stages.each do |stage|
+ - stage_builds = builds.where(stage: stage)
+ %tr
+ %th{colspan: 10}
+ %strong
+ - stage_status = CommitStatus.where(id: stage_builds.ids).status
+ %span{class: "ci-status-link ci-status-icon-#{stage_status}"}
+ = ci_icon_for_status(stage_status)
+ &nbsp;
+ = stage.titleize.pluralize
+ = render stage_builds, coverage: @project.build_coverage_enabled?, tage: false, ref: false, allow_retry: true
+ = render ci_commit.retried.select { |build| build.stage == stage }, coverage: @project.build_coverage_enabled?, stage: false, ref: false, retried: true
+ %tr
+ %td{colspan: 10}
+ &nbsp;
diff --git a/app/views/projects/pipelines/index.html.haml b/app/views/projects/pipelines/index.html.haml
index 838b2986d4f..0e08753fd3b 100644
--- a/app/views/projects/pipelines/index.html.haml
+++ b/app/views/projects/pipelines/index.html.haml
@@ -38,7 +38,12 @@
%span CI Lint
.gray-content-block
- Pipelines for #{(@scope || 'changes')} on this project
+ - if @scope == 'running'
+ Running pipelines for this project
+ - elsif @scope.nil?
+ Pipelines for this project
+ - else
+ #{@scope.titleize} for this project
%ul.content-list
- stages = @pipelines.stages