summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2016-11-30 20:49:57 +0000
committerFatih Acet <acetfatih@gmail.com>2016-11-30 20:49:57 +0000
commit37655a853e7e8c6ee33aeb42f8207e1522ad8326 (patch)
tree9241f2eef4a4be6269a1ddfaa8e52dff2bf8ce38
parent7de68c8b7a317fa60ef4d4223399000606d9abbc (diff)
parent9c6eaf8009ea4cb5a4b33610aad32a2da30f3d09 (diff)
downloadgitlab-ce-37655a853e7e8c6ee33aeb42f8207e1522ad8326.tar.gz
Merge branch '24710-fix-generic-commit-status-table-row' into 'master'
Resolve "External statuses not shown correctly on pipeline page" ## What does this MR do? Updates `generic_commit_status/_generic_commit_status.html.haml` template to match the changes made to `ci/builds/_build.html.haml` which had not previously been carried over. ## Testing 1. Ensure updated fixtures are installed (from !7792) so that these changes are made apparent. (check out the !7792 branch if not yet merged into master, then `bundle exec rake db:drop` and `bundle exec rake dev:setup`) 2. Visit a build list page or an individual pipeline page which contains an external build status. 3. The results should look like this: ### Before: ![Screen_Shot_2016-11-28_at_9.11.27_PM](/uploads/ed8c5beb857cd17147dbddf8f5ecab1d/Screen_Shot_2016-11-28_at_9.11.27_PM.png) ### After: ![Screen_Shot_2016-11-28_at_9.12.05_PM](/uploads/9f953a5f14764e336afa4481a917947f/Screen_Shot_2016-11-28_at_9.12.05_PM.png) ## Are there points in the code the reviewer needs to double check? Look for any places where these partials may be rendered to ensure external status match regular build statuses. ## Why was this MR needed? The generic commit status template has been largely overlooked when changes are made to build table rows which should be duplicated in both places. ## Does this MR meet the acceptance criteria? - [x] [Changelog entry](https://docs.gitlab.com/ce/development/changelog.html) added - [x] ~~[Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~ - [x] ~~API support added~~ - Tests - [x] ~~Added for this feature/bug~~ - [ ] All builds are passing - [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html) - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if it does - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) ## What are the relevant issue numbers? Closes #24710 See merge request !7811
-rw-r--r--app/views/projects/ci/builds/_build.html.haml7
-rw-r--r--app/views/projects/generic_commit_statuses/_generic_commit_status.html.haml84
-rw-r--r--changelogs/unreleased/24710-fix-generic-commit-status-table-row.yml4
3 files changed, 56 insertions, 39 deletions
diff --git a/app/views/projects/ci/builds/_build.html.haml b/app/views/projects/ci/builds/_build.html.haml
index 8d9c15d0dc6..e75547c815f 100644
--- a/app/views/projects/ci/builds/_build.html.haml
+++ b/app/views/projects/ci/builds/_build.html.haml
@@ -66,8 +66,6 @@
%td
- if build.project
= link_to build.project.name_with_namespace, admin_namespace_project_path(build.project.namespace, build.project)
-
- - if admin
%td
- if build.try(:runner)
= runner_link(build.runner)
@@ -93,9 +91,8 @@
%span #{time_ago_with_tooltip(build.finished_at)}
%td.coverage
- - if coverage
- - if build.try(:coverage)
- #{build.coverage}%
+ - if coverage && build.try(:coverage)
+ #{build.coverage}%
%td
.pull-right
diff --git a/app/views/projects/generic_commit_statuses/_generic_commit_status.html.haml b/app/views/projects/generic_commit_statuses/_generic_commit_status.html.haml
index 0b99e9f8756..7f751d9ae2e 100644
--- a/app/views/projects/generic_commit_statuses/_generic_commit_status.html.haml
+++ b/app/views/projects/generic_commit_statuses/_generic_commit_status.html.haml
@@ -1,4 +1,12 @@
-%tr.generic_commit_status
+- admin = local_assigns.fetch(:admin, false)
+- ref = local_assigns.fetch(:ref, nil)
+- commit_sha = local_assigns.fetch(:commit_sha, nil)
+- retried = local_assigns.fetch(:retried, false)
+- pipeline_link = local_assigns.fetch(:pipeline_link, false)
+- stage = local_assigns.fetch(:stage, false)
+- coverage = local_assigns.fetch(:coverage, false)
+
+%tr.generic_commit_status{class: ('retried' if retried)}
%td.status
- if can?(current_user, :read_commit_status, generic_commit_status) && generic_commit_status.target_url
= ci_status_with_icon(generic_commit_status.status, generic_commit_status.target_url)
@@ -8,14 +16,35 @@
%td.generic_commit_status-link
- if can?(current_user, :read_commit_status, generic_commit_status) && generic_commit_status.target_url
= link_to generic_commit_status.target_url do
- %strong ##{generic_commit_status.id}
+ %span.build-link ##{generic_commit_status.id}
- else
- %strong ##{generic_commit_status.id}
+ %span.build-link ##{generic_commit_status.id}
- - if defined?(retried) && retried
+ - if ref
+ - if generic_commit_status.ref
+ .icon-container
+ = generic_commit_status.tags.any? ? icon('tag') : icon('code-fork')
+ = link_to generic_commit_status.ref, namespace_project_commits_path(generic_commit_status.project.namespace, generic_commit_status.project, generic_commit_status.ref)
+ - else
+ .light none
+ .icon-container.commit-icon
+ = custom_icon("icon_commit")
+
+ - if commit_sha
+ = link_to generic_commit_status.short_sha, namespace_project_commit_path(generic_commit_status.project.namespace, generic_commit_status.project, generic_commit_status.sha), class: "commit-id monospace"
+
+ - if retried
= icon('warning', class: 'text-warning has-tooltip', title: 'Status was retried.')
- - if defined?(pipeline_link) && pipeline_link
+ .label-container
+ - if generic_commit_status.tags.any?
+ - generic_commit_status.tags.each do |tag|
+ %span.label.label-primary
+ = tag
+ - if retried
+ %span.label.label-warning retried
+
+ - if pipeline_link
%td
= link_to pipeline_path(generic_commit_status.pipeline) do
%span.pipeline-id ##{generic_commit_status.pipeline.id}
@@ -25,25 +54,17 @@
- else
%span.monospace API
- - if defined?(commit_sha) && commit_sha
- %td
- = link_to generic_commit_status.short_sha, namespace_project_commit_path(generic_commit_status.project.namespace, generic_commit_status.project, generic_commit_status.sha), class: "monospace"
-
- - if defined?(ref) && ref
+ - if admin
%td
- - if generic_commit_status.ref
- = link_to generic_commit_status.ref, namespace_project_commits_path(generic_commit_status.project.namespace, generic_commit_status.project, generic_commit_status.ref)
- - else
- .light none
-
- - if defined?(runner) && runner
+ - if generic_commit_status.project
+ = link_to generic_commit_status.project.name_with_namespace, admin_namespace_project_path(generic_commit_status.project.namespace, generic_commit_status.project)
%td
- if generic_commit_status.try(:runner)
= runner_link(generic_commit_status.runner)
- else
.light none
- - if defined?(stage) && stage
+ - if stage
%td
= generic_commit_status.stage
@@ -51,24 +72,19 @@
= generic_commit_status.name
%td
- - if generic_commit_status.tags.any?
- - generic_commit_status.tags.each do |tag|
- %span.label.label-primary
- = tag
- - if defined?(retried) && retried
- %span.label.label-warning retried
-
- %td.duration
- if generic_commit_status.duration
- = icon("clock-o")
- = time_interval_in_words(generic_commit_status.duration)
+ %p.duration
+ = custom_icon("icon_timer")
+ = duration_in_numbers(generic_commit_status.duration)
- %td.timestamp
- if generic_commit_status.finished_at
- = icon("calendar")
- %span #{time_ago_with_tooltip(generic_commit_status.finished_at)}
+ %p.finished-at
+ = icon("calendar")
+ %span #{time_ago_with_tooltip(generic_commit_status.finished_at)}
- - if defined?(coverage) && coverage
- %td.coverage
- - if generic_commit_status.try(:coverage)
- #{generic_commit_status.coverage}%
+ %td.coverage
+ - if coverage && generic_commit_status.try(:coverage)
+ #{generic_commit_status.coverage}%
+
+ %td
+ -# empty column to match number of columns in ci/builds/_build.html.haml
diff --git a/changelogs/unreleased/24710-fix-generic-commit-status-table-row.yml b/changelogs/unreleased/24710-fix-generic-commit-status-table-row.yml
new file mode 100644
index 00000000000..07cb53d5278
--- /dev/null
+++ b/changelogs/unreleased/24710-fix-generic-commit-status-table-row.yml
@@ -0,0 +1,4 @@
+---
+title: Update generic/external build status to match normal build status template
+merge_request: 7811
+author: