diff --git a/src/main/jsx/terminal/src/build.js b/src/main/jsx/terminal/src/build.js index 5bf0fdee..cba2c6b0 100644 --- a/src/main/jsx/terminal/src/build.js +++ b/src/main/jsx/terminal/src/build.js @@ -1,5 +1,6 @@ var request = require('request'); import blessed from 'blessed'; +import buildColor from './buildColors.js' function buildHeader(serverUrl,onBack,axisList,screen,logWidget){ const header = blessed.listbar({ height: 'shrink',// : 3, @@ -9,9 +10,9 @@ function buildHeader(serverUrl,onBack,axisList,screen,logWidget){ border: 'line', vi: true, style: { - bg: 'green', + // bg: 'green', item: { - bg: 'red', + // bg: 'red', hover: { bg: 'blue' }, @@ -31,7 +32,7 @@ function buildHeader(serverUrl,onBack,axisList,screen,logWidget){ } } axisList.forEach( axis =>{ - commands[axis['script']] = { callback: ()=>{ + commands[buildColor(axis.result)((axis['script']))] = { callback: ()=>{ loadLog(serverUrl+'/'+axis.url,onBack,logWidget,screen); }} }) diff --git a/src/main/jsx/terminal/src/buildColors.js b/src/main/jsx/terminal/src/buildColors.js new file mode 100644 index 00000000..993a3707 --- /dev/null +++ b/src/main/jsx/terminal/src/buildColors.js @@ -0,0 +1,13 @@ +var colors = require('colors/safe'); +export default function(result){ + switch(result){ + case 'SUCCESS': + return colors.green + case 'FAILURE': + return colors.red + case 'ABORTED': + return colors.grey + default: + return colors.yellow + } +} diff --git a/src/main/jsx/terminal/src/buildHistory.js b/src/main/jsx/terminal/src/buildHistory.js index 09fec28b..699f874b 100644 --- a/src/main/jsx/terminal/src/buildHistory.js +++ b/src/main/jsx/terminal/src/buildHistory.js @@ -2,25 +2,11 @@ var request = require('request'); import build from './build.js'; import contrib from 'blessed-contrib'; import blessed from 'blessed'; -var colors = require('colors/safe'); +import buildColor from './buildColors.js' function buildRow(build){ let {number,displayTime,result,commit} = build; let {committerName,message,shortSha,branch} = commit; - let color = colors.black; - switch(result){ - case 'SUCCESS': - color = colors.green - break; - case 'FAILURE': - color = colors.red - break; - case 'ABORTED': - color = colors.grey - break; - default: - color = colors.yellow - break; - } + let color = buildColor(result); let cols = [displayTime, result, branch, committerName,message,shortSha].map( col => color(col)); return [number + ''].concat(cols); }