Extract function
This commit is contained in:
@@ -76,21 +76,7 @@ MapController.prototype.composeCreateMapMiddleware = function (useTemplate = fal
|
||||
this.prepareContext,
|
||||
initProfiler(isTemplateInstantiation),
|
||||
checkJsonContentType(),
|
||||
useTemplate ?
|
||||
checkInstantiteLayergroup() :
|
||||
checkCreateLayergroup(),
|
||||
useTemplate ?
|
||||
getTemplate(
|
||||
this.templateMaps,
|
||||
this.pgConnection,
|
||||
this.metadataBackend,
|
||||
this.userLimitsApi,
|
||||
this.mapConfigAdapter
|
||||
) :
|
||||
prepareAdapterMapConfig(this.mapConfigAdapter),
|
||||
useTemplate ?
|
||||
instantiateLayergroup(this.mapBackend, this.userLimitsApi) :
|
||||
createLayergroup (this.mapBackend, this.userLimitsApi),
|
||||
this.getCreateMapMiddlewares(useTemplate),
|
||||
incrementMapViewCount(this.metadataBackend),
|
||||
augmentLayergroupData(),
|
||||
getAffectedTables(this.pgConnection, this.layergroupAffectedTables),
|
||||
@@ -111,6 +97,28 @@ MapController.prototype.composeCreateMapMiddleware = function (useTemplate = fal
|
||||
];
|
||||
};
|
||||
|
||||
MapController.prototype.getCreateMapMiddlewares = function (useTemplate) {
|
||||
if (useTemplate) {
|
||||
return [
|
||||
checkInstantiteLayergroup(),
|
||||
getTemplate(
|
||||
this.templateMaps,
|
||||
this.pgConnection,
|
||||
this.metadataBackend,
|
||||
this.userLimitsApi,
|
||||
this.mapConfigAdapter
|
||||
),
|
||||
instantiateLayergroup(this.mapBackend, this.userLimitsApi)
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
checkCreateLayergroup(),
|
||||
prepareAdapterMapConfig(this.mapConfigAdapter),
|
||||
createLayergroup (this.mapBackend, this.userLimitsApi)
|
||||
];
|
||||
}
|
||||
|
||||
function initProfiler (isTemplateInstantiation) {
|
||||
const operation = isTemplateInstantiation ? 'instance_template' : 'createmap';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user