lib/jenkins.js
function executorSummary(computers) {

  var data = {};

  computers.forEach(function (computer) {

    var idleCount   = 0;
    var activeCount = 0;

    data[computer.displayName] = { executors: [] };

    computer.executors.forEach(function (executor) {
      data[computer.displayName].executors.push({
        idle: executor.idle,
        stuck: executor.likelyStuck,
        progress: executor.progress,
        name: (!executor.idle && executor.currentExecutable.url) ?
          executor.currentExecutable.url.replace(/.*\/job\//, '').replace(/\/.*/, '') :
          undefined
      });

      if (executor.idle) {
        idleCount += 1;
      } else {
        activeCount += 1;
      }
    });

    var summary = [];
    if (activeCount > 0) {
      summary.push(text.__('%d active', activeCount));
    }
    if (idleCount > 0) {
      summary.push(text.__('%d idle', idleCount));
    }

    data[computer.displayName].summary = summary.join(', ');
  });

  return data;
}
function executorSummary(computers) {

  var data = {};

  computers.forEach(function (computer) {

    var idleCount   = 0;
    var activeCount = 0;

    data[computer.displayName] = { executors: [] };

    computer.executors.forEach(function (executor) {
      data[computer.displayName].executors.push({
        idle: executor.idle,
        stuck: executor.likelyStuck,
        progress: executor.progress,
        name: (!executor.idle && executor.currentExecutable.url) ?
          executor.currentExecutable.url.replace(/.*\/job\//, '').replace(/\/.*/, '') :
          undefined
      });

      if (executor.idle) {
        idleCount += 1;
      } else {
        activeCount += 1;
      }
    });

    var summary = [];
    if (activeCount > 0) {
      summary.push(text.__('%d active', activeCount));
    }
    if (idleCount > 0) {
      summary.push(text.__('%d idle', idleCount));
    }

    data[computer.displayName].summary = summary.join(', ');
  });

  return data;
}
function executorSummary ( computers ) { var data = { } ; computers . forEach ( function ( computer ) { var idleCount = 0 ; var activeCount = 0 ; data [ computer . displayName ] = { executors : [ ] } ; computer . executors . forEach ( function ( executor ) { data [ computer . displayName ] . executors . push ( { idle : executor . idle , stuck : executor . likelyStuck , progress : executor . progress , name : ( ! executor . idle && executor . currentExecutable . url ) ? executor . currentExecutable . url . replace ( / .*\/job\/ / , '' ) . replace ( / \/.* / , '' ) : undefined } ) ; if ( executor . idle ) { idleCount += 1 ; } else { activeCount += 1 ; } } ) ; var summary = [ ] ; if ( activeCount > 0 ) { summary . push ( text . __ ( '%d active' , activeCount ) ) ; } if ( idleCount > 0 ) { summary . push ( text . __ ( '%d idle' , idleCount ) ) ; } data [ computer . displayName ] . summary = summary . join ( ', ' ) ; } ) ; return data ; }
Summarise executor information from computers array.

@param {Array} computers: computers array, part of Jenkins#computer result
@return executor summary object
Summarise executor information from computers array .