Commit 9e68109f authored by Kamil Trzcinski's avatar Kamil Trzcinski

Optimise Merge Request builds rendering

parent 8fb976a3
...@@ -118,7 +118,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -118,7 +118,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@diffs = @merge_request.compare.diffs(diff_options) if @merge_request.compare @diffs = @merge_request.compare.diffs(diff_options) if @merge_request.compare
@ci_commit = @merge_request.ci_commit @ci_commit = @merge_request.ci_commit
@ci_commits = [@ci_commit].compact
@statuses = @ci_commit.statuses if @ci_commit @statuses = @ci_commit.statuses if @ci_commit
@note_counts = Note.where(commit_id: @commits.map(&:id)). @note_counts = Note.where(commit_id: @commits.map(&:id)).
...@@ -311,7 +310,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController ...@@ -311,7 +310,6 @@ class Projects::MergeRequestsController < Projects::ApplicationController
@merge_request_diff = @merge_request.merge_request_diff @merge_request_diff = @merge_request.merge_request_diff
@ci_commit = @merge_request.ci_commit @ci_commit = @merge_request.ci_commit
@ci_commits = [@ci_commit].compact
@statuses = @ci_commit.statuses if @ci_commit @statuses = @ci_commit.statuses if @ci_commit
if @merge_request.locked_long_ago? if @merge_request.locked_long_ago?
......
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
.pull-right .pull-right
- if can?(current_user, :update_build, @project) - if can?(current_user, :update_build, @project)
- if ci_commit.builds.latest.failed.any?(&:retryable?) - if ci_commit.builds.latest.failed.any?(&:retryable?)
= link_to "Retry failed", retry_builds_namespace_project_commit_path(@project.namespace, @project, @commit.id), class: 'btn btn-grouped btn-primary', method: :post = link_to "Retry failed", retry_builds_namespace_project_commit_path(@project.namespace, @project, ci_commit.sha), class: 'btn btn-grouped btn-primary', method: :post
- if ci_commit.builds.running_or_pending.any? - if ci_commit.builds.running_or_pending.any?
= link_to "Cancel running", cancel_builds_namespace_project_commit_path(@project.namespace, @project, @commit.id), data: { confirm: 'Are you sure?' }, class: 'btn btn-grouped btn-danger', method: :post = link_to "Cancel running", cancel_builds_namespace_project_commit_path(@project.namespace, @project, ci_commit.sha), data: { confirm: 'Are you sure?' }, class: 'btn btn-grouped btn-danger', method: :post
.oneline .oneline
= pluralize ci_commit.statuses.count(:id), "build" = pluralize ci_commit.statuses.count(:id), "build"
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
= ci_commit.ref = ci_commit.ref
- if defined?(link_to_commit) && link_to_commit - if defined?(link_to_commit) && link_to_commit
for commit for commit
= link_to @commit.short_id, namespace_project_commit_path(@project.namespace, @project, @commit.id), class: "monospace" = link_to ci_commit.short_sha, namespace_project_commit_path(@project.namespace, @project, ci_commit.sha), class: "monospace"
- if ci_commit.duration > 0 - if ci_commit.duration > 0
in in
= time_interval_in_words ci_commit.duration = time_interval_in_words ci_commit.duration
......
= render "projects/commit/builds", link_to_commit: true = render "projects/commit/ci_commit", ci_commit: @ci_commit, link_to_commit: true
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment