Use default param values

This commit is contained in:
Daniel García Aubert 2018-03-07 12:46:18 +01:00
parent 33089be2cd
commit 5871f8290d

View File

@ -254,8 +254,8 @@ function validateLayerRouteMiddleware(req, res, next) {
LayergroupController.prototype.analysisNodeStatus = function (analysisStatusBackend) {
return function analysisNodeStatusMiddleware(req, res, next) {
analysisStatusBackend.getNodeStatus(res.locals, (err, nodeStatus, stats) => {
req.profiler.add(stats || {});
analysisStatusBackend.getNodeStatus(res.locals, (err, nodeStatus, stats = {}) => {
req.profiler.add(stats);
if (err) {
err.label = 'GET NODE STATUS';
@ -313,8 +313,8 @@ LayergroupController.prototype.getDataview = function (dataviewBackend) {
return function getDataviewMiddleware (req, res, next) {
const { user, mapConfigProvider } = res.locals;
dataviewBackend.getDataview(mapConfigProvider, user, res.locals, (err, dataview, stats) => {
req.profiler.add(stats || {});
dataviewBackend.getDataview(mapConfigProvider, user, res.locals, (err, dataview, stats = {}) => {
req.profiler.add(stats);
if (err) {
err.label = 'GET DATAVIEW';
@ -332,8 +332,8 @@ LayergroupController.prototype.dataviewSearch = function (dataviewBackend) {
return function dataviewSearchMiddlewarify (req, res, next) {
const { user, dataviewName, mapConfigProvider } = res.locals;
dataviewBackend.search(mapConfigProvider, user, dataviewName, res.locals, (err, searchResult, stats) => {
req.profiler.add(stats || {});
dataviewBackend.search(mapConfigProvider, user, dataviewName, res.locals, (err, searchResult, stats = {}) => {
req.profiler.add(stats);
if (err) {
err.label = 'GET DATAVIEW SEARCH';
@ -353,8 +353,8 @@ LayergroupController.prototype.attributes = function (attributesBackend) {
const { mapConfigProvider } = res.locals;
attributesBackend.getFeatureAttributes(mapConfigProvider, res.locals, false, (err, tile, stats) => {
req.profiler.add(stats || {});
attributesBackend.getFeatureAttributes(mapConfigProvider, res.locals, false, (err, tile, stats = {}) => {
req.profiler.add(stats);
if (err) {
err.label = 'GET ATTRIBUTES';
@ -399,7 +399,7 @@ LayergroupController.prototype.tile = function (tileBackend) {
const { mapConfigProvider } = res.locals;
const params = getRequestParams(res.locals);
tileBackend.getTile(mapConfigProvider, params, (err, tile, headers, stats) => {
tileBackend.getTile(mapConfigProvider, params, (err, tile, headers, stats = {}) => {
req.profiler.add(stats);
if (err) {
@ -427,7 +427,7 @@ LayergroupController.prototype.layer = function (tileBackend) {
const { mapConfigProvider } = res.locals;
const params = getRequestParams(res.locals);
tileBackend.getTile(mapConfigProvider, params, (err, tile, headers, stats) => {
tileBackend.getTile(mapConfigProvider, params, (err, tile, headers, stats = {}) => {
req.profiler.add(stats);
if (err) {
@ -500,11 +500,11 @@ LayergroupController.prototype.center = function (previewBackend) {
};
const format = req.params.format === 'jpg' ? 'jpeg' : 'png';
const { mapConfigProvider } = res.locals;
const { mapConfigProvider: provider } = res.locals;
previewBackend.getImage(mapConfigProvider, format, width, height, zoom, center,(err, image, headers, stats) => {
previewBackend.getImage(provider, format, width, height, zoom, center, (err, image, headers, stats = {}) => {
req.profiler.done('render-' + format);
req.profiler.add(stats || {});
req.profiler.add(stats);
if (err) {
err.label = 'STATIC_MAP';
@ -535,11 +535,11 @@ LayergroupController.prototype.bbox = function (previewBackend) {
south: +req.params.south
};
const format = req.params.format === 'jpg' ? 'jpeg' : 'png';
const { mapConfigProvider } = res.locals;
const { mapConfigProvider: provider } = res.locals;
previewBackend.getImage(mapConfigProvider, format, width, height, bounds, (err, image, headers, stats) => {
previewBackend.getImage(provider, format, width, height, bounds, (err, image, headers, stats = {}) => {
req.profiler.done('render-' + format);
req.profiler.add(stats || {});
req.profiler.add(stats);
if (err) {
err.label = 'STATIC_MAP';