Merge remote-tracking branch 'origin/master' into new_querytables_library
This commit is contained in:
commit
37fcfe69c7
27
NEWS.md
27
NEWS.md
@ -1,10 +1,35 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## 2.23.1
|
## 2.25.2
|
||||||
|
|
||||||
Released 2016-mm-dd
|
Released 2016-mm-dd
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 2.25.1
|
||||||
|
|
||||||
|
Released 2016-02-22
|
||||||
|
|
||||||
|
Announcements:
|
||||||
|
- Upgrades windshaft to [1.11.1](https://github.com/CartoDB/Windshaft/releases/tag/1.11.1)
|
||||||
|
|
||||||
|
|
||||||
|
## 2.25.0
|
||||||
|
|
||||||
|
Released 2016-02-18
|
||||||
|
|
||||||
|
Announcements:
|
||||||
|
- Upgrades windshaft to [1.11.0](https://github.com/CartoDB/Windshaft/releases/tag/1.11.0)
|
||||||
|
|
||||||
|
|
||||||
|
## 2.24.0
|
||||||
|
|
||||||
|
Released 2016-02-15
|
||||||
|
|
||||||
|
Announcements:
|
||||||
|
- Upgrades windshaft to [1.10.1](https://github.com/CartoDB/Windshaft/releases/tag/1.10.1)
|
||||||
|
|
||||||
|
|
||||||
## 2.23.0
|
## 2.23.0
|
||||||
|
|
||||||
Released 2016-02-10
|
Released 2016-02-10
|
||||||
|
13
README.md
13
README.md
@ -67,3 +67,16 @@ Contributing
|
|||||||
---
|
---
|
||||||
|
|
||||||
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
||||||
|
|
||||||
|
### Developing with a custom windshaft version
|
||||||
|
|
||||||
|
If you plan or want to use a custom / not released yet version of windshaft (or any other dependency) the best option is
|
||||||
|
to use `npm link`. You can read more about it at [npm-link: Symlink a package folder](https://docs.npmjs.com/cli/link).
|
||||||
|
|
||||||
|
**Quick start**:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
~/windshaft-directory $ npm install
|
||||||
|
~/windshaft-directory $ npm link
|
||||||
|
~/windshaft-cartodb-directory $ npm link windshaft
|
||||||
|
```
|
||||||
|
@ -461,6 +461,9 @@ cartodb.createLayer('map_dom_id',layerSource)
|
|||||||
[CartoDB.js](http://docs.cartodb.com/cartodb-platform/cartodb-js/) has methods for accessing your named maps.
|
[CartoDB.js](http://docs.cartodb.com/cartodb-platform/cartodb-js/) has methods for accessing your named maps.
|
||||||
|
|
||||||
1. [layer.setParams()](http://docs.cartodb.com/cartodb-platform/cartodb-js/api-methods/#layersetparamskey-value) allows you to change the template variables (in the placeholders object) via JavaScript
|
1. [layer.setParams()](http://docs.cartodb.com/cartodb-platform/cartodb-js/api-methods/#layersetparamskey-value) allows you to change the template variables (in the placeholders object) via JavaScript
|
||||||
|
|
||||||
|
**Note:** The CartoDB.js `layer.setParams()` function is not supported when using Named maps for Torque.
|
||||||
|
|
||||||
2. [layer.setAuthToken()](http://docs.cartodb.com/cartodb-platform/cartodb-js/api-methods/#layersetauthtokenauthtoken) allows you to set the auth tokens to create the layer
|
2. [layer.setAuthToken()](http://docs.cartodb.com/cartodb-platform/cartodb-js/api-methods/#layersetauthtokenauthtoken) allows you to set the auth tokens to create the layer
|
||||||
|
|
||||||
### Complete Examples of Named Maps created with CartoDB.js
|
### Complete Examples of Named Maps created with CartoDB.js
|
||||||
|
453
npm-shrinkwrap.json
generated
453
npm-shrinkwrap.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"name": "windshaft-cartodb",
|
"name": "windshaft-cartodb",
|
||||||
"version": "2.23.1",
|
"version": "2.25.2",
|
||||||
"description": "A map tile server for CartoDB",
|
"description": "A map tile server for CartoDB",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"cartodb"
|
"cartodb"
|
||||||
@ -26,7 +26,7 @@
|
|||||||
"node-statsd": "~0.0.7",
|
"node-statsd": "~0.0.7",
|
||||||
"underscore" : "~1.6.0",
|
"underscore" : "~1.6.0",
|
||||||
"dot": "~1.0.2",
|
"dot": "~1.0.2",
|
||||||
"windshaft": "1.9.0",
|
"windshaft": "1.11.1",
|
||||||
"step": "~0.0.6",
|
"step": "~0.0.6",
|
||||||
"queue-async": "~1.0.7",
|
"queue-async": "~1.0.7",
|
||||||
"request": "~2.62.0",
|
"request": "~2.62.0",
|
||||||
|
197
test/acceptance/widgets/named-maps.js
Normal file
197
test/acceptance/widgets/named-maps.js
Normal file
@ -0,0 +1,197 @@
|
|||||||
|
var assert = require('../../support/assert');
|
||||||
|
var step = require('step');
|
||||||
|
|
||||||
|
var helper = require('../../support/test_helper');
|
||||||
|
|
||||||
|
var CartodbWindshaft = require('../../../lib/cartodb/server');
|
||||||
|
var serverOptions = require('../../../lib/cartodb/server_options');
|
||||||
|
var server = new CartodbWindshaft(serverOptions);
|
||||||
|
|
||||||
|
var LayergroupToken = require('../../../lib/cartodb/models/layergroup_token');
|
||||||
|
|
||||||
|
describe('named-maps widgets', function() {
|
||||||
|
|
||||||
|
var username = 'localhost';
|
||||||
|
var widgetsTemplateName = 'widgets-template';
|
||||||
|
|
||||||
|
var layergroupid;
|
||||||
|
var keysToDelete;
|
||||||
|
|
||||||
|
beforeEach(function(done) {
|
||||||
|
keysToDelete = {};
|
||||||
|
|
||||||
|
var widgetsTemplate = {
|
||||||
|
version: '0.0.1',
|
||||||
|
name: widgetsTemplateName,
|
||||||
|
layergroup: {
|
||||||
|
version: '1.5.0',
|
||||||
|
layers: [
|
||||||
|
{
|
||||||
|
type: 'cartodb',
|
||||||
|
options: {
|
||||||
|
sql: "select * from populated_places_simple_reduced_private",
|
||||||
|
cartocss: '#layer { marker-fill: blue; }',
|
||||||
|
cartocss_version: '2.3.0',
|
||||||
|
widgets: {
|
||||||
|
country_places_count: {
|
||||||
|
type: 'aggregation',
|
||||||
|
options: {
|
||||||
|
column: 'adm0_a3',
|
||||||
|
aggregation: 'count'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
pop_max: {
|
||||||
|
type: 'histogram',
|
||||||
|
options: {
|
||||||
|
column: 'pop_max'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var template_params = {};
|
||||||
|
|
||||||
|
step(
|
||||||
|
function createTemplate()
|
||||||
|
{
|
||||||
|
var next = this;
|
||||||
|
assert.response(
|
||||||
|
server,
|
||||||
|
{
|
||||||
|
url: '/api/v1/map/named?api_key=1234',
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
host: username,
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
data: JSON.stringify(widgetsTemplate)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
status: 200
|
||||||
|
},
|
||||||
|
function(res, err) {
|
||||||
|
next(err, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
function instantiateTemplate(err, res) {
|
||||||
|
assert.ifError(err);
|
||||||
|
|
||||||
|
assert.deepEqual(JSON.parse(res.body), { template_id: widgetsTemplateName });
|
||||||
|
var next = this;
|
||||||
|
assert.response(
|
||||||
|
server,
|
||||||
|
{
|
||||||
|
url: '/api/v1/map/named/' + widgetsTemplateName,
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
host: username,
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
data: JSON.stringify(template_params)
|
||||||
|
},
|
||||||
|
{
|
||||||
|
status: 200
|
||||||
|
},
|
||||||
|
function(res) {
|
||||||
|
next(null, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
function fetchTile(err, res) {
|
||||||
|
assert.ifError(err);
|
||||||
|
|
||||||
|
var parsed = JSON.parse(res.body);
|
||||||
|
assert.ok(
|
||||||
|
parsed.hasOwnProperty('layergroupid'), "Missing 'layergroupid' from response body: " + res.body);
|
||||||
|
layergroupid = parsed.layergroupid;
|
||||||
|
|
||||||
|
keysToDelete['map_cfg|' + LayergroupToken.parse(parsed.layergroupid).token] = 0;
|
||||||
|
keysToDelete['user:localhost:mapviews:global'] = 5;
|
||||||
|
|
||||||
|
return done();
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(function(done) {
|
||||||
|
step(
|
||||||
|
function deleteTemplate(err) {
|
||||||
|
assert.ifError(err);
|
||||||
|
var next = this;
|
||||||
|
assert.response(
|
||||||
|
server,
|
||||||
|
{
|
||||||
|
url: '/api/v1/map/named/' + widgetsTemplateName + '?api_key=1234',
|
||||||
|
method: 'DELETE',
|
||||||
|
headers: {
|
||||||
|
host: username
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
status: 204
|
||||||
|
},
|
||||||
|
function(res, err) {
|
||||||
|
next(err, res);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
},
|
||||||
|
function deleteRedisKeys(err) {
|
||||||
|
assert.ifError(err);
|
||||||
|
helper.deleteRedisKeys(keysToDelete, done);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
function getWidget(widgetName, callback) {
|
||||||
|
assert.response(
|
||||||
|
server,
|
||||||
|
{
|
||||||
|
url: '/api/v1/map/' + layergroupid + '/0/widget/' + widgetName,
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
host: username
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
status: 200
|
||||||
|
},
|
||||||
|
function(res, err) {
|
||||||
|
if (err) {
|
||||||
|
return callback(err);
|
||||||
|
}
|
||||||
|
var parsedBody = JSON.parse(res.body);
|
||||||
|
return callback(err, res, parsedBody);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
it("should retrieve aggregation", function(done) {
|
||||||
|
getWidget('country_places_count', function(err, response, aggregation) {
|
||||||
|
assert.ok(!err, err);
|
||||||
|
|
||||||
|
assert.equal(aggregation.type, 'aggregation');
|
||||||
|
assert.equal(aggregation.max, 769);
|
||||||
|
|
||||||
|
return done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should retrieve histogram", function(done) {
|
||||||
|
getWidget('pop_max', function(err, response, histogram) {
|
||||||
|
assert.ok(!err, err);
|
||||||
|
|
||||||
|
assert.equal(histogram.type, 'histogram');
|
||||||
|
assert.equal(histogram.bin_width, 743250);
|
||||||
|
|
||||||
|
return done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
@ -7385,3 +7385,8 @@ GRANT ALL ON TABLE populated_places_simple_reduced TO :TESTUSER;
|
|||||||
GRANT SELECT ON TABLE populated_places_simple_reduced TO :PUBLICUSER;
|
GRANT SELECT ON TABLE populated_places_simple_reduced TO :PUBLICUSER;
|
||||||
|
|
||||||
VACUUM ANALYZE populated_places_simple_reduced;
|
VACUUM ANALYZE populated_places_simple_reduced;
|
||||||
|
|
||||||
|
create table populated_places_simple_reduced_private AS
|
||||||
|
select * from populated_places_simple_reduced;
|
||||||
|
|
||||||
|
GRANT ALL ON TABLE populated_places_simple_reduced_private TO :TESTUSER;
|
||||||
|
Loading…
Reference in New Issue
Block a user