Skip to content

Commit

Permalink
[AIRFLOW-6733] Extend not replace template (apache#7366)
Browse files Browse the repository at this point in the history
* [AIRFLOW-6733] Extend, rather than replace, the base_template

This commit just moves the existing template to airflow/master.html
(without further changes)

* [AIRFLOW-6733] Only change blocks we have customized

This makes is easier to see which parts of the template we have changed.

(cherry picked from commit 220bc0e)
  • Loading branch information
ashb committed Feb 6, 2020
1 parent 4233c0d commit c9a07b6
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 99 deletions.
2 changes: 1 addition & 1 deletion airflow/www_rbac/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def create_app(config=None, session=None, testing=False, app_name="Airflow"):
app,
db.session if not session else session,
security_manager_class=security_manager_class,
base_template='appbuilder/baselayout.html')
base_template='airflow/master.html')

def init_views(appbuilder):
from airflow.www_rbac import views
Expand Down
2 changes: 1 addition & 1 deletion airflow/www_rbac/templates/airflow/dags.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
limitations under the License.

#}
{% extends "airflow/master.html" %}
{% extends base_template %}

{% block title %}Airflow - DAGs{% endblock %}

Expand Down
49 changes: 48 additions & 1 deletion airflow/www_rbac/templates/airflow/master.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,51 @@
limitations under the License.

#}
{% extends "appbuilder/baselayout.html" %}

{% extends 'appbuilder/baselayout.html' %}

{% block head_css %}
{{ super() }}

{% if not appbuilder.app_theme %}
{# airflowDefaultTheme.css file contains the styles from local bootstrap-theme.css #}
<link href="{{ url_for_asset('airflowDefaultTheme.css') }}" rel="stylesheet">
{% endif %}
<link href="{{ url_for_asset('main.css') }}" rel="stylesheet">

<link rel="icon" type="image/png" href="{{ url_for('static', filename='pin_32.png') }}">
{% endblock %}


{% block messages %}
{% include 'appbuilder/flash.html' %}
{% if scheduler_job is defined and (not scheduler_job or not scheduler_job.is_alive()) %}
<div class="alert alert-warning">
<p>The scheduler does not appear to be running.
{% if scheduler_job %}
Last heartbeat was received <time title="{{ scheduler_job.latest_heartbeat.isoformat() }}" datetime="{{ scheduler_job.latest_heartbeat.isoformat() }}">{{ macros.datetime_diff_for_humans(scheduler_job.latest_heartbeat) }}</time>.
{% endif %}
</p>
<p>The DAGs list may not update, and new tasks will not be scheduled.</p>
</div>
{% endif %}
{% endblock %}

{% block tail_js %}
{{ super() }}

<script type="text/javascript">
// below variables are used in base.js
var hostName = '{{ hostname }}';
var csrfToken = '{{ csrf_token() }}';
$("time[title]").tooltip()
</script>
<!--[if IE ]>
<script src="{{ url_for_asset('ie.js') }}" type="text/javascript"></script>
<![endif]-->
<script src="{{ url_for_asset('base.js') }}" type="text/javascript"></script>

{% if analytics_tool is defined and analytics_tool %}
{% include "analytics/" + analytics_tool + ".html" %}
{% endif %}
{% endblock %}
96 changes: 0 additions & 96 deletions airflow/www_rbac/templates/appbuilder/baselayout.html

This file was deleted.

0 comments on commit c9a07b6

Please sign in to comment.