diff --git a/assets/scripts/app/views/log.coffee b/assets/scripts/app/views/log.coffee
index 1fab0507..d3aa63fe 100644
--- a/assets/scripts/app/views/log.coffee
+++ b/assets/scripts/app/views/log.coffee
@@ -154,8 +154,8 @@ Travis.OrderedLogEngineMixin = Ember.Mixin.create
this.$('#log')[0].appendChild fragment
if cut
- url = Travis.Urls.plainTextLog(@get('log.id'))
- this.$("#log").append $("
Log was too long to display. Download the the raw version to get the full log.
")
+ url = Travis.Urls.plainTextLog(@get('log.job.id'))
+ this.$("#log").append $("Log was too long to display. Download the
the raw version to get the full log.
")
Travis.reopen
LogView: Travis.View.extend
diff --git a/assets/scripts/lib/travis/ordered_log.coffee b/assets/scripts/lib/travis/ordered_log.coffee
index 65c33fcd..f2127204 100644
--- a/assets/scripts/lib/travis/ordered_log.coffee
+++ b/assets/scripts/lib/travis/ordered_log.coffee
@@ -6,6 +6,7 @@ FOLDS = [
]
@Travis.OrderedLog = Em.Object.extend
+ linesLimit: 5000
init: ->
@set 'folds', []
@set 'line', 1
@@ -17,7 +18,7 @@ FOLDS = [
append: (lines) ->
return unless lines
- return if @get('lineNumber') > 5000
+ return if @get('lineNumber') > @get('linesLimit')
log = @join lines
log = @escape log
@@ -88,7 +89,7 @@ FOLDS = [
if currentFold
@set 'foldContinuation', true
- if @get('lineNumber') + index >= 5000
+ if @get('lineNumber') + index >= @get('linesLimit')
result.pushObject logWasCut: true
break
diff --git a/assets/scripts/spec/job_spec.coffee b/assets/scripts/spec/job_spec.coffee
index ab2f5955..9246e308 100644
--- a/assets/scripts/spec/job_spec.coffee
+++ b/assets/scripts/spec/job_spec.coffee
@@ -43,3 +43,30 @@ describe 'on the "job" state', ->
displaysLog [
'log 1'
]
+
+describe 'too long log', ->
+ beforeEach ->
+ $.mockjax
+ url: '/jobs/2/log?cors_hax=true'
+ responseTime: 0
+ responseText: '1\n2\n3\n4\n5\n6\n7\n8\n9\n10'
+
+ Travis.OrderedLog.reopen
+ linesLimit: 5
+
+ app 'travis-ci/travis-core/jobs/2'
+ waitFor logRendered
+
+ afterEach ->
+ Travis.OrderedLog.reopen
+ linesLimit: 5000
+
+ it 'is cut after given limit', ->
+ displaysLog [
+ '12345'
+ ]
+
+ expect( $('#log .cut').text() ).toEqual 'Log was too long to display. Download the the raw version to get the full log.'
+ expect( $('#log .cut a').attr('href') ).toEqual '/jobs/2/log.txt?deansi=true'
+
+
diff --git a/assets/scripts/spec/support/conditions.coffee b/assets/scripts/spec/support/conditions.coffee
index 67a60462..fbc74720 100644
--- a/assets/scripts/spec/support/conditions.coffee
+++ b/assets/scripts/spec/support/conditions.coffee
@@ -11,4 +11,4 @@
@jobsRendered = notEmpty('#jobs .number')
@queuesRendered = notEmpty('#queue_linux li')
@workersRendered = notEmpty('.worker')
-
+@logRendered = notEmpty('#log p')
diff --git a/assets/scripts/spec/support/expectations.coffee b/assets/scripts/spec/support/expectations.coffee
index edf80ddc..3cb12953 100644
--- a/assets/scripts/spec/support/expectations.coffee
+++ b/assets/scripts/spec/support/expectations.coffee
@@ -42,7 +42,7 @@
@displaysLog = (lines) ->
log = lines.join()
- expect($('#log').text().trim()).toEqual log
+ expect($('#log p').text().trim()).toEqual log
@listsRepos = (items) ->
listsItems('repo', items)
diff --git a/assets/styles/main/log.sass b/assets/styles/main/log.sass
index 2af0aa97..80a6914b 100644
--- a/assets/styles/main/log.sass
+++ b/assets/styles/main/log.sass
@@ -19,6 +19,9 @@ pre#log
overflow-x: scroll
counter-reset: line-numbering
+ .cut
+ padding: 20px 15px 0 55px
+
p
padding: 0 15px 0 55px
margin: 0