Skip to content

Commit

Permalink
color headers for sub builds
Browse files Browse the repository at this point in the history
  • Loading branch information
suryagaddipati committed Nov 20, 2015
1 parent 8b6c7ef commit 7c2440d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
7 changes: 4 additions & 3 deletions src/main/jsx/terminal/src/build.js
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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'
},
Expand All @@ -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);
}}
})
Expand Down
13 changes: 13 additions & 0 deletions src/main/jsx/terminal/src/buildColors.js
Original file line number Diff line number Diff line change
@@ -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
}
}
18 changes: 2 additions & 16 deletions src/main/jsx/terminal/src/buildHistory.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 7c2440d

Please sign in to comment.