diff options
author | Jacob Schatz <jschatz@gitlab.com> | 2016-05-25 14:51:20 +0300 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-05-25 16:00:03 +0300 |
commit | 820c1c3abc80570e7d87a442670df4c8305c267b (patch) | |
tree | cb486647f821d54ff40a86e9db14fb2ad9056235 | |
parent | 4e8798eef0076ee9486f61ad14094c68334c45d1 (diff) |
Merge branch 'incremental-fixes' into 'master'
Fix concurrent request when updating build log in browser
If you have a slow internet connection the trace will not be updated correctly. We need to check if our request is the latest one.
Fixes: https://gitlab.com/gitlab-org/gitlab-ce/issues/17535
See merge request !4183
-rw-r--r-- | CHANGELOG | 9 | ||||
-rw-r--r-- | app/assets/javascripts/ci/build.coffee | 7 | ||||
-rw-r--r-- | lib/ci/ansi2html.rb | 4 | ||||
-rw-r--r-- | spec/lib/ci/ansi2html_spec.rb | 9 |
4 files changed, 26 insertions, 3 deletions
diff --git a/CHANGELOG b/CHANGELOG index f5a4ae89278..fc14bd42ad6 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -10,6 +10,15 @@ v 8.8.2 - Fixed issue with merge button color. !4211 - Fixed issue with enter key selecting wrong option in dropdown. !4210 - When creating a .gitignore file a dropdown with templates will be provided. !4075 +v 8.9.0 (unreleased) + - Redesign navigation for project pages + - Use gitlab-shell v3.0.0 + - Changed the Slack build message to use the singular duration if necessary (Aran Koning) + +v 8.8.2 (unreleased) + - Fix Error 500 when accessing application settings due to nil disabled OAuth sign-in sources + - Fix Error 500 in CI charts by gracefully handling commits with no durations + - Fix concurrent request when updating build log in browser v 8.8.1 - Add documentation for the "Health Check" feature diff --git a/app/assets/javascripts/ci/build.coffee b/app/assets/javascripts/ci/build.coffee index fca0c3bae5c..98d05e41273 100644 --- a/app/assets/javascripts/ci/build.coffee +++ b/app/assets/javascripts/ci/build.coffee @@ -28,12 +28,15 @@ class CiBuild # CiBuild.interval = setInterval => if window.location.href.split("#").first() is build_url + last_state = @state $.ajax url: build_url + "/trace.json?state=" + encodeURIComponent(@state) dataType: "json" success: (log) => - @state = log.state - if log.status is "running" + return unless last_state is @state + + if log.state and log.status is "running" + @state = log.state if log.append $('.fa-refresh').before log.html else diff --git a/lib/ci/ansi2html.rb b/lib/ci/ansi2html.rb index 5fed43aaebd..2f817c13ac4 100644 --- a/lib/ci/ansi2html.rb +++ b/lib/ci/ansi2html.rb @@ -90,7 +90,7 @@ module Ci def convert(raw, new_state) reset_state - restore_state(raw, new_state) if new_state + restore_state(raw, new_state) if new_state.present? start = @offset ansi = raw[@offset..-1] @@ -105,6 +105,8 @@ module Ci break elsif s.scan(/</) @out << '<' + elsif s.scan(/\n/) + @out << '<br>' else @out << s.scan(/./m) end diff --git a/spec/lib/ci/ansi2html_spec.rb b/spec/lib/ci/ansi2html_spec.rb index 04afbd06929..898f1e84ab0 100644 --- a/spec/lib/ci/ansi2html_spec.rb +++ b/spec/lib/ci/ansi2html_spec.rb @@ -175,5 +175,14 @@ describe Ci::Ansi2html, lib: true do it_behaves_like 'stateable converter' end + + context 'with new line' do + let(:pre_text) { "Hello\r" } + let(:pre_html) { "Hello\r" } + let(:text) { "\nWorld" } + let(:html) { "<br>World" } + + it_behaves_like 'stateable converter' + end end end |