You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by bo...@apache.org on 2017/02/01 15:32:17 UTC
incubator-airflow git commit: [AIRFLOW-816] Use static nvd3 and d3
Repository: incubator-airflow
Updated Branches:
refs/heads/master fbb59b944 -> 1accb54ff
[AIRFLOW-816] Use static nvd3 and d3
Closes #2035 from bolkedebruin/AIRFLOW-816
Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/1accb54f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/1accb54f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/1accb54f
Branch: refs/heads/master
Commit: 1accb54ff561b8d745277308447dd6f9d3e9f8d5
Parents: fbb59b9
Author: Bolke de Bruin <bo...@xs4all.nl>
Authored: Wed Feb 1 15:32:01 2017 +0000
Committer: Bolke de Bruin <bo...@xs4all.nl>
Committed: Wed Feb 1 15:32:01 2017 +0000
----------------------------------------------------------------------
airflow/www/templates/airflow/chart.html | 6 +++++
.../www/templates/airflow/duration_chart.html | 6 +++++
airflow/www/views.py | 26 +++++++++-----------
3 files changed, 24 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/1accb54f/airflow/www/templates/airflow/chart.html
----------------------------------------------------------------------
diff --git a/airflow/www/templates/airflow/chart.html b/airflow/www/templates/airflow/chart.html
index b917b3e..e61bba8 100644
--- a/airflow/www/templates/airflow/chart.html
+++ b/airflow/www/templates/airflow/chart.html
@@ -23,6 +23,12 @@
<link rel="stylesheet" type="text/css"
href="{{ url_for('static', filename='tree.css') }}">
<link href="{{ admin_static.url(filename='vendor/bootstrap-daterangepicker/daterangepicker-bs2.css') }}" rel="stylesheet">
+<link rel="stylesheet" type="text/css"
+ href="{{ url_for("static", filename="dataTables.bootstrap.css") }}">
+<link rel="stylesheet" type="text/css"
+ href="{{ url_for("static", filename="nv.d3.css") }}">
+<script src="{{ url_for('static', filename='d3.v3.min.js') }}"></script>
+<script src="{{ url_for('static', filename='nv.d3.js') }}"></script>
{% endblock %}
{% block body %}
http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/1accb54f/airflow/www/templates/airflow/duration_chart.html
----------------------------------------------------------------------
diff --git a/airflow/www/templates/airflow/duration_chart.html b/airflow/www/templates/airflow/duration_chart.html
index 5c79806..2c8d433 100644
--- a/airflow/www/templates/airflow/duration_chart.html
+++ b/airflow/www/templates/airflow/duration_chart.html
@@ -23,6 +23,12 @@
<link rel="stylesheet" type="text/css"
href="{{ url_for('static', filename='tree.css') }}">
<link href="{{ admin_static.url(filename='vendor/bootstrap-daterangepicker/daterangepicker-bs2.css') }}" rel="stylesheet">
+<link rel="stylesheet" type="text/css"
+ href="{{ url_for("static", filename="dataTables.bootstrap.css") }}">
+<link rel="stylesheet" type="text/css"
+ href="{{ url_for("static", filename="nv.d3.css") }}">
+<script src="{{ url_for('static', filename='d3.v3.min.js') }}"></script>
+<script src="{{ url_for('static', filename='nv.d3.js') }}"></script>
{% endblock %}
{% block body %}
http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/1accb54f/airflow/www/views.py
----------------------------------------------------------------------
diff --git a/airflow/www/views.py b/airflow/www/views.py
index 86d74d4..b80d83e 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -25,7 +25,6 @@ import dateutil.parser
import copy
from itertools import chain, product
import json
-from lxml import html
import inspect
from textwrap import dedent
@@ -1514,14 +1513,12 @@ class Airflow(BaseView):
form = DateTimeWithNumRunsForm(data={'base_date': max_date,
'num_runs': num_runs})
- chart.buildhtml()
- cum_chart.buildhtml()
- cum_chart_body = html.document_fromstring(str(cum_chart)).find('body')
- cum_chart_script = cum_chart_body.find('script')
- s_index = cum_chart_script.text.rfind('});')
- cum_chart_script.text = cum_chart_script.text[:s_index]\
- + "$( document ).trigger('chartload')"\
- + cum_chart_script.text[s_index:]
+ chart.buildcontent()
+ cum_chart.buildcontent()
+ s_index = cum_chart.htmlcontent.rfind('});')
+ cum_chart.htmlcontent = (cum_chart.htmlcontent[:s_index]
+ + "$( document ).trigger('chartload')"
+ + cum_chart.htmlcontent[s_index:])
return self.render(
'airflow/duration_chart.html',
@@ -1529,8 +1526,8 @@ class Airflow(BaseView):
demo_mode=conf.getboolean('webserver', 'demo_mode'),
root=root,
form=form,
- chart=chart,
- cum_chart=html.tostring(cum_chart_body)
+ chart=chart.htmlcontent,
+ cum_chart=cum_chart.htmlcontent
)
@expose('/tries')
@@ -1584,7 +1581,7 @@ class Airflow(BaseView):
form = DateTimeWithNumRunsForm(data={'base_date': max_date,
'num_runs': num_runs})
- chart.buildhtml()
+ chart.buildcontent()
return self.render(
'airflow/chart.html',
@@ -1592,7 +1589,7 @@ class Airflow(BaseView):
demo_mode=conf.getboolean('webserver', 'demo_mode'),
root=root,
form=form,
- chart=chart
+ chart=chart.htmlcontent
)
@expose('/landing_times')
@@ -1660,10 +1657,11 @@ class Airflow(BaseView):
form = DateTimeWithNumRunsForm(data={'base_date': max_date,
'num_runs': num_runs})
+ chart.buildcontent()
return self.render(
'airflow/chart.html',
dag=dag,
- chart=chart,
+ chart=chart.htmlcontent,
height="700px",
demo_mode=conf.getboolean('webserver', 'demo_mode'),
root=root,