Use context for analyses results
This commit is contained in:
@@ -134,7 +134,6 @@ MapController.prototype.create = function(req, res, prepareConfigFn) {
|
||||
var self = this;
|
||||
|
||||
var mapConfig;
|
||||
var analysesResults = [];
|
||||
|
||||
var user = req.context.user;
|
||||
var context = {};
|
||||
@@ -144,11 +143,7 @@ MapController.prototype.create = function(req, res, prepareConfigFn) {
|
||||
self.req2params(req, this);
|
||||
},
|
||||
prepareConfigFn,
|
||||
function prepareSqlWrap(err, requestMapConfig) {
|
||||
assert.ifError(err);
|
||||
self.sqlWrapMapConfigAdapter.getMapConfig(user, requestMapConfig, req.params, context, this);
|
||||
},
|
||||
function prepareAnalysisLayers(err, requestMapConfig) {
|
||||
function prepareAdapterMapConfig(err, requestMapConfig) {
|
||||
assert.ifError(err);
|
||||
context.analysisConfiguration = {
|
||||
db: {
|
||||
@@ -163,12 +158,19 @@ MapController.prototype.create = function(req, res, prepareConfigFn) {
|
||||
apiKey: req.params.api_key
|
||||
}
|
||||
};
|
||||
return requestMapConfig;
|
||||
},
|
||||
function prepareSqlWrap(err, requestMapConfig) {
|
||||
assert.ifError(err);
|
||||
self.sqlWrapMapConfigAdapter.getMapConfig(user, requestMapConfig, req.params, context, this);
|
||||
},
|
||||
function prepareAnalysisLayers(err, requestMapConfig) {
|
||||
assert.ifError(err);
|
||||
self.analysisMapConfigAdapter.getMapConfig(user, requestMapConfig, req.params, context, this);
|
||||
},
|
||||
function beforeLayergroupCreate(err, requestMapConfig, _analysesResults) {
|
||||
function beforeLayergroupCreate(err, requestMapConfig) {
|
||||
assert.ifError(err);
|
||||
var next = this;
|
||||
analysesResults = _analysesResults;
|
||||
self.namedLayersAdapter.getMapConfig(user, requestMapConfig, req.params, context,
|
||||
function(err, requestMapConfig, datasource) {
|
||||
if (err) {
|
||||
@@ -182,7 +184,6 @@ MapController.prototype.create = function(req, res, prepareConfigFn) {
|
||||
function addOverviewsInformation(err, requestMapConfig, datasource) {
|
||||
assert.ifError(err);
|
||||
var next = this;
|
||||
context.analysesResults = analysesResults;
|
||||
self.overviewsAdapter.getMapConfig(req.context.user, requestMapConfig, req.params, context,
|
||||
function(err, requestMapConfig) {
|
||||
if (err) {
|
||||
@@ -218,6 +219,7 @@ MapController.prototype.create = function(req, res, prepareConfigFn) {
|
||||
},
|
||||
function afterLayergroupCreate(err, layergroup) {
|
||||
assert.ifError(err);
|
||||
var analysesResults = context.analysesResults || [];
|
||||
self.afterLayergroupCreate(req, res, mapConfig, analysesResults, layergroup, this);
|
||||
},
|
||||
function finish(err, layergroup) {
|
||||
|
||||
@@ -178,7 +178,9 @@ AnalysisMapConfigAdapter.prototype.getMapConfig = function(user, requestMapConfi
|
||||
return callback(missingNodesErrors);
|
||||
}
|
||||
|
||||
return callback(null, requestMapConfig, analysesResults);
|
||||
context.analysesResults = analysesResults;
|
||||
|
||||
return callback(null, requestMapConfig);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -100,11 +100,7 @@ NamedMapMapConfigProvider.prototype.getMapConfig = function(callback) {
|
||||
assert.ifError(err);
|
||||
return self.templateMaps.instance(self.template, templateParams);
|
||||
},
|
||||
function prepareSqlWrap(err, requestMapConfig) {
|
||||
assert.ifError(err);
|
||||
self.sqlWrapMapConfigAdapter.getMapConfig(user, requestMapConfig, rendererParams, context, this);
|
||||
},
|
||||
function prepareAnalysisLayers(err, requestMapConfig) {
|
||||
function prepareAdapterMapConfig(err, requestMapConfig) {
|
||||
assert.ifError(err);
|
||||
context.analysisConfiguration = {
|
||||
db: {
|
||||
@@ -119,13 +115,20 @@ NamedMapMapConfigProvider.prototype.getMapConfig = function(callback) {
|
||||
apiKey: apiKey
|
||||
}
|
||||
};
|
||||
|
||||
return requestMapConfig;
|
||||
},
|
||||
function prepareSqlWrap(err, requestMapConfig) {
|
||||
assert.ifError(err);
|
||||
self.sqlWrapMapConfigAdapter.getMapConfig(user, requestMapConfig, rendererParams, context, this);
|
||||
},
|
||||
function prepareAnalysisLayers(err, requestMapConfig) {
|
||||
assert.ifError(err);
|
||||
self.analysisMapConfigAdapter.getMapConfig(user, requestMapConfig, rendererParams, context, this);
|
||||
},
|
||||
function prepareLayergroup(err, _mapConfig, analysesResults) {
|
||||
function prepareLayergroup(err, _mapConfig) {
|
||||
assert.ifError(err);
|
||||
var next = this;
|
||||
self.analysesResults = analysesResults || [];
|
||||
self.analysesResults = context.analysesResults || [];
|
||||
self.namedLayersAdapter.getMapConfig(self.owner, _mapConfig, rendererParams, context,
|
||||
function(err, _mapConfig, datasource) {
|
||||
if (err) {
|
||||
@@ -139,7 +142,6 @@ NamedMapMapConfigProvider.prototype.getMapConfig = function(callback) {
|
||||
function addOverviewsInformation(err, _mapConfig, datasource) {
|
||||
assert.ifError(err);
|
||||
var next = this;
|
||||
context.analysesResults = self.analysesResults;
|
||||
self.overviewsAdapter.getMapConfig(self.owner, _mapConfig, rendererParams, context,
|
||||
function(err, _mapConfig) {
|
||||
if (err) {
|
||||
|
||||
Reference in New Issue
Block a user