function getStacks(req, res) {
    var data = {};
    async.auto({
      stacks: function(callback) {
        dreadnot.getStackSummaries(function(err, stacks) {
          data.stacks = stacks;
          callback(err);
        });
      },

      regions: ['stacks', function(callback) {
        async.forEach(data.stacks, function(stack, callback) {
          dreadnot.getRegionSummaries(stack.name, function(err, regions) {
            if (err) {
              callback(err);
              return;
            }

            stack.regions = regions;
            async.forEach(stack.regions, function(region, callback) {
              // TODO: Should this go in dreadnot.js or stack.js maybe?
              if (region.latest_deployment === '0') {
                region.latest_deployment = null;
                callback();
                return;
              }
              dreadnot.getDeploymentSummary(stack.name, region.name, region.latest_deployment, function(err, deployment) {
                region.latest_deployment = deployment;
                callback(err);
              });
            }, callback);
          });
        }, callback);
      }],
    }, function(err) {
      renderCallback(req, res, 'stacks.jade')(err, data);
    });
  }
function getStacks(req, res) {
    var data = {};
    async.auto({
      stacks: function(callback) {
        dreadnot.getStackSummaries(function(err, stacks) {
          data.stacks = stacks;
          callback(err);
        });
      },

      regions: ['stacks', function(callback) {
        async.forEach(data.stacks, function(stack, callback) {
          dreadnot.getRegionSummaries(stack.name, function(err, regions) {
            if (err) {
              callback(err);
              return;
            }

            stack.regions = regions;
            async.forEach(stack.regions, function(region, callback) {
              
              if (region.latest_deployment === '0') {
                region.latest_deployment = null;
                callback();
                return;
              }
              dreadnot.getDeploymentSummary(stack.name, region.name, region.latest_deployment, function(err, deployment) {
                region.latest_deployment = deployment;
                callback(err);
              });
            }, callback);
          });
        }, callback);
      }],
    }, function(err) {
      renderCallback(req, res, 'stacks.jade')(err, data);
    });
  }
function getStacks ( req , res ) { var data = { } ; async . auto ( { stacks : function ( callback ) { dreadnot . getStackSummaries ( function ( err , stacks ) { data . stacks = stacks ; callback ( err ) ; } ) ; } , regions : [ 'stacks' , function ( callback ) { async . forEach ( data . stacks , function ( stack , callback ) { dreadnot . getRegionSummaries ( stack . name , function ( err , regions ) { if ( err ) { callback ( err ) ; return ; } stack . regions = regions ; async . forEach ( stack . regions , function ( region , callback ) { // TODO: Should this go in dreadnot.js or stack.js maybe? if ( region . latest_deployment === '0' ) { region . latest_deployment = null ; callback ( ) ; return ; } dreadnot . getDeploymentSummary ( stack . name , region . name , region . latest_deployment , function ( err , deployment ) { region . latest_deployment = deployment ; callback ( err ) ; } ) ; } , callback ) ; } ) ; } , callback ) ; } ] , } , function ( err ) { renderCallback ( req , res , 'stacks.jade' ) ( err , data ) ; } ) ; }
Render the main overview page
Render the main overview page