-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Conversation
|
Ok. I'll take it from here. Will be part of |
test/jasmine/tests/config_test.js
Outdated
| it('can be set to other base urls', function(done) { | ||
| Plotly.plot(gd, [], {}, {plotlyServerUrl: 'dummy'}) | ||
| .then(function() { | ||
| expect(gd._context.plotlyServerUrl).toBe('dummy'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These tests aren't great, but I couldn't find an easy way to mock the form submit in
Lines 214 to 245 in bcab36e
| plots.sendDataToCloud = function(gd) { | |
| gd.emit('plotly_beforeexport'); | |
| var baseUrl = (window.PLOTLYENV && window.PLOTLYENV.BASE_URL) || 'https://plot.ly'; | |
| var hiddenformDiv = d3.select(gd) | |
| .append('div') | |
| .attr('id', 'hiddenform') | |
| .style('display', 'none'); | |
| var hiddenform = hiddenformDiv | |
| .append('form') | |
| .attr({ | |
| action: baseUrl + '/external', | |
| method: 'post', | |
| target: '_blank' | |
| }); | |
| var hiddenformInput = hiddenform | |
| .append('input') | |
| .attr({ | |
| type: 'text', | |
| name: 'data' | |
| }); | |
| hiddenformInput.node().value = plots.graphJson(gd, false, 'keepdata'); | |
| hiddenform.node().submit(); | |
| hiddenformDiv.remove(); | |
| gd.emit('plotly_afterexport'); | |
| return false; | |
| }; |
... to match topojsonURL config option
| beforeEach(function() { | ||
| gd = createGraphDiv(); | ||
| spyOn(HTMLFormElement.prototype, 'submit').and.callFake(function() { | ||
| form = this; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you @alexcjohnson for the tip!
| // 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', |
There was a problem hiding this comment.
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.
Fixes #2759 (comment)
I haven't tested this.