Merge pull request #66457 from AVMusorin/add-play-now-param

Allow run query instantly in play
This commit is contained in:
Alexey Milovidov 2024-08-06 00:50:51 +00:00 committed by GitHub
commit 3419b916a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -522,6 +522,9 @@
const current_url = new URL(window.location);
const opened_locally = location.protocol == 'file:';
/// Run query instantly after page is loaded if the run parameter is present.
const run_immediately = current_url.searchParams.has("run");
const server_address = current_url.searchParams.get('url');
if (server_address) {
document.getElementById('url').value = server_address;
@ -599,6 +602,9 @@
const title = "ClickHouse Query: " + query;
let history_url = window.location.pathname + '?user=' + encodeURIComponent(user);
if (run_immediately) {
history_url += "&run=1";
}
if (server_address != location.origin) {
/// Save server's address in URL if it's not identical to the address of the play UI.
history_url += '&url=' + encodeURIComponent(server_address);
@ -1160,6 +1166,10 @@
});
}
if (run_immediately) {
post();
}
document.getElementById('toggle-light').onclick = function() {
setColorTheme('light', true);
}