Skip to content

Add plotlyServerUrl to baseUrl #2760

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 27, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/plot_api/plot_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ module.exports = {
// no interactivity, for export or image generation
staticPlot: false,

// base url for the 'Edit in Chart Studio' (aka sendDataToCloud) mode bar button
// base URL for the 'Edit in Chart Studio' (aka sendDataToCloud) mode bar button
// and the showLink/sendData on-graph link
plotlyServerUrl: 'https://plot.ly',
plotlyServerURL: 'https://plot.ly',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good call, that also seems more standard in the built-in API (eg canvas.toDataURL) though we have some other internal routines that use ...Url, like Drawing.setClipUrl.


/*
* we can edit titles, move annotations, etc - sets all pieces of `edits`
Expand Down
2 changes: 1 addition & 1 deletion src/plots/plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ function positionPlayWithData(gd, container) {
plots.sendDataToCloud = function(gd) {
gd.emit('plotly_beforeexport');

var baseUrl = (window.PLOTLYENV || {}).BASE_URL || gd._context.plotlyServerUrl;
var baseUrl = (window.PLOTLYENV || {}).BASE_URL || gd._context.plotlyServerURL;

var hiddenformDiv = d3.select(gd)
.append('div')
Expand Down
12 changes: 6 additions & 6 deletions test/jasmine/tests/config_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ describe('config argument', function() {
});
});

describe('plotlyServerUrl:', function() {
describe('plotlyServerURL:', function() {
var gd;
var form;

Expand All @@ -488,7 +488,7 @@ describe('config argument', function() {
it('should default to plotly cloud', function(done) {
Plotly.plot(gd, [], {})
.then(function() {
expect(gd._context.plotlyServerUrl).toBe('https://plot.ly');
expect(gd._context.plotlyServerURL).toBe('https://plot.ly');

Plotly.Plots.sendDataToCloud(gd);
expect(form.action).toBe('https://plot.ly/external');
Expand All @@ -499,9 +499,9 @@ describe('config argument', function() {
});

it('can be set to other base urls', function(done) {
Plotly.plot(gd, [], {}, {plotlyServerUrl: 'dummy'})
Plotly.plot(gd, [], {}, {plotlyServerURL: 'dummy'})
.then(function() {
expect(gd._context.plotlyServerUrl).toBe('dummy');
expect(gd._context.plotlyServerURL).toBe('dummy');

Plotly.Plots.sendDataToCloud(gd);
expect(form.action).toContain('/dummy/external');
Expand All @@ -514,9 +514,9 @@ describe('config argument', function() {
it('has lesser priotiy then window env', function(done) {
window.PLOTLYENV = {BASE_URL: 'yo'};

Plotly.plot(gd, [], {}, {plotlyServerUrl: 'dummy'})
Plotly.plot(gd, [], {}, {plotlyServerURL: 'dummy'})
.then(function() {
expect(gd._context.plotlyServerUrl).toBe('dummy');
expect(gd._context.plotlyServerURL).toBe('dummy');

Plotly.Plots.sendDataToCloud(gd);
expect(form.action).toContain('/yo/external');
Expand Down