scripts/dashboard-from-json.js
function readDashFromFS(fname) {
  var dashboardBody = fs.readFileSync(fname);
  console.log('Read file:', fname);

  // Set the proper account_id on all widgets
  if (dashboardBody != null) {

    dashboardBody = JSON.parse(dashboardBody);
    console.log('Read source dashboard named: ' + dashboardBody.dashboard.title);
    
    var destId = config.get(program.dest).accountId;
    dashboardBody = dashboards.updateAccountId(dashboardBody, 1, destId);
    console.log(dashboardBody);
  } else {
    console.error('Problem reading file', fname);
  }

  return dashboardBody;
}
function readDashFromFS(fname) {
  var dashboardBody = fs.readFileSync(fname);
  console.log('Read file:', fname);

  // Set the proper account_id on all widgets
  if (dashboardBody != null) {

    dashboardBody = JSON.parse(dashboardBody);
    console.log('Read source dashboard named: ' + dashboardBody.dashboard.title);
    
    var destId = config.get(program.dest).accountId;
    dashboardBody = dashboards.updateAccountId(dashboardBody, 1, destId);
    console.log(dashboardBody);
  } else {
    console.error('Problem reading file', fname);
  }

  return dashboardBody;
}
function readDashFromFS ( fname ) { var dashboardBody = fs . readFileSync ( fname ) ; console . log ( 'Read file:' , fname ) ; // Set the proper account_id on all widgets if ( dashboardBody != null ) { dashboardBody = JSON . parse ( dashboardBody ) ; console . log ( 'Read source dashboard named: ' + dashboardBody . dashboard . title ) ; var destId = config . get ( program . dest ) . accountId ; dashboardBody = dashboards . updateAccountId ( dashboardBody , 1 , destId ) ; console . log ( dashboardBody ) ; } else { console . error ( 'Problem reading file' , fname ) ; } return dashboardBody ; }
Read the source dashboard from the file system
Read the source dashboard from the file system