diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-09-07 14:52:13 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-09-07 14:52:13 +0200 |
commit | d392f147fc2b08cf3139e2cce2a264eaf0bc4a48 (patch) | |
tree | 58a2ae5d0a935545806aa3c2a7577fc86a026c3d | |
parent | 1d5488699678d22644d24add4b89cede0419ad25 (diff) | |
download | gitlab-ce-d392f147fc2b08cf3139e2cce2a264eaf0bc4a48.tar.gz |
Group similar builds
-rw-r--r-- | app/models/commit_status.rb | 4 | ||||
-rw-r--r-- | app/views/projects/commit/_pipeline.html.haml | 9 | ||||
-rw-r--r-- | app/views/projects/commit/_pipeline_grouped_status.html.haml | 12 | ||||
-rw-r--r-- | db/fixtures/development/14_pipelines.rb | 10 |
4 files changed, 30 insertions, 5 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 4a628924499..af739342256 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -95,6 +95,10 @@ class CommitStatus < ActiveRecord::Base pipeline.before_sha || Gitlab::Git::BLANK_SHA end + def group_name + name.gsub(/\d+[\s:]+\d+\s*/, '') + end + def self.stages # We group by stage name, but order stages by theirs' index unscoped.from(all, :sg).group('stage').order('max(stage_idx)', 'stage').pluck('sg.stage') diff --git a/app/views/projects/commit/_pipeline.html.haml b/app/views/projects/commit/_pipeline.html.haml index 20a85148ab5..a330c14061f 100644 --- a/app/views/projects/commit/_pipeline.html.haml +++ b/app/views/projects/commit/_pipeline.html.haml @@ -39,8 +39,13 @@ = stage.titleize .builds-container %ul - - statuses.each do |status| - = render "projects/#{status.to_partial_path}_pipeline", subject: status + - status_groups = statuses.group_by(&:group_name) + - status_groups.each do |group_name, grouped_statuses| + - if grouped_statuses.one? + - status = grouped_statuses.first + = render "projects/#{status.to_partial_path}_pipeline", subject: status + - else + = render "projects/commit/pipeline_grouped_status", name: group_name, subject: grouped_statuses - if pipeline.yaml_errors.present? diff --git a/app/views/projects/commit/_pipeline_grouped_status.html.haml b/app/views/projects/commit/_pipeline_grouped_status.html.haml new file mode 100644 index 00000000000..7e02703f0a6 --- /dev/null +++ b/app/views/projects/commit/_pipeline_grouped_status.html.haml @@ -0,0 +1,12 @@ +%li.build + .curve + .build-content + - group_status = CommitStatus.where(id: subject).status + = render_status_with_link('build', group_status) + %span.ci-status-text + = name + = subject.length + + // Access all other grouped statuses + //- subject.each do |status| + // = render "projects/#{status.to_partial_path}_pipeline", subject: status diff --git a/db/fixtures/development/14_pipelines.rb b/db/fixtures/development/14_pipelines.rb index 49e6e2361b1..650b410595c 100644 --- a/db/fixtures/development/14_pipelines.rb +++ b/db/fixtures/development/14_pipelines.rb @@ -3,9 +3,13 @@ class Gitlab::Seeder::Pipelines BUILDS = [ { name: 'build:linux', stage: 'build', status: :success }, { name: 'build:osx', stage: 'build', status: :success }, - { name: 'rspec:linux', stage: 'test', status: :success }, - { name: 'rspec:windows', stage: 'test', status: :success }, - { name: 'rspec:windows', stage: 'test', status: :success }, + { name: 'rspec:linux 0 3', stage: 'test', status: :success }, + { name: 'rspec:linux 1 3', stage: 'test', status: :success }, + { name: 'rspec:linux 2 3', stage: 'test', status: :success }, + { name: 'rspec:windows 0 3', stage: 'test', status: :success }, + { name: 'rspec:windows 1 3', stage: 'test', status: :success }, + { name: 'rspec:windows 2 3', stage: 'test', status: :success }, + { name: 'rspec:windows 2 3', stage: 'test', status: :success }, { name: 'rspec:osx', stage: 'test', status_event: :success }, { name: 'spinach:linux', stage: 'test', status: :success }, { name: 'spinach:osx', stage: 'test', status: :failed, allow_failure: true}, |