Pārlūkot izejas kodu

[pig] Exclude HCat autocomplete if autocomplete URL is empty

Enrico Berti 11 gadi atpakaļ
vecāks
revīzija
a9a9eb51ed

+ 14 - 13
apps/beeswax/static/js/autocomplete.utils.js

@@ -16,20 +16,21 @@
 
 function hac_jsoncalls(options) {
   var _url = typeof options.autocompleteBaseURL != "undefined" ? options.autocompleteBaseURL : HIVE_AUTOCOMPLETE_BASE_URL;
-    
-  if (options.database != null) {
-    _url += options.database
-  }
-  if (options.table != null) {
-    _url += "/" + options.table
-  }
+  if (_url != ""){
+    if (options.database != null) {
+      _url += options.database
+    }
+    if (options.table != null) {
+      _url += "/" + options.table
+    }
 
-  $.ajax({
-    type: "GET",
-    url: _url + "?" + Math.random(),
-    success: options.onDataReceived,
-    async: options.sync == "undefined"
-  });
+    $.ajax({
+      type: "GET",
+      url: _url + "?" + Math.random(),
+      success: options.onDataReceived,
+      async: options.sync == "undefined"
+    });
+  }
 }
 
 function hac_hasExpired(timestamp){

+ 1 - 1
apps/pig/src/pig/templates/app.mako

@@ -933,7 +933,7 @@ ${ commonshare() | n,unicode }
           }
           var _showHCatHint = false;
           if (_line.indexOf(KLASS) == -1) {
-            if (_partial.indexOf("'") == _partial.length - 1) {
+            if (_partial.indexOf("'") == _partial.length - 1 && HIVE_AUTOCOMPLETE_BASE_URL != "") {
               _showHCatHint = true;
             }
             showHdfsAutocomplete(_autocompleteUrl + "?format=json", _showHCatHint);