You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ka...@apache.org on 2021/01/19 19:07:47 UTC
[airflow] branch v2-0-test updated: Override UI with Astro theme,
add AC version in footer
This is an automated email from the ASF dual-hosted git repository.
kaxilnaik pushed a commit to branch v2-0-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/v2-0-test by this push:
new 16553ab Override UI with Astro theme, add AC version in footer
16553ab is described below
commit 16553ab82d0904952897df595cbf44d5250edd2a
Author: Ryan Hamilton <ry...@ryanahamilton.com>
AuthorDate: Fri Oct 2 14:19:17 2020 -0400
Override UI with Astro theme, add AC version in footer
(cherry picked from commit f38532d16617d4daee648054d2acf2a6fe012998)
---
airflow/www/extensions/init_jinja_globals.py | 21 ++++++++
airflow/www/static/css/astro-theme.css | 77 ++++++++++++++++++++++++++++
airflow/www/templates/airflow/main.html | 19 ++++++-
airflow/www/webpack.config.js | 1 +
4 files changed, 117 insertions(+), 1 deletion(-)
diff --git a/airflow/www/extensions/init_jinja_globals.py b/airflow/www/extensions/init_jinja_globals.py
index 76c3306..78c20aa 100644
--- a/airflow/www/extensions/init_jinja_globals.py
+++ b/airflow/www/extensions/init_jinja_globals.py
@@ -20,6 +20,11 @@ import socket
import pendulum
+try:
+ import importlib_metadata
+except ImportError:
+ from importlib import metadata as importlib_metadata
+
import airflow
from airflow.configuration import conf
from airflow.settings import IS_K8S_OR_K8SCELERY_EXECUTOR, STATE_COLORS
@@ -47,12 +52,25 @@ def init_jinja_globals(app):
try:
airflow_version = airflow.__version__
+ airflow_upstream_version = airflow_version.split('.dev')[0].split('+astro')[0]
+ ac_url_version = airflow_upstream_version.replace('.', '-')
except Exception as e: # pylint: disable=broad-except
airflow_version = None
+ airflow_upstream_version = None
+ ac_url_version = None
logging.error(e)
git_version = get_airflow_git_version()
+ try:
+ ac_version = importlib_metadata.version('astronomer-certified')
+ except importlib_metadata.PackageNotFoundError:
+ # Try to work out ac_version from airflow version
+ if airflow_version:
+ ac_version = airflow_version.replace('+astro.', '-')
+ else:
+ ac_version = None
+
def prepare_jinja_globals():
extra_globals = {
'server_timezone': server_timezone,
@@ -66,6 +84,9 @@ def init_jinja_globals(app):
'airflow_version': airflow_version,
'git_version': git_version,
'k8s_or_k8scelery_executor': IS_K8S_OR_K8SCELERY_EXECUTOR,
+ 'ac_version': ac_version,
+ 'airflow_upstream_version': airflow_upstream_version,
+ 'ac_url_version': ac_url_version,
}
if 'analytics_tool' in conf.getsection('webserver'):
diff --git a/airflow/www/static/css/astro-theme.css b/airflow/www/static/css/astro-theme.css
new file mode 100644
index 0000000..154d8d7
--- /dev/null
+++ b/airflow/www/static/css/astro-theme.css
@@ -0,0 +1,77 @@
+/*!
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/* Encoded Fonts */
+@font-face {
+ font-family: 'GoodSans';
+ src:
+ url(data:application/font-woff2;charset=utf-8;base64,d09GMgABAAAAAEMoAA8AAAAAycAAAELJAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP0ZGVE0cGiob3BIciXgGYACHdhEICoHyPIG5JguGJAABNgIkA4xEBCAFihkHkVEb+6hXwm67eU+RdCeA2lbv7b4PBcqxHeVuqWIeYc8Oxh4HwOuq2f///6ckqDFkgHr4qm6rKiMES8Oykx0hUw6XfaY81v2ynRKy0yWT4zq3oy4VFctLbfeQdjfh/WAK1NzLRrSSYeNyau49wwnzLD8aJf64yz6WcSfEvmvt2YcN01LBpCiLdqhmftiDTwDfzxQOQZBkhpDpsxxqQXRTklQgJNYuU/z7h1nxPNGls7F7maqteMdZY9oV/bP0VF8ENi5jJCsnLwW0RmT17DwgqleMoIiTuPgoQE1ogVUk8q0Pz2/zz70veQG [...]
+ url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAF7gAA8AAAAAycAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAABexAAAABoAAAAciqv440dERUYAAEkMAAAAKgAAACoCpwPnR1BPUwAAS2QAABNfAAAuEjIKE4dHU1VCAABJOAAAAiwAAAT4m+fp7k9TLzIAAAHQAAAATwAAAGBpba58Y21hcAAABUQAAAK5AAAD9vu6BIZnYXNwAABJBAAAAAgAAAAI//8AA2dseWYAAAsgAAA2jwAAeTwL1GYnaGVhZAAAAVgAAAA0AAAANhXMFd5oaGVhAAABjAAAACEAAAAkBY8GTGhtdHgAAAIgAAADIQAABkQC/TafbG9jYQAACAAAAAMdAAADJI3FrNRtYXhwAAABsAAAAB4AAAAgAdkAQ25hbWUAAEGwAAACRAAABRkVEfSi [...]
+ font-weight: 500;
+ font-style: normal;
+}
+
+@font-face {
+ font-family: 'GoodSans';
+ src:
+ url(data:application/font-woff2;charset=utf-8;base64,d09GMgABAAAAAEOcAA8AAAAAyjgAAEM8AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP0ZGVE0cGiob3BIciXgGYACHdhEICoH0JIG7HAuGJAABNgIkA4xEBCAFiSoHkVEbgqknmJu6Kjrc7QBb5/73VAyO824nUBU/TM5GxLBxACZelpn9//8pS8cYDtQGoJr5/oMaQVPMw+HJQERHjpx9iXEjli9iz8AIPDMdByRsiyhfZVYx1BzyA75n55S+WM4W/Msq1s6hapOIe4ve3G+onUQq3txWQviTMLiIeqt6tpv/Y5QGkpSEKTSjQg5TDoXDhQmW8Uoc1F4rvasvAtwmfkS6CHnyPFTXf50bGU9RTWglu37DXoFrcQl6xpUWz8/5P3uuJX4jUPAg+hHx90upSzCvq1MV/4F3Ww81B1JkGqkpopbWduB [...]
+ url(data:application/font-woff;charset=utf-8;base64,d09GRgABAAAAAF8cAA8AAAAAyjgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABGRlRNAABfAAAAABoAAAAciqv44UdERUYAAElEAAAAKgAAACoCpwPnR1BPUwAAS5wAABNhAAAuEjANEUpHU1VCAABJcAAAAiwAAAT4m+fp7k9TLzIAAAHQAAAATgAAAGBpCa12Y21hcAAABUgAAAK5AAAD9vu6BIZnYXNwAABJPAAAAAgAAAAI//8AA2dseWYAAAskAAA27QAAeiSIIA1QaGVhZAAAAVgAAAA0AAAANhW5FeNoaGVhAAABjAAAACEAAAAkBXwGNmhtdHgAAAIgAAADKAAABkT6ZjsubG9jYQAACAQAAAMeAAADJLV91MBtYXhwAAABsAAAAB8AAAAgAdkAQm5hbWUAAEIUAAACFgAABKqiusAF [...]
+ font-weight: 400;
+ font-style: normal;
+}
+
+body {
+ font-family: GoodSans, "Helvetica Neue", Helvetica, Arial, sans-serif;
+ font-weight: 400;
+ font-size: 13px;
+}
+
+b,
+strong {
+ font-weight: 500;
+}
+
+.navbar {
+ background-color: #4a4466 !important;
+}
+
+.brand-logo > path {
+ fill: #fffefd;
+}
+
+.navbar-nav > li > a {
+ color: #e2e0df;
+}
+
+.nav .open > a,
+.navbar-nav > li > a:focus,
+.navbar-nav > li > a:hover,
+.nav > li:focus-within > a,
+.nav > li > a:focus,
+.nav > li > a:hover,
+.nav .open > a:hover,
+.nav .open > a:focus {
+ color: #fffefd;
+ background-color: #413c5a;
+}
+
+.navbar-user-icon {
+ color: #fffefd;
+ background-color: #1f1d2b;
+}
diff --git a/airflow/www/templates/airflow/main.html b/airflow/www/templates/airflow/main.html
index c064d3d..5fb5830 100644
--- a/airflow/www/templates/airflow/main.html
+++ b/airflow/www/templates/airflow/main.html
@@ -37,6 +37,8 @@
}
{% endfor %}
</style>
+ {# Add astroTheme.css after other stylesheets and style blocks #}
+ <link rel="stylesheet" type="text/css" href="{{ url_for_asset('astroTheme.css') }}">
<link rel="icon" type="image/png" href="{{ url_for('static', filename='pin_32.png') }}">
{% endblock %}
@@ -65,7 +67,22 @@
<footer class="footer">
<div class="container">
<div>
- {{ version_label }}: {% if airflow_version %}<a href="https://pypi.python.org/pypi/apache-airflow/{{ airflow_version }}" target="_blank">v{{ airflow_version }}</a>{% else %} N/A{% endif %}
+ {% if airflow_version %}
+ Astronomer Certified:
+ {% if 'dev' not in ac_version %}
+ <a href="https://www.astronomer.io/downloads/ac/v{{ ac_url_version }}" target="_blank">
+ <strong>v{{ ac_version }}</strong>
+ </a>
+ {% else %}
+ <strong>v{{ ac_version }}</strong>
+ {% endif %}
+ based on Apache Airflow
+ <a href="https://pypi.python.org/pypi/apache-airflow/{{ airflow_upstream_version }}" target="_blank">
+ <strong>v{{ airflow_upstream_version }}</strong>
+ </a>
+ {% else %}
+ Airflow Version: Not Available
+ {% endif %}
{% if git_version %}<br>Git Version:<strong>{{ git_version }}</strong>{% endif %}
</div>
<div></div>
diff --git a/airflow/www/webpack.config.js b/airflow/www/webpack.config.js
index f63aa0b..3ef822a 100644
--- a/airflow/www/webpack.config.js
+++ b/airflow/www/webpack.config.js
@@ -51,6 +51,7 @@ const config = {
switch: `${STATIC_DIR}/css/switch.css`,
taskInstances: `${STATIC_DIR}/js/task-instances.js`,
tree: `${STATIC_DIR}/css/tree.css`,
+ astroTheme: `${STATIC_DIR}/css/astro-theme.css`,
},
output: {
path: BUILD_DIR,