Browse Source

Fixed query cancellation

Andrew Kane 6 years ago
parent
commit
e451da2428

+ 1 - 0
CHANGELOG.md

@@ -1,6 +1,7 @@
 ## 1.8.1 [unreleased]
 
 - Added support for Amazon Athena
+- Fixed query cancellation
 
 ## 1.8.0
 

+ 2 - 2
app/assets/javascripts/blazer/queries.js

@@ -95,7 +95,7 @@ function cancelQuery(query) {
   var path = Routes.cancel_queries_path()
   var data = {run_id: query.run_id, data_source: query.data_source}
   if (navigator.sendBeacon) {
-    navigator.sendBeacon(path, csrfProtect(data))
+    navigator.sendBeacon(path + "?" + $.param(csrfProtect(data)))
   } else {
     // TODO make sync
     $.post(path, data)
@@ -106,5 +106,5 @@ function csrfProtect(payload) {
   var param = $("meta[name=csrf-param]").attr("content")
   var token = $("meta[name=csrf-token]").attr("content")
   if (param && token) payload[param] = token
-  return new Blob([JSON.stringify(payload)], {type : "application/json; charset=utf-8"})
+  return payload
 }

+ 1 - 1
app/controllers/blazer/queries_controller.rb

@@ -183,7 +183,7 @@ module Blazer
 
     def cancel
       Blazer.data_sources[params[:data_source]].cancel(blazer_run_id)
-      render json: {}
+      head :ok
     end
 
     private