You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by st...@apache.org on 2019/10/28 15:16:15 UTC
[impala] 01/02: IMPALA-9066: Add a favicon to the webui
This is an automated email from the ASF dual-hosted git repository.
stakiar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git
commit 6be37f9f400660e07e799af8a43c6bba21468c87
Author: Thomas Tauber-Marshall <tm...@cloudera.com>
AuthorDate: Thu Oct 17 15:00:18 2019 -0700
IMPALA-9066: Add a favicon to the webui
This favicon was generated by taking a standard Impala logo svg and
converting it to a .ico
Also fixes some <script> tags that didn't have their 'src' properly
qualified for Knox integration.
Testing:
- Manually verified the favicon appears as expected in Firefox and
Chrome.
- Added '<script>' tags to test_knox_compatability
- Manually verified the favicon and the modified '<script>'s work
as expected when using Knox.
Change-Id: If151d56d40e271cc438f992b221d43bc89d3b0fc
Reviewed-on: http://gerrit.cloudera.org:8080/14500
Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
bin/rat_exclude_files.txt | 1 +
tests/webserver/test_web_pages.py | 8 +++++---
www/common-header.tmpl | 1 +
www/favicon.ico | Bin 0 -> 1150 bytes
www/query_plan.tmpl | 4 ++--
www/query_stmt.tmpl | 4 ++--
6 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/bin/rat_exclude_files.txt b/bin/rat_exclude_files.txt
index aefaeef..e7859ab 100644
--- a/bin/rat_exclude_files.txt
+++ b/bin/rat_exclude_files.txt
@@ -36,6 +36,7 @@ www/DataTables*/*
www/datatables-1.10.18.*
www/bootstrap/css/bootstrap*
www/bootstrap/js/bootstrap*
+www/favicon.ico
tests/comparison/leopard/static/css/bootstrap*
tests/comparison/leopard/static/fonts/glyphicons-halflings*
tests/comparison/leopard/static/js/bootstrap*
diff --git a/tests/webserver/test_web_pages.py b/tests/webserver/test_web_pages.py
index dd1981f..260e06d 100644
--- a/tests/webserver/test_web_pages.py
+++ b/tests/webserver/test_web_pages.py
@@ -683,15 +683,17 @@ class TestWebPage(ImpalaTestSuite):
# on the same page an so doesn't need to the hostname) or '{{ __common__.host-url }}'
# Note that if we ever need to add a link that doesn't conform to this, we will
# probably also have to change the Knox service definition.
- href_regex = "<a .*? href=['\"](?!({{ __common__.host-url }})|#)"
+ href_regex = "<(a|link) .*? href=['\"](?!({{ __common__.host-url }})|#)"
+ # Matches all 'script' tags that aren't absoluve urls.
+ script_regex = "<script .*?src=['\"](?!({{ __common__.host-url }})|http)"
# Matches all 'form' tags that are not followed by including the hidden inputs.
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)"
# 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)
+ regex = "(%s)|(%s)|(%s)|(%s)|(%s)" % \
+ (href_regex, script_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/common-header.tmpl b/www/common-header.tmpl
index 00287e7..fa622dd 100644
--- a/www/common-header.tmpl
+++ b/www/common-header.tmpl
@@ -27,6 +27,7 @@ common-footer.tmpl) }}
<link rel="stylesheet" type="text/css" href="{{ __common__.host-url }}/www/datatables-1.10.18.min.css"/>
<script type="text/javascript" src="{{ __common__.host-url }}/www/datatables-1.10.18.min.js"></script>
<link href='{{ __common__.host-url }}/www/bootstrap/css/bootstrap-4.3.1.min.css' rel='stylesheet' media='screen'>
+ <link rel='icon' href='{{ __common__.host-url }}/www/favicon.ico'>
<style>
@media (min-width: 1300px) {
#nav-options {
diff --git a/www/favicon.ico b/www/favicon.ico
new file mode 100644
index 0000000..7cbfe93
Binary files /dev/null and b/www/favicon.ico differ
diff --git a/www/query_plan.tmpl b/www/query_plan.tmpl
index a644257..5cedc6a 100644
--- a/www/query_plan.tmpl
+++ b/www/query_plan.tmpl
@@ -67,8 +67,8 @@ under the License.
{{> www/common-footer.tmpl }}
-<script src="www/d3.v3.min.js" charset="utf-8"></script>
-<script src="www/dagre-d3.min.js"></script>
+<script src="{{ __common__.host-url }}/www/d3.v3.min.js" charset="utf-8"></script>
+<script src="{{ __common__.host-url }}/www/dagre-d3.min.js"></script>
<!-- Builds and then renders a plan graph using Dagre / D3. The JSON for the current query
is retrieved by an HTTP call, and then the graph of nodes and edges is built by walking
diff --git a/www/query_stmt.tmpl b/www/query_stmt.tmpl
index cf6c265..0ad6770 100644
--- a/www/query_stmt.tmpl
+++ b/www/query_stmt.tmpl
@@ -26,8 +26,8 @@ under the License.
<!-- Enable the 'highlight' library, which does syntax highlighting of query
statements -->
-<link rel="stylesheet" href="www/highlight/styles/default.css">
-<script src="www/highlight/highlight.pack.js"></script>
+<link rel="stylesheet" href="{{ __common__.host-url }}/www/highlight/styles/default.css">
+<script src="{{ __common__.host-url }}/www/highlight/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
{{?stmt}}<pre class="code"><code>{{stmt}}</code></pre>{{/stmt}}