diff options
author | Fatih Acet <acetfatih@gmail.com> | 2016-07-20 21:57:01 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-07-21 12:20:16 +0300 |
commit | 7c0d00394af2e37c43eaf4e37e786aa3a12b3375 (patch) | |
tree | 0c710a8716baecccdf23b2551d26bd6a7665c515 /app | |
parent | e31bf4360d31c023afc29d24eb8dfb86d8ee7b78 (diff) |
Merge branch 'cs-warn-on-failure' into 'master'
Warn on failure
## What does this MR do?
Adds styling and HTML for a `success_with_warnings` status in the MR widget. Unfinished as it needs some plumbing in the relevant CI controllers and models.
## Are there points in the code the reviewer needs to double check?
Not at the moment, though I think I'll probably need help getting this to work in the backend.
## What are the relevant issue numbers?
#17669
## Screenshots (if relevant)
![Screen_Shot_2016-06-29_at_12.02.49_PM](/uploads/af4a915689633fe028f44bb34ae7a5b1/Screen_Shot_2016-06-29_at_12.02.49_PM.png)
## Does this MR meet the acceptance criteria?
- [ ] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
- [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
- [ ] API support added
- Tests
- [ ] Added for this feature/bug
- [ ] All builds are passing
- [ ] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [ ] Branch has no merge conflicts with `master` (if you do - rebase it please)
- [ ] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
cc: @ayufan
See merge request !5004
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/merge_request_widget.js.coffee | 15 | ||||
-rw-r--r-- | app/assets/stylesheets/pages/merge_requests.scss | 8 | ||||
-rw-r--r-- | app/assets/stylesheets/pages/status.scss | 8 | ||||
-rw-r--r-- | app/controllers/projects/merge_requests_controller.rb | 2 | ||||
-rw-r--r-- | app/helpers/ci_status_helper.rb | 5 | ||||
-rw-r--r-- | app/models/ci/pipeline.rb | 4 | ||||
-rw-r--r-- | app/views/projects/merge_requests/widget/_heading.html.haml | 2 |
7 files changed, 34 insertions, 10 deletions
diff --git a/app/assets/javascripts/merge_request_widget.js.coffee b/app/assets/javascripts/merge_request_widget.js.coffee index 779f536d9f0..963a0550c35 100644 --- a/app/assets/javascripts/merge_request_widget.js.coffee +++ b/app/assets/javascripts/merge_request_widget.js.coffee @@ -55,10 +55,13 @@ class @MergeRequestWidget $('.mr-state-widget').replaceWith(data) ciLabelForStatus: (status) -> - if status is 'success' - 'passed' - else - status + switch status + when 'success' + 'passed' + when 'success_with_warnings' + 'passed with warnings' + else + status pollCIStatus: -> @fetchBuildStatusInterval = setInterval ( => @@ -116,7 +119,7 @@ class @MergeRequestWidget showCIStatus: (state) -> return if not state? $('.ci_widget').hide() - allowed_states = ["failed", "canceled", "running", "pending", "success", "skipped", "not_found"] + allowed_states = ["failed", "canceled", "running", "pending", "success", "success_with_warnings", "skipped", "not_found"] if state in allowed_states $('.ci_widget.ci-' + state).show() switch state @@ -124,7 +127,7 @@ class @MergeRequestWidget @setMergeButtonClass('btn-danger') when "running" @setMergeButtonClass('btn-warning') - when "success" + when "success", "success_with_warnings" @setMergeButtonClass('btn-create') else $('.ci_widget.ci-error').show() diff --git a/app/assets/stylesheets/pages/merge_requests.scss b/app/assets/stylesheets/pages/merge_requests.scss index 5254faf723d..4e806e60e7e 100644 --- a/app/assets/stylesheets/pages/merge_requests.scss +++ b/app/assets/stylesheets/pages/merge_requests.scss @@ -70,6 +70,14 @@ color: $gl-success; } + &.ci-success_with_warnings { + color: $gl-success; + + i { + color: $gl-warning; + } + } + &.ci-skipped { background-color: #eee; color: #888; diff --git a/app/assets/stylesheets/pages/status.scss b/app/assets/stylesheets/pages/status.scss index a22d4b6f6be..99f64b5e4cc 100644 --- a/app/assets/stylesheets/pages/status.scss +++ b/app/assets/stylesheets/pages/status.scss @@ -15,7 +15,8 @@ border-color: $gl-danger; } - &.ci-success { + &.ci-success, + &.ci-success_with_warnings { color: $gl-success; border-color: $gl-success; } @@ -57,9 +58,12 @@ .ci-status-icon-failed { color: $gl-danger; } - .ci-status-icon-pending { + + .ci-status-icon-pending, + .ci-status-icon-success_with_warning { color: $gl-warning; } + .ci-status-icon-running { color: $blue-normal; } diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index df659bb8c3b..7beeb7d97d0 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -286,6 +286,8 @@ class Projects::MergeRequestsController < Projects::ApplicationController status = pipeline.status coverage = pipeline.try(:coverage) + status = "success_with_warnings" if pipeline.success? && pipeline.has_warnings? + status ||= "preparing" else ci_service = @merge_request.source_project.ci_service diff --git a/app/helpers/ci_status_helper.rb b/app/helpers/ci_status_helper.rb index 59a8365d60b..ffac28f78a0 100644 --- a/app/helpers/ci_status_helper.rb +++ b/app/helpers/ci_status_helper.rb @@ -15,8 +15,11 @@ module CiStatusHelper end def ci_label_for_status(status) - if status == 'success' + case status + when 'success' 'passed' + when 'success_with_warnings' + 'passed with warnings' else status end diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index f0edf3e2731..bce6a992af6 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -151,6 +151,10 @@ module Ci end end + def has_warnings? + builds.latest.ignored.any? + end + def config_processor return nil unless ci_yaml_file return @config_processor if defined?(@config_processor) diff --git a/app/views/projects/merge_requests/widget/_heading.html.haml b/app/views/projects/merge_requests/widget/_heading.html.haml index 489c632ae22..6ef640bb654 100644 --- a/app/views/projects/merge_requests/widget/_heading.html.haml +++ b/app/views/projects/merge_requests/widget/_heading.html.haml @@ -1,6 +1,6 @@ - if @pipeline .mr-widget-heading - - %w[success skipped canceled failed running pending].each do |status| + - %w[success success_with_warnings skipped canceled failed running pending].each do |status| .ci_widget{ class: "ci-#{status}", style: ("display:none" unless @pipeline.status == status) } = ci_icon_for_status(status) %span |