Repository: incubator-airflow Updated Branches: refs/heads/master b17bd31d1 -> cadfae54b
[AIRFLOW-903] New configuration setting for the default dag view Added a new configuration setting for the default view a dag should display when clicked on the index page. Make sure we do lower for jinja url_for function Closes #2103 from jakromm/master Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/cadfae54 Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/cadfae54 Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/cadfae54 Branch: refs/heads/master Commit: cadfae54bc0f8bf01582733135595e1d34b3b3fe Parents: b17bd31 Author: Jason Kromm <[email protected]> Authored: Wed Mar 15 08:46:31 2017 -0400 Committer: Jeremiah Lowin <[email protected]> Committed: Wed Mar 15 08:46:31 2017 -0400 ---------------------------------------------------------------------- airflow/configuration.py | 5 +++++ airflow/models.py | 4 ++++ airflow/www/templates/airflow/dags.html | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/cadfae54/airflow/configuration.py ---------------------------------------------------------------------- diff --git a/airflow/configuration.py b/airflow/configuration.py index cfccbe9..fb3c11e 100644 --- a/airflow/configuration.py +++ b/airflow/configuration.py @@ -260,6 +260,10 @@ filter_by_owner = False # in order to user the ldapgroup mode. owner_mode = user +# Default DAG view. Valid values are: +# tree, graph, duration, gantt, landing_times +dag_default_view = tree + # Default DAG orientation. Valid values are: # LR (Left->Right), TB (Top->Bottom), RL (Right->Left), BT (Bottom->Top) dag_orientation = LR @@ -481,6 +485,7 @@ base_url = http://localhost:8080 web_server_host = 0.0.0.0 web_server_port = 8080 dag_orientation = LR +dag_default_view = tree log_fetch_timeout_sec = 5 hide_paused_dags_by_default = False http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/cadfae54/airflow/models.py ---------------------------------------------------------------------- diff --git a/airflow/models.py b/airflow/models.py index 1244d60..27a5670 100755 --- a/airflow/models.py +++ b/airflow/models.py @@ -2632,6 +2632,8 @@ class DAG(BaseDag, LoggingMixin): :param sla_miss_callback: specify a function to call when reporting SLA timeouts. :type sla_miss_callback: types.FunctionType + :param default_view: Specify DAG default view (tree, graph, duration, gantt, landing_times) + :type default_view: string :param orientation: Specify DAG orientation in graph view (LR, TB, RL, BT) :type orientation: string :param catchup: Perform scheduler catchup (or only run latest)? Defaults to True @@ -2652,6 +2654,7 @@ class DAG(BaseDag, LoggingMixin): 'core', 'max_active_runs_per_dag'), dagrun_timeout=None, sla_miss_callback=None, + default_view=configuration.get('webserver', 'dag_default_view').lower(), orientation=configuration.get('webserver', 'dag_orientation'), catchup=configuration.getboolean('scheduler', 'catchup_by_default'), params=None): @@ -2695,6 +2698,7 @@ class DAG(BaseDag, LoggingMixin): self.max_active_runs = max_active_runs self.dagrun_timeout = dagrun_timeout self.sla_miss_callback = sla_miss_callback + self.default_view = default_view self.orientation = orientation self.catchup = catchup http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/cadfae54/airflow/www/templates/airflow/dags.html ---------------------------------------------------------------------- diff --git a/airflow/www/templates/airflow/dags.html b/airflow/www/templates/airflow/dags.html index 379f153..8a5a346 100644 --- a/airflow/www/templates/airflow/dags.html +++ b/airflow/www/templates/airflow/dags.html @@ -73,7 +73,7 @@ <!-- Column 3: Name --> <td> {% if dag_id in webserver_dags %} - <a href="{{ url_for('airflow.tree', dag_id=dag.dag_id) }}" title="{{ dag.description }}"> + <a href="{{ url_for('airflow.'+dag.default_view, dag_id=dag.dag_id) }}" title="{{ dag.description }}"> {{ dag_id }} </a> {% else %}
