Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion draftlogs/7802_change.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
- Update `sendDataToCloud` modebar button to upload chart to Plotly Cloud [[#7802](https://github.com/plotly/plotly.js/pull/7802), [#7852](https://github.com/plotly/plotly.js/pull/7852)]
- Update `sendDataToCloud` modebar button to upload chart to Plotly Cloud [[#7802](https://github.com/plotly/plotly.js/pull/7802), [#7852](https://github.com/plotly/plotly.js/pull/7852), [#7854](https://github.com/plotly/plotly.js/pull/7854)]
- NOTE: The Plotly Cloud endpoint for receiving charts is not yet functional, so this button won't complete the upload.
6 changes: 5 additions & 1 deletion src/plots/plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,11 @@ plots.sendDataToCloud = function(gd, serverURL) {

// Open the Cloud login page in a new tab. We keep a reference so we can post
// the chart back to it once Cloud reports that authentication succeeded.
var cloudWindow = window.open(serverURL, '_blank');
// Pass the current page's origin as a query string so Cloud knows where to
// send the CHART_AUTH_SUCCESS message back to.
var uploadUrl = new URL(serverURL);
uploadUrl.searchParams.set('origin', window.location.origin);
var cloudWindow = window.open(uploadUrl.href, '_blank');
if(!cloudWindow) {
console.error('Unable to open Plotly Cloud (the popup may have been blocked)');
gd.emit('plotly_exportfail');
Expand Down
5 changes: 3 additions & 2 deletions test/jasmine/tests/config_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,9 @@ describe('config argument', function() {
expect(confirmBtn).not.toBe(null, 'confirm button should be shown');
mouseEvent('click', 0, 0, {element: confirmBtn});

// Should open the provided URL's origin in a new tab
expect(openSpy).toHaveBeenCalledWith('https://example.plotly.com/endpoint', '_blank');
// Should open the provided URL's origin in a new tab,
// adding the current page's origin as a query parameter
expect(openSpy).toHaveBeenCalledWith('https://example.plotly.com/endpoint?origin=http%3A%2F%2Flocalhost%3A9876', '_blank');
})
.then(done, done.fail);
});
Expand Down