Commit Graph

512 Commits

Author SHA1 Message Date
Ivan Malagon
97f8c361ed Merge branch 'master' into analyses-filters-params 2017-12-14 17:40:14 +01:00
Raul Ochoa
fb7f79594d Merge remote-tracking branch 'origin/master' into mapconfig-aggregation 2017-12-12 17:15:22 +00:00
Mario de Frutos
8d16bf566d
Force png tile generation for static maps (#808)
* Force png tile generation for static maps

If the user tries to generate a static map requesting JPG it will fail
because is going to try to generate the tiles using JPG as format which
is not supported by now, this bug was introduced in the version 4.0.1

So we now force, again, the tiles to be generated as PNG but we pass
the requested format, JPG, to windshaft to generate the final image as
the user reqests

* Added support to define image format in the image assertions

* Added test for JPEG static image generation

Also I've added support for:

- JPEG images
- Different tolerance based on the file type, it seems that due to
  different compression we need different tolerance for JPG images
2017-12-12 13:20:22 +01:00
Ivan Malagon
245d24ea29 Merge branch 'master' into analyses-filters-params 2017-12-12 11:54:32 +01:00
Ivan Malagon
605be77a04 Add nofilters query param 2017-12-12 11:54:09 +01:00
Daniel García Aubert
55dd049812 Be able to skip aggregation to create a layergroup with aggregation defined already 2017-12-05 12:59:32 +01:00
Daniel García Aubert
077f19d506 Integrate aggregation and get metadata for layergroup 2017-12-04 12:40:53 +01:00
Daniel García Aubert
1a78b8a75a Merge branch 'master' into middlewarify-analyses-controller 2017-11-23 11:47:57 +01:00
Daniel García Aubert
e131df601c Use ES6 template string for route definition 2017-11-19 14:05:20 +01:00
Daniel García Aubert
bee04e2553 Usr ES6 string templates 2017-11-19 12:51:35 +01:00
Daniel García Aubert
37111f396d Unify get catalog and tables middlewares 2017-11-19 12:37:09 +01:00
Daniel García Aubert
4df46fe5ea Move creation of PG client to a middleware 2017-11-17 19:20:42 +01:00
Daniel García Aubert
b1b2054f0a Split metadata function into two middlewares 2017-11-17 19:14:31 +01:00
Daniel García Aubert
c1f2b96bfc Remove step from catalog middleware 2017-11-17 18:32:46 +01:00
Daniel García Aubert
804c6645fa Make catalog method a regular middleware factory 2017-11-17 18:28:37 +01:00
Daniel García Aubert
5d6ccc07fd Move functionality that prepares catalog to be used as response 2017-11-17 18:25:13 +01:00
Daniel García Aubert
a585ba5480 Use early retutn node pattern 2017-11-17 18:07:19 +01:00
Simon Martín
22e3016cd3 Merge branch 'master' into timeoutVectorImage 2017-11-14 15:54:16 +01:00
Daniel García Aubert
d5c552a03a Move functionality that sets cache control header to a middleware 2017-11-14 13:53:42 +01:00
Daniel García Aubert
a5347c27e3 Move sendResponse method to a middleware 2017-11-14 13:49:12 +01:00
Daniel García Aubert
27521964c7 Remove schema from analyses catalog query perfoming that query in the same way that we do for pooling the node status in analyses backend 2017-11-14 12:01:21 +01:00
Daniel García Aubert
bdf4827300 Fix bad call to next middleware callback 2017-11-14 11:28:06 +01:00
Daniel García Aubert
38ca5db51b Inline method to set cache-cannel, rollback extract setCacheChannel method for named maps controller 2017-11-13 12:35:46 +01:00
Daniel García Aubert
590233e3ee Inline method to set cache-cannel, rollback extract setCacheChannel method 2017-11-13 12:15:12 +01:00
Daniel García Aubert
6f59c61c8b Add more steps while profiling 2017-11-08 14:27:35 +01:00
Daniel García Aubert
aff5fcda63 Add namespace for getMapConfig step while profiling 2017-11-08 14:08:27 +01:00
Daniel García Aubert
56d33b7f5b Add profiling 2017-11-08 10:52:25 +01:00
Daniel
749b205944
Merge pull request #788 from CartoDB/786-number-categories-param
Add a "category" query param to define the number of categories to be ranked for aggregation dataviews
2017-11-07 17:11:25 +01:00
Daniel García Aubert
743bb0723b Add query param to define the number of categories to be ranked 2017-11-07 16:14:47 +01:00
Simon Martín
970310bf7f add vectorError middleware to named map endpoint 2017-11-07 16:01:08 +01:00
Simon Martín
216c877f4b verctor error middleware 2017-11-07 11:07:38 +01:00
Daniel García Aubert
c48e89826d Split middleware to follow SRP 2017-11-07 09:50:52 +01:00
Daniel García Aubert
693a2e7bee Order middlewares 2017-11-05 19:13:56 +01:00
Daniel García Aubert
f9ba3c41d3 Create new middlewares to init profiling and another to check JSON content-type 2017-11-05 18:55:23 +01:00
Daniel García Aubert
46289f27df Remove TODO 2017-11-03 15:26:25 +01:00
Daniel García Aubert
05ccf20634 Rename function 2017-11-03 15:12:18 +01:00
Daniel García Aubert
6acb873d95 Enforce all middlewares to follow the same constructor pattern 2017-11-03 15:06:15 +01:00
Daniel García Aubert
65e8609fec Do not bind context if not needed 2017-11-03 09:47:46 +01:00
Daniel García Aubert
677f6caab8 remove funtion 2017-11-03 09:38:36 +01:00
Daniel García Aubert
cb167313d2 Unify middleware builder functions 2017-11-03 09:37:01 +01:00
Daniel García Aubert
2854d0252c Fix typo 2017-11-03 08:48:13 +01:00
Daniel García Aubert
717332d941 Compose instantiate layergroup middleware 2017-11-02 19:24:33 +01:00
Daniel García Aubert
4607e4a12d Compose create layergroup middleware 2017-11-02 19:03:20 +01:00
Daniel García Aubert
3e7106002d Rename response middleware 2017-11-02 18:39:46 +01:00
Daniel García Aubert
08b91f935d Rename error middleware 2017-11-02 18:38:34 +01:00
Daniel García Aubert
1d08734721 Rename middleware 2017-11-02 18:28:37 +01:00
Daniel García Aubert
b11b872b75 Remove step requirement 2017-11-02 11:29:43 +01:00
Daniel García Aubert
93bd2c9e50 Build afterLayergroupCreate middleware as an array of middlewares instead of preforming all them as one middleware 2017-11-02 10:43:22 +01:00
Daniel García Aubert
658763da8c Build after layergroup create while registering routes 2017-11-02 10:33:39 +01:00
Daniel García Aubert
d2b5eaa8c3 Do not proxy create and intantiate middlewares 2017-11-02 10:28:33 +01:00
Daniel García Aubert
eb5bf52bd9 Move profiler start to the right place 2017-11-02 10:22:30 +01:00
Daniel García Aubert
c8000e5cf8 Make a middleware to respond layergroup 2017-11-01 20:06:32 +01:00
Daniel García Aubert
46c76d6a4c Create middleware for layergroup creation (anonymous map) 2017-11-01 19:57:20 +01:00
Daniel García Aubert
e6bec5ccb0 Make style linter happy 2017-11-01 19:28:32 +01:00
Daniel García Aubert
125587522f Create middleware for layergroup creation 2017-11-01 19:27:01 +01:00
Daniel García Aubert
aeb9585708 extract prepare mapconfig and get template to their respective middlewares 2017-11-01 19:02:07 +01:00
Daniel García Aubert
8ed5df0072 Move prepeareConfigFn to a middleware 2017-11-01 17:57:35 +01:00
Daniel García Aubert
6bbaeaa286 Create a custom error middleware to augment error info 2017-10-31 20:49:26 +01:00
Daniel García Aubert
3d15551cb5 Minor style umprovements 2017-10-31 20:10:37 +01:00
Daniel García Aubert
e0ffeb0adc extract surrogate key functionality to its own middleware 2017-10-31 19:50:36 +01:00
Daniel García Aubert
e06f8fe25e Set layergroup-id header in the right middleware 2017-10-31 18:54:32 +01:00
Daniel García Aubert
da2228088e Extract context metadata (turbo-carto) functionallity to its own middleware 2017-10-31 18:42:11 +01:00
Daniel García Aubert
cdc39c8cae Extract addAnalysesMetadata functionallity to its own middleware 2017-10-31 18:25:17 +01:00
Daniel García Aubert
99fa66c026 Extract hash template for layergroup id and dataviews/widgets to a middlewares 2017-10-31 18:06:14 +01:00
Daniel García Aubert
d85a5d83b7 Make afterLayergroupCreate function as a 'middleware' builder 2017-10-31 17:59:32 +01:00
Daniel García Aubert
bb02494e02 Do not perform "increment map view count" in parallel 2017-10-31 17:09:42 +01:00
Daniel García Aubert
39eb0f7bec Avoid regression and update comment 2017-10-31 16:58:00 +01:00
Daniel García Aubert
5f7d5f6ec8 Get analyses results from res.locals 2017-10-31 16:01:18 +01:00
Daniel García Aubert
a4b2044e10 missing early return 2017-10-31 15:58:41 +01:00
Daniel García Aubert
d1093686a3 Avoid to hold info in local variables 2017-10-31 15:51:42 +01:00
Daniel García Aubert
12822c4341 Follow node.js convention regarding early returns 2017-10-31 15:49:10 +01:00
Daniel García Aubert
fab87e2168 Get layergroup from locals. It's not provided by previous middleware anymore 2017-10-31 15:47:59 +01:00
Daniel García Aubert
34e219353c do not pass layergroup since it's already available in res.locals 2017-10-31 14:47:29 +01:00
Daniel García Aubert
3cf4a8f70b Extract layergroup data augmentation to its own "middleware" 2017-10-31 13:46:03 +01:00
Daniel García Aubert
48172d4dc1 make afterLayergroupCreate to follow the middleware signature 2017-10-31 13:36:17 +01:00
Daniel García Aubert
467bee4c91 Split afterLayergroupCreate method in multiple "pre-middlewares" 2017-10-31 13:13:20 +01:00
Daniel García Aubert
3f2ef63976 Extract cache channel to its own method 2017-10-31 11:38:54 +01:00
Daniel García Aubert
235f5e4566 Extract cache channel to its own method 2017-10-31 11:38:18 +01:00
Daniel García Aubert
fb3afaa6ab Fix jshint max-complexity issue by using extract method 2017-10-30 19:29:19 +01:00
Daniel García Aubert
b6c405bf68 Remove send method in base controller and remove BaseController class 2017-10-30 19:28:40 +01:00
Daniel García Aubert
9ad6d0cbcc Merge branch 'master' into stats-middleware 2017-10-16 15:06:20 +02:00
David Manzanares
d30f710534 Merge remote-tracking branch 'origin/master' into mvt-path-conf 2017-10-10 17:53:28 +02:00
Daniel García Aubert
02304dc450 Merge branch 'master' into stats-middleware 2017-10-10 16:56:35 +02:00
Daniel García Aubert
251e636ad2 Fix bad argument list while calling to staticMap function 2017-10-10 11:58:24 +02:00
Daniel García Aubert
a81e98995a Merge branch 'middlewarify' into stats-middleware 2017-10-09 17:54:32 +02:00
Simon Martín
484e0fda2f undo changing services params 2017-10-09 16:29:35 +02:00
Simon Martín
5c0f597cbb Merge branch 'middlewarify' into res-locals 2017-10-09 10:55:43 +02:00
David Manzanares
43885f130b Fix HTTP status code distinction between 200 and 204 2017-10-06 16:19:00 +02:00
David Manzanares
4e6253b717 Return HTTP 204 for empty tiles 2017-10-06 16:02:16 +02:00
Daniel García Aubert
242e63716f Merge branch 'middlewarify' into stats-middleware 2017-10-05 18:21:02 +02:00
Daniel García Aubert
c70b8cb5bf Set X-Served-By-DB-Host header in db-conn-setup middleware 2017-10-05 18:05:46 +02:00
Simon Martín
06138a82a8 Merge branch 'middlewarify' into res-locals 2017-10-05 17:53:15 +02:00
Daniel García Aubert
bf637ccd5b Implement stats middleware removing some duplicated code 2017-10-05 17:06:42 +02:00
Daniel García Aubert
b93c09959c Back to use just one router 2017-10-05 12:12:21 +02:00
Simon Martín
5abe25c316 undo style/format changes 2017-10-05 11:35:49 +02:00
Simon Martín
21720267cf from req.context to res.locals 2017-10-03 17:47:57 +02:00
Simon Martín
3ce10690d6 send res.locals instead of res when possible 2017-10-03 13:06:12 +02:00
Simon Martín
430e1513d8 fix incorrect function parameter 2017-10-03 13:00:52 +02:00
Simon Martín
f9d87bc40f res.locals fixing controllers 2017-10-02 12:07:35 +02:00
Simon Martín
783eb0eec7 res.locals format and layer in namep maps 2017-09-29 17:03:57 +02:00
Simon Martín
c22a35489d res.locals forgotten things and make jshint happy 2017-09-29 14:38:28 +02:00
Simon Martín
482feabce2 res.locals in named maps controller 2017-09-29 14:37:55 +02:00
Simon Martín
0a753400e0 res.locals in map controller 2017-09-29 12:54:21 +02:00
Simon Martín
a21648ab4a res.locals in layergroup controller 2017-09-29 12:32:46 +02:00
Simon Martín
b4d03c074a not move db params to res.locals.db 2017-09-29 11:07:11 +02:00
Simon Martín
f824fc5243 base and analyses controller 2017-09-28 12:02:34 +02:00
Simon
3f6afb4530 validation middleware for layer route (conflicting route) 2017-09-26 14:56:20 +02:00
Simon
540fda1e6c Merge branch 'master' into middlewarify 2017-09-26 14:53:57 +02:00
Daniel García Aubert
4899c7ffef Inject prepare context middleware to controllers 2017-09-25 19:40:27 +02:00
Raul Ochoa
b943b09532 Merge pull request #736 from CartoDB/static-named-maps-override-bbox
Static named maps override bbox
2017-09-25 14:10:27 +02:00
Daniel García Aubert
b236112069 Split prepare context middleware and fix unit test 2017-09-25 13:40:22 +02:00
Daniel García Aubert
3bab081438 Rename req2params by prepareContext 2017-09-22 17:56:47 +02:00
Daniel García Aubert
6dc9cc0b23 Remove req2params dependency 2017-09-22 17:56:08 +02:00
Daniel García Aubert
8fd35849c7 Merge branch 'middlewarify' of github.com:CartoDB/Windshaft-cartodb into middlewarify 2017-09-22 17:15:41 +02:00
Daniel García Aubert
0bdeee64a7 Use express router to group controllers' enpoints and reuse common middleware for named maps admin controller 2017-09-22 16:45:34 +02:00
Daniel García Aubert
ee8619c470 Use express router to group controllers' enpoints and reuse common middleware for analysis controller 2017-09-22 16:28:52 +02:00
Simon
9d81321d78 Merge branch 'master' into middlewarify 2017-09-22 16:26:56 +02:00
Simon Martín
ca63c2ef1a Merge pull request #721 from CartoDB/lzma-middleware
Implement LZMA query param inflating as middleware
2017-09-22 16:16:36 +02:00
Daniel García Aubert
b0486f9bae Use express router to group enpoints and reuse common middlewares for layergroup controller 2017-09-22 15:44:12 +02:00
Daniel García Aubert
9bd862ffaf Remove req2params from BaseController and update related test to use the middleware 2017-09-22 01:08:46 +02:00
Daniel García Aubert
8139cdf8b2 Use req2params middleware for name maps static views endpoint 2017-09-22 00:58:44 +02:00
Daniel García Aubert
a8898a8022 Use req2params middleware for name maps tile endpoint 2017-09-22 00:48:44 +02:00
Daniel García Aubert
df5ec0f4d9 Use req2params middleware for analysis catalog endpoint 2017-09-22 00:42:17 +02:00
Daniel García Aubert
51ba3db4ac Use req2params middleware for instantiate named map endpoint 2017-09-22 00:31:16 +02:00
Daniel García Aubert
d31e52a625 Fix format, break line in bad position 2017-09-21 22:55:30 +02:00
Daniel García Aubert
3a8b99a14e Use req2params middleware for tile and layer endpoint 2017-09-21 22:53:31 +02:00
Daniel García Aubert
fac1ab4a1c Use req2params middleware for attributes endpoint 2017-09-21 22:47:08 +02:00
Daniel García Aubert
a9b0acc317 Use req2params middleware for static map (bbox & center) endpoint 2017-09-21 22:43:59 +02:00
Daniel García Aubert
e2ed0058d8 Use req2params middleware for layergroup create endpoint 2017-09-21 21:52:34 +02:00
Daniel García Aubert
2f499a148a Use req2params middleware for dataview endpoint 2017-09-21 14:33:32 +02:00
Daniel García Aubert
49204650c6 Use req2params middleware for datavie search endpoint 2017-09-21 14:30:19 +02:00
Daniel García Aubert
234576ab5f Use req2params middleware for analisys node status endpoint 2017-09-21 13:37:32 +02:00
Daniel García Aubert
02cd6a43ad Move req2params method to a its own middleware 2017-09-21 13:27:22 +02:00
Daniel García Aubert
429f070372 Pass node's response object to req2params 2017-09-21 12:22:33 +02:00
Daniel García Aubert
3b9c561cee Change signature of req2params to follow express' middleware pattern 2017-09-21 11:54:37 +02:00
Daniel García Aubert
daeae5d95c Implement error-middleware to handle errors at top level 2017-09-21 11:46:42 +02:00
Raul Ochoa
91ce3a5489 Going green: allow to use bbox param, along lon, lat, and zoom
The `bbox` param was removed from the base controller, the rest kept
working as they are declared in the base, but it's better to declare
them here as well.

Fixes #735.
2017-08-29 13:05:03 +00:00
Raul Ochoa
69eaa72819 String comparison and regex to match errors instead of indexOf 2017-08-10 16:06:10 +02:00
Daniel García Aubert
14f85abd39 Merge branch 'master' into response-time-limit 2017-08-09 18:48:38 +02:00
Raul Ochoa
399561d076 Implement LZMA query param inflating as middleware
The req2params method is doing too many things,
this is an initial step to do fewer things in that method.
2017-08-04 17:30:46 +02:00
Daniel García Aubert
b2b68ffd5c Merge branch 'master' into 691-date-histogram 2017-08-01 16:07:27 +02:00
Daniel García Aubert
0594407b38 Change error message 2017-08-01 15:03:09 +02:00
Daniel García Aubert
44fc34b1ce Improve timeout error message 2017-07-31 20:07:31 +02:00
Daniel García Aubert
1fdc0621e7 Categorize timeout errors 2017-07-31 19:36:07 +02:00
Daniel García Aubert
5974413d5c Use 429 to indicate timeout errors 2017-07-31 19:08:29 +02:00
Daniel García Aubert
49d2f513c6 Fix typo 2017-07-31 18:51:23 +02:00
Daniel García Aubert
f2e043b063 Do not expose database error info 2017-07-31 17:56:58 +02:00
Daniel García Aubert
eccc3597aa Respond with 204 when vector tile is empty 2017-07-17 19:44:18 +02:00
Carlos Matallín
70b4d5b7fd replace timezone => offset 2017-07-14 18:30:36 +02:00
Daniel García Aubert
29a6658e3d Migrate dataviews endpoints to use the allow-query-params 2017-06-08 19:22:33 +02:00