Commit 318b2245 authored by Jacob Schatz's avatar Jacob Schatz

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
parents 019a3c78 24ef7063
...@@ -8,6 +8,7 @@ v 8.9.0 (unreleased) ...@@ -8,6 +8,7 @@ v 8.9.0 (unreleased)
v 8.8.2 (unreleased) v 8.8.2 (unreleased)
- Fix Error 500 when accessing application settings due to nil disabled OAuth sign-in sources - 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 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 v 8.8.1
- Add documentation for the "Health Check" feature - Add documentation for the "Health Check" feature
......
...@@ -28,12 +28,15 @@ class CiBuild ...@@ -28,12 +28,15 @@ class CiBuild
# #
CiBuild.interval = setInterval => CiBuild.interval = setInterval =>
if window.location.href.split("#").first() is build_url if window.location.href.split("#").first() is build_url
last_state = @state
$.ajax $.ajax
url: build_url + "/trace.json?state=" + encodeURIComponent(@state) url: build_url + "/trace.json?state=" + encodeURIComponent(@state)
dataType: "json" dataType: "json"
success: (log) => success: (log) =>
@state = log.state return unless last_state is @state
if log.status is "running"
if log.state and log.status is "running"
@state = log.state
if log.append if log.append
$('.fa-refresh').before log.html $('.fa-refresh').before log.html
else else
......
...@@ -90,7 +90,7 @@ module Ci ...@@ -90,7 +90,7 @@ module Ci
def convert(raw, new_state) def convert(raw, new_state)
reset_state reset_state
restore_state(raw, new_state) if new_state restore_state(raw, new_state) if new_state.present?
start = @offset start = @offset
ansi = raw[@offset..-1] ansi = raw[@offset..-1]
...@@ -105,6 +105,8 @@ module Ci ...@@ -105,6 +105,8 @@ module Ci
break break
elsif s.scan(/</) elsif s.scan(/</)
@out << '&lt;' @out << '&lt;'
elsif s.scan(/\n/)
@out << '<br>'
else else
@out << s.scan(/./m) @out << s.scan(/./m)
end end
......
...@@ -175,5 +175,14 @@ describe Ci::Ansi2html, lib: true do ...@@ -175,5 +175,14 @@ describe Ci::Ansi2html, lib: true do
it_behaves_like 'stateable converter' it_behaves_like 'stateable converter'
end 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
end end
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