You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by cs...@apache.org on 2019/09/11 13:06:42 UTC

[impala] 01/03: IMPALA-8897 (part 3): Fix some additional javascript urls

This is an automated email from the ASF dual-hosted git repository.

csringhofer pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit b11a985677ab49f1db114ee39719fce1d19f5747
Author: Thomas Tauber-Marshall <tm...@cloudera.com>
AuthorDate: Tue Sep 10 12:59:49 2019 -0700

    IMPALA-8897 (part 3): Fix some additional javascript urls
    
    Part 2 of this patch missed rewriting two urls in javascript.
    This patch fixes it by adding 'make_url()' around those urls.
    
    Testing:
    - Deployed to a real cluster and verified that Knox integreation
      works correctly on the relevant pages now.
    - Extended test_knox_integration to check for this case.
    
    Change-Id: I07a099b3a23324ad56133c5584d6a9bc88541582
    Reviewed-on: http://gerrit.cloudera.org:8080/14206
    Reviewed-by: Tim Armstrong <ta...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 tests/webserver/test_web_pages.py | 5 ++++-
 www/query_backends.tmpl           | 2 +-
 www/query_finstances.tmpl         | 2 +-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/tests/webserver/test_web_pages.py b/tests/webserver/test_web_pages.py
index 98d4801..771a67c 100644
--- a/tests/webserver/test_web_pages.py
+++ b/tests/webserver/test_web_pages.py
@@ -675,7 +675,10 @@ class TestWebPage(ImpalaTestSuite):
     form_regex = "<form [^{]*?>(?!{{>www/form-hidden-inputs.tmpl}})"
     # Matches XMLHttpRequest.open() in javascript that are not followed with make_url().
     javascript_regex = "open\(['\"]GET['\"], (?!make_url)"
-    regex = "(%s)|(%s)|(%s)" % (href_regex, form_regex, javascript_regex)
+    # Matches urls in json parameters passed to DataTables.
+    datatables_regex = "url: ['\"](?!make_url)"
+    regex = "(%s)|(%s)|(%s)|(%s)" % \
+        (href_regex, form_regex, javascript_regex, datatables_regex)
     results = grep_dir(os.path.join(os.environ['IMPALA_HOME'], "www"), regex, ".*\.tmpl")
     assert len(results) == 0, \
         "All links on the webui must include the webserver host: %s" % results
diff --git a/www/query_backends.tmpl b/www/query_backends.tmpl
index fedae37..0ff32cd 100644
--- a/www/query_backends.tmpl
+++ b/www/query_backends.tmpl
@@ -60,7 +60,7 @@ var refresh = function () {
 
 $(document).ready(function() {
     table = $('#backends').DataTable({
-        ajax: { url: "/query_backends?query_id={{query_id}}&json",
+        ajax: { url: make_url("/query_backends?query_id={{query_id}}&json"),
                 dataSrc: "backend_states",
               },
         "columns": [ {data: 'host'},
diff --git a/www/query_finstances.tmpl b/www/query_finstances.tmpl
index 5d8ba33..806235d 100644
--- a/www/query_finstances.tmpl
+++ b/www/query_finstances.tmpl
@@ -90,7 +90,7 @@ function unpackJson(json) {
 
 $(document).ready(function() {
     table = $('#finstances').DataTable({
-        ajax: { url: "/query_finstances?query_id={{query_id}}&json",
+        ajax: { url: make_url("/query_finstances?query_id={{query_id}}&json"),
                 dataSrc: unpackJson,
               },
         "columns": [ {data: 'host'},