Skip to content

Commit 4849269

Browse files
authored
Merge pull request #4690 from plotly/blank-plotly-server-url-default
Disable plotly server URL by default
2 parents 7c67896 + d81e598 commit 4849269

File tree

3 files changed

+32
-11
lines changed

3 files changed

+32
-11
lines changed

src/plot_api/plot_config.js

+10-6
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,14 @@ var configAttributes = {
3232

3333
plotlyServerURL: {
3434
valType: 'string',
35-
dflt: 'https://plot.ly',
35+
dflt: '',
3636
description: [
37-
'Sets base URL for the \'Edit in Chart Studio\' (aka sendDataToCloud) mode bar button',
38-
'and the showLink/sendData on-graph link'
37+
'When set it determines base URL for',
38+
'the \'Edit in Chart Studio\' `showEditInChartStudio`/`showSendToCloud` mode bar button',
39+
'and the showLink/sendData on-graph link.',
40+
'To enable sending your data to Chart Studio Cloud, you need to',
41+
'set both `plotlyServerURL` to \'https://chart-studio.plotly.com\' and',
42+
'also set `showSendToCloud` to true.'
3943
].join(' ')
4044
},
4145

@@ -261,10 +265,10 @@ var configAttributes = {
261265
dflt: false,
262266
description: [
263267
'Should we include a ModeBar button, labeled "Edit in Chart Studio",',
264-
'that sends this chart to plot.ly or another plotly server as specified',
265-
'by `plotlyServerURL` for editing, export, etc? Prior to version 1.43.0',
268+
'that sends this chart to chart-studio.plotly.com (formerly plot.ly) or another plotly server',
269+
'as specified by `plotlyServerURL` for editing, export, etc? Prior to version 1.43.0',
266270
'this button was included by default, now it is opt-in using this flag.',
267-
'Note that this button can (depending on `plotlyServerURL`) send your data',
271+
'Note that this button can (depending on `plotlyServerURL` being set) send your data',
268272
'to an external server. However that server does not persist your data',
269273
'until you arrive at the Chart Studio and explicitly click "Save".'
270274
].join(' ')

src/plots/plots.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,10 @@ function positionPlayWithData(gd, container) {
215215
}
216216

217217
plots.sendDataToCloud = function(gd) {
218-
gd.emit('plotly_beforeexport');
219-
220218
var baseUrl = (window.PLOTLYENV || {}).BASE_URL || gd._context.plotlyServerURL;
219+
if(!baseUrl) return;
220+
221+
gd.emit('plotly_beforeexport');
221222

222223
var hiddenformDiv = d3.select(gd)
223224
.append('div')

test/jasmine/tests/config_test.js

+19-3
Original file line numberDiff line numberDiff line change
@@ -501,13 +501,29 @@ describe('config argument', function() {
501501

502502
afterEach(destroyGraphDiv);
503503

504-
it('should default to plotly cloud', function(done) {
504+
it('should not default to an external plotly cloud', function(done) {
505505
Plotly.plot(gd, [], {})
506506
.then(function() {
507-
expect(gd._context.plotlyServerURL).toBe('https://plot.ly');
507+
expect(gd._context.plotlyServerURL).not.toBe('https://plot.ly');
508+
expect(gd._context.plotlyServerURL).not.toBe('https://chart-studio.plotly.com');
509+
expect(gd._context.plotlyServerURL).toBe('');
508510

509511
Plotly.Plots.sendDataToCloud(gd);
510-
expect(form.action).toBe('https://plot.ly/external');
512+
expect(form).toBe(undefined);
513+
})
514+
.catch(failTest)
515+
.then(done);
516+
});
517+
518+
it('should be able to connect to Chart Studio Cloud when set to https://chart-studio.plotly.com', function(done) {
519+
Plotly.plot(gd, [], {}, {
520+
plotlyServerURL: 'https://chart-studio.plotly.com'
521+
})
522+
.then(function() {
523+
expect(gd._context.plotlyServerURL).toBe('https://chart-studio.plotly.com');
524+
525+
Plotly.Plots.sendDataToCloud(gd);
526+
expect(form.action).toBe('https://chart-studio.plotly.com/external');
511527
expect(form.method).toBe('post');
512528
})
513529
.catch(failTest)

0 commit comments

Comments
 (0)