Open fold if folded command returns an error
This commit is contained in:
parent
fc40190c29
commit
4e7329f638
|
@ -68,6 +68,7 @@ Travis.Store = DS.Store.extend
|
||||||
{ id: id, clientId: clientId }
|
{ id: id, clientId: clientId }
|
||||||
|
|
||||||
receive: (event, data) ->
|
receive: (event, data) ->
|
||||||
|
console.log event, data if event == 'job:log'
|
||||||
[name, type] = event.split(':')
|
[name, type] = event.split(':')
|
||||||
|
|
||||||
mappings = @adapter.get('mappings')
|
mappings = @adapter.get('mappings')
|
||||||
|
|
|
@ -191,6 +191,11 @@
|
||||||
else
|
else
|
||||||
this.$('#log').append(line)
|
this.$('#log').append(line)
|
||||||
|
|
||||||
|
if payload.openFold
|
||||||
|
this.$("#log .fold.#{payload.openFold}:last").
|
||||||
|
removeClass('show-first-line').
|
||||||
|
addClass('open')
|
||||||
|
|
||||||
if payload.foldEnd
|
if payload.foldEnd
|
||||||
this.$("#log .fold.#{payload.fold}:last").removeClass('show-first-line')
|
this.$("#log .fold.#{payload.fold}:last").removeClass('show-first-line')
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -70,6 +70,14 @@ FOLDS = [
|
||||||
else if payload.number != 1
|
else if payload.number != 1
|
||||||
payload.append = true
|
payload.append = true
|
||||||
|
|
||||||
|
if payload.foldContinuation && payload.content.match(/Done. Build script exited with:/)
|
||||||
|
# script ended, but fold is still closed, which most probably means
|
||||||
|
# error, end the fold and open it.
|
||||||
|
# TODO: we need log marks to make it easier
|
||||||
|
payload.foldContinuation = null
|
||||||
|
payload.openFold = payload.fold
|
||||||
|
payload.fold = null
|
||||||
|
|
||||||
result.pushObject payload
|
result.pushObject payload
|
||||||
|
|
||||||
if currentFold
|
if currentFold
|
||||||
|
@ -94,6 +102,9 @@ FOLDS = [
|
||||||
log = log.replace /\r\n/g, '\n'
|
log = log.replace /\r\n/g, '\n'
|
||||||
lines = log.split(/(\n)/)
|
lines = log.split(/(\n)/)
|
||||||
|
|
||||||
|
if lines.slice(-1)[0] == ''
|
||||||
|
lines.popObject()
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
for line in lines
|
for line in lines
|
||||||
result.pushObjects line.split(/(\r)/)
|
result.pushObjects line.split(/(\r)/)
|
||||||
|
|
31
assets/scripts/vendor/ansiparse.js
vendored
31
assets/scripts/vendor/ansiparse.js
vendored
|
@ -7,7 +7,8 @@ ansiparse = function (str) {
|
||||||
matchingText = '',
|
matchingText = '',
|
||||||
ansiState = [],
|
ansiState = [],
|
||||||
result = [],
|
result = [],
|
||||||
state = {};
|
state = {},
|
||||||
|
eraseChar;
|
||||||
|
|
||||||
//
|
//
|
||||||
// General workflow for this thing is:
|
// General workflow for this thing is:
|
||||||
|
@ -20,6 +21,29 @@ ansiparse = function (str) {
|
||||||
// In further steps we hope it's all going to be fine. It usually is.
|
// In further steps we hope it's all going to be fine. It usually is.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
//
|
||||||
|
// Erases a char from the output
|
||||||
|
//
|
||||||
|
eraseChar = function () {
|
||||||
|
var index, text;
|
||||||
|
if (matchingText.length) {
|
||||||
|
matchingText = matchingText.substr(0, matchingText.length - 1);
|
||||||
|
}
|
||||||
|
else if (result.length) {
|
||||||
|
index = result.length - 1;
|
||||||
|
text = result[index].text;
|
||||||
|
if (text.length === 1) {
|
||||||
|
//
|
||||||
|
// A result bit was fully deleted, pop it out to simplify the final output
|
||||||
|
//
|
||||||
|
result.pop();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
result[index].text = text.substr(0, text.length - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
for (var i = 0; i < str.length; i++) {
|
for (var i = 0; i < str.length; i++) {
|
||||||
if (matchingControl != null) {
|
if (matchingControl != null) {
|
||||||
if (matchingControl == '\033' && str[i] == '\[') {
|
if (matchingControl == '\033' && str[i] == '\[') {
|
||||||
|
@ -111,7 +135,9 @@ ansiparse = function (str) {
|
||||||
|
|
||||||
if (str[i] == '\033') {
|
if (str[i] == '\033') {
|
||||||
matchingControl = str[i];
|
matchingControl = str[i];
|
||||||
|
}
|
||||||
|
else if (str[i] == '\u0008') {
|
||||||
|
eraseChar();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
matchingText += str[i];
|
matchingText += str[i];
|
||||||
|
@ -158,4 +184,3 @@ if (typeof module == "object" && typeof window == "undefined") {
|
||||||
module.exports = ansiparse;
|
module.exports = ansiparse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user