export.js
/**
 * Start export of complete aggregate packages: dataset and dashboards with deps
 */
Start export of complete aggregate packages: dataset and dashboards with deps
Start export of complete aggregate packages : dataset and dashboards with deps
function exportTracker() {
	console.log("1. Downloading metadata");
	var promises = [];
	if( currentExport.programIds ) promises.push( dependencyExport("program", currentExport.programIds) );
	if( currentExport.dashboardIds ) promises.push( dependencyExport("dashboard", currentExport.dashboardIds) );
	if( currentExport.customObjects ) promises.push( customObjects() );
	Q.all(promises).then(function (results) {
		promises = [
			indicators(),
			categoryOptionGroupSetStructure(),
			saveObject("dataElementGroups", currentExport.dataElementGroupIds),
			saveObject("indicatorGroups", currentExport.indicatorGroupIds),
			saveObject("programIndicatorGroups", currentExport.programIndicatorGroupIds),
			userGroups(),
			users()
		];
		Q.all(promises).then(function (results) {
			promises = [
				indicatorTypes(),
				legendSets(),
				predictors()
			];
			Q.all(promises).then(function (results) {
				processTracker();
			})
			.catch(function (err) {
				console.error('An error occured in processTracker():');
				console.error(err);
			});
		});
	}, function(fail){
		console.log("Fail2:" + fail );
	});
}
function exportTracker ( ) { console . log ( "1. Downloading metadata" ) ; var promises = [ ] ; if ( currentExport . programIds ) promises . push ( dependencyExport ( "program" , currentExport . programIds ) ) ; if ( currentExport . dashboardIds ) promises . push ( dependencyExport ( "dashboard" , currentExport . dashboardIds ) ) ; if ( currentExport . customObjects ) promises . push ( customObjects ( ) ) ; Q . all ( promises ) . then ( function ( results ) { promises = [ indicators ( ) , categoryOptionGroupSetStructure ( ) , saveObject ( "dataElementGroups" , currentExport . dataElementGroupIds ) , saveObject ( "indicatorGroups" , currentExport . indicatorGroupIds ) , saveObject ( "programIndicatorGroups" , currentExport . programIndicatorGroupIds ) , userGroups ( ) , users ( ) ] ; Q . all ( promises ) . then ( function ( results ) { promises = [ indicatorTypes ( ) , legendSets ( ) , predictors ( ) ] ; Q . all ( promises ) . then ( function ( results ) { processTracker ( ) ; } ) . catch ( function ( err ) { console . error ( 'An error occured in processTracker():' ) ; console . error ( err ) ; } ) ; } ) ; } , function ( fail ) { console . log ( "Fail2:" + fail ) ; } ) ; }
Start export of complete aggregate packages: dataset and dashboards with deps
Start export of complete aggregate packages : dataset and dashboards with deps
/*
	Only data element in datasets included. Include config option for "placeholder"
	datasets that is only used to get dependencies, but where the actual dataset is not 
	included in the export file. This also includes other data elements used in 
	indicators, like those for population.
	
	Favourites and indicator formulas should still be checked for data elements, 
	category option groups, legend sets etc. For legend sets, category option groups etc
	they should be included, but for data elements we should only show a warning that 
	they need to be added to a data set to be included.
	*/ //Do initial dependency export //Get indicators and categoryOptionGroupSets from favourites and groups //Get validation rules and groups from conf file //Get data element and indicator groups from conf files //Get legends from data elements, indicators and favourites //Get indicator types from indicators //Get predictors based on data elements