Since we are supporting dataviews having an analysis as a type of source (https://github.com/CartoDB/cartodb.js/issues/1212), we now need to store the sourceId (the id of the analysis) whenever we create a widget.
/cc @alonsogarciapablo
Also, it should be included in the viz.json so that we can set up dataviews correctly when we load them from the viz.json.
After talking to @rochoa he confirmed that this should send this to Maps API:
{
options: { ... },
source: { 'id': id },
type
}
Actually it should "source": {"id": id} as we do in the layers. Check this example: https://github.com/CartoDB/Windshaft-cartodb/commit/146d494cae7c58f20e12c8b3b7abdb3da32f5818
HTH 馃槃
True (not the first time I must do this ;-) ). Updated example.
Just for the record, for layers, the source: { id: 'something' } is inside of the options key in the viz.json.... I don't have any preference but just saying...
Also, FYI, deep-insights.js will need to convert whatever we go with when parsing the viz.json cause CartoDB.js works with sourceId internally (which is then converted to source: { id: 'something' } when talking to the Maps API).
Frontend currently send source outside options. I might understand having it both inside and outside options. Is there a good reason for editor to send it _outside_ options and cartodb.js expecting it _inside_ options in the vizjson? I don't mind, but having to move it at the backend _really_ smells wrong.
@javierarce frontend currently sends source_id: id (current status of branch at #7217). It's not a problem for me, but maybe you'd like to send source: { id: id } instead so you handle it the same way for requests and responses. That will be the format used at vizjson and named map template as well.
Thanks, @juanignaciosl, I'll do the change.
Merged into 7118-attach-widget-to-analysis.