Jelajahi Sumber

Fixed js routes

Andrew Kane 8 tahun lalu
induk
melakukan
6b37b54525

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

@@ -30,7 +30,7 @@ function runNext() {
 
 function runQueryHelper(query) {
   var xhr = $.ajax({
-    url: Routes.blazer_run_queries_path(),
+    url: Routes.run_queries_path(),
     method: "POST",
     data: query.data,
     dataType: "html"
@@ -89,7 +89,7 @@ function cancelQuery(query) {
   }
 
   // tell server
-  var path = Routes.blazer_cancel_queries_path()
+  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))

+ 1 - 1
app/assets/javascripts/blazer/routes.js.erb

@@ -1 +1 @@
-<%= JsRoutes.generate(include: /blazer/) %>
+<%= JsRoutes.generate(engine: Blazer::Engine, prefix: Blazer::Engine.app.url_helpers.root_path) %>

+ 2 - 2
app/views/blazer/queries/_form.html.erb

@@ -79,7 +79,7 @@
     },
     computed: {
       dataSourcePath: function() {
-        return Routes.blazer_schema_queries_path({data_source: this.dataSource})
+        return Routes.schema_queries_path({data_source: this.dataSource})
       }
     },
     methods: {
@@ -116,7 +116,7 @@
         this.dataSource = dataSource
         var _this = this
 
-        $.getJSON(Routes.blazer_tables_queries_path({data_source: this.dataSource}), function(data) {
+        $.getJSON(Routes.tables_queries_path({data_source: this.dataSource}), function(data) {
           var newOptions = []
           for (var i = 0; i < data.length; i++) {
             newOptions.push({text: data[i], value: data[i]})

+ 3 - 3
app/views/blazer/queries/home.html.erb

@@ -86,7 +86,7 @@
       if (this.more) {
         var _this = this
 
-        $.getJSON(Routes.blazer_queries_path(), function (data) {
+        $.getJSON(Routes.queries_path(), function (data) {
           var i, j, newValues, val, size = 500;
 
           var newValues = []
@@ -138,9 +138,9 @@
     methods: {
       itemPath: function (item) {
         if (item.dashboard) {
-          return Routes.blazer_dashboard_path(item.to_param)
+          return Routes.dashboard_path(item.to_param)
         } else {
-          return Routes.blazer_query_path(item.to_param)
+          return Routes.query_path(item.to_param)
         }
       }
     }