Unify getMapConfig signature for overviews adapter

This commit is contained in:
Raul Ochoa
2016-05-23 18:35:16 +02:00
parent 31a0b01a27
commit 7ad8a99373
4 changed files with 14 additions and 6 deletions

View File

@@ -182,7 +182,8 @@ MapController.prototype.create = function(req, res, prepareConfigFn) {
function addOverviewsInformation(err, requestMapConfig, datasource) {
assert.ifError(err);
var next = this;
self.overviewsAdapter.getMapConfig(req.context.user, requestMapConfig, analysesResults,
context.analysesResults = analysesResults;
self.overviewsAdapter.getMapConfig(req.context.user, requestMapConfig, req.params, context,
function(err, requestMapConfig) {
if (err) {
return next(err);

View File

@@ -9,10 +9,11 @@ function MapConfigOverviewsAdapter(overviewsMetadataApi, filterStatsApi) {
module.exports = MapConfigOverviewsAdapter;
MapConfigOverviewsAdapter.prototype.getMapConfig = function(user, requestMapConfig, analysesResults, callback) {
MapConfigOverviewsAdapter.prototype.getMapConfig = function(user, requestMapConfig, params, context, callback) {
var self = this;
var layers = requestMapConfig.layers;
var analysesResults = context.analysesResults;
if (!layers || layers.length === 0) {
return callback(null, requestMapConfig);

View File

@@ -139,8 +139,8 @@ NamedMapMapConfigProvider.prototype.getMapConfig = function(callback) {
function addOverviewsInformation(err, _mapConfig, datasource) {
assert.ifError(err);
var next = this;
self.overviewsAdapter.getMapConfig(self.owner, _mapConfig, self.analysesResults, function(err, _mapConfig) {
context.analysesResults = self.analysesResults;
self.overviewsAdapter.getMapConfig(self.owner, _mapConfig, rendererParams, context, function(err, _mapConfig) {
if (err) {
return next(err);
}

View File

@@ -37,7 +37,10 @@ describe('MapConfigOverviewsAdapter', function() {
layers: [layer_without_overviews]
};
mapConfigOverviewsAdapter.getMapConfig('localhost', _mapConfig, [], function(err, mapConfig) {
var params = {};
var context = {};
mapConfigOverviewsAdapter.getMapConfig('localhost', _mapConfig, params, context, function(err, mapConfig) {
assert.ok(!err);
var layers = mapConfig.layers;
assert.equal(layers.length, 1);
@@ -70,7 +73,10 @@ describe('MapConfigOverviewsAdapter', function() {
layers: [layer_with_overviews]
};
mapConfigOverviewsAdapter.getMapConfig('localhost', _mapConfig, [], function(err, mapConfig) {
var params = {};
var context = {};
mapConfigOverviewsAdapter.getMapConfig('localhost', _mapConfig, params, context, function(err, mapConfig) {
assert.ok(!err);
var layers = mapConfig.layers;
assert.equal(layers.length, 1);