Repository: incubator-airflow
Updated Branches:
  refs/heads/master e1772c008 -> 04bfba3aa


[AIRFLOW-1483] Making page size consistent in list

Views showing model listings had large page sizes
which made page
loading really slow client-side, mostly due to DOM
processing and
JS plugin rendering.
Also, the page size was inconsistent across some
listings.

This commit introduces a configurable page size,
and by default
it'll use a page_size = 100. Also, the same page
size is applied to
all the model views controlled by flask_admin to
be consistent.

Closes #2497 from edgarRd/erod-ui-page-size-conf


Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/04bfba3a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/04bfba3a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/04bfba3a

Branch: refs/heads/master
Commit: 04bfba3aa97deab850c14763279d33a6dfceb205
Parents: e1772c0
Author: Edgar Rodriguez <edgar.rodrig...@airbnb.com>
Authored: Tue Aug 15 15:01:17 2017 -0700
Committer: Dan Davydov <dan.davy...@airbnb.com>
Committed: Tue Aug 15 15:01:19 2017 -0700

----------------------------------------------------------------------
 airflow/config_templates/default_airflow.cfg | 3 +++
 airflow/config_templates/default_test.cfg    | 1 +
 airflow/www/views.py                         | 9 +++++----
 3 files changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/04bfba3a/airflow/config_templates/default_airflow.cfg
----------------------------------------------------------------------
diff --git a/airflow/config_templates/default_airflow.cfg 
b/airflow/config_templates/default_airflow.cfg
index b568d3a..948c72c 100644
--- a/airflow/config_templates/default_airflow.cfg
+++ b/airflow/config_templates/default_airflow.cfg
@@ -233,6 +233,9 @@ log_fetch_timeout_sec = 5
 # DAGs by default
 hide_paused_dags_by_default = False
 
+# Consistent page size across all listing views in the UI
+page_size = 100
+
 [email]
 email_backend = airflow.utils.email.send_email_smtp
 

http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/04bfba3a/airflow/config_templates/default_test.cfg
----------------------------------------------------------------------
diff --git a/airflow/config_templates/default_test.cfg 
b/airflow/config_templates/default_test.cfg
index 4452ffa..2a090d4 100644
--- a/airflow/config_templates/default_test.cfg
+++ b/airflow/config_templates/default_test.cfg
@@ -57,6 +57,7 @@ dag_orientation = LR
 dag_default_view = tree
 log_fetch_timeout_sec = 5
 hide_paused_dags_by_default = False
+page_size = 100
 
 [email]
 email_backend = airflow.utils.email.send_email_smtp

http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/04bfba3a/airflow/www/views.py
----------------------------------------------------------------------
diff --git a/airflow/www/views.py b/airflow/www/views.py
index f813a0b..80b9dd3 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -91,6 +91,8 @@ logout_user = airflow.login.logout_user
 
 FILTER_BY_OWNER = False
 
+PAGE_SIZE = conf.getint('webserver', 'page_size')
+
 if conf.getboolean('webserver', 'FILTER_BY_OWNER'):
     # filter_by_owner if authentication is enabled and filter_by_owner is true
     FILTER_BY_OWNER = not current_app.config['LOGIN_DISABLED']
@@ -1966,7 +1968,7 @@ class AirflowModelView(ModelView):
     edit_template = 'airflow/model_edit.html'
     create_template = 'airflow/model_create.html'
     column_display_actions = True
-    page_size = 500
+    page_size = PAGE_SIZE
 
 
 class ModelViewOnly(wwwutils.LoginMixin, AirflowModelView):
@@ -2283,7 +2285,6 @@ class VariableView(wwwutils.DataProfilingMixin, 
AirflowModelView):
 class XComView(wwwutils.SuperUserMixin, AirflowModelView):
     verbose_name = "XCom"
     verbose_name_plural = "XComs"
-    page_size = 20
 
     form_columns = (
         'key',
@@ -2438,7 +2439,7 @@ class TaskInstanceModelView(ModelViewOnly):
         'unixname', 'priority_weight', 'queue', 'queued_dttm', 'try_number',
         'pool', 'log_url')
     can_delete = True
-    page_size = 500
+    page_size = PAGE_SIZE
 
     @action('set_running', "Set state to 'running'", None)
     def action_set_running(self, ids):
@@ -2704,7 +2705,7 @@ class DagModelView(wwwutils.SuperUserMixin, ModelView):
     )
     can_delete = False
     can_create = False
-    page_size = 50
+    page_size = PAGE_SIZE
     list_template = 'airflow/list_dags.html'
     named_filter_urls = True
 

Reply via email to