[GitHub] [airflow] robinedwards commented on a change in pull request #7251: [AIRFLOW-6628] Fix search auto complete behaviour

2020-02-24 Thread GitBox
robinedwards commented on a change in pull request #7251: [AIRFLOW-6628] Fix 
search auto complete behaviour
URL: https://github.com/apache/airflow/pull/7251#discussion_r383178778
 
 

 ##
 File path: airflow/www/views.py
 ##
 @@ -2720,3 +2714,36 @@ def get_count_query(self):
 .filter(models.DagModel.is_active)
 .filter(~models.DagModel.is_subdag)
 )
+
+@has_access
+@permission_name("list")
+@provide_session
+@expose('/autocomplete')
+def autocomplete(self, session=None):
+query = unquote(request.args.get('query', ''))
 
 Review comment:
   So i just tested this locally 
https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams does URL 
encoding for us so we need the unquote. Its unlikely that a dag_id would have 
any special character but the owner field could potentially have anything.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [airflow] robinedwards commented on a change in pull request #7251: [AIRFLOW-6628] Fix search auto complete behaviour

2020-01-31 Thread GitBox
robinedwards commented on a change in pull request #7251: [AIRFLOW-6628] Fix 
search auto complete behaviour
URL: https://github.com/apache/airflow/pull/7251#discussion_r373697615
 
 

 ##
 File path: airflow/www/views.py
 ##
 @@ -325,10 +319,36 @@ def get_int_arg(value, default=0):
 paging=wwwutils.generate_pages(current_page, num_of_pages,
search=escape(arg_search_query) if 
arg_search_query else None,
showPaused=not hide_paused),
-auto_complete_data=auto_complete_data,
 num_runs=num_runs,
 tags=tags)
 
+@expose('/dag_autocomplete')
+@has_access
 
 Review comment:
   Yea i guess `dag_stats` too, could potentially break people consuming the 
end point directly on its existing path mind.


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [airflow] robinedwards commented on a change in pull request #7251: [AIRFLOW-6628] Fix search auto complete behaviour

2020-01-31 Thread GitBox
robinedwards commented on a change in pull request #7251: [AIRFLOW-6628] Fix 
search auto complete behaviour
URL: https://github.com/apache/airflow/pull/7251#discussion_r373690273
 
 

 ##
 File path: UPDATING.md
 ##
 @@ -59,6 +59,10 @@ https://developers.google.com/style/inclusive-documentation
 
 -->
 
+### New permission can_dag_autocomplete
+The new dag autocomplete end point requires permissions to be synchronised and 
updated for roles other than Admin. Please run `airflow sync_perm`,
 
 Review comment:
   Happy to take that bit out. I have that setting turned off so thought it 
could possibly trip people up


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [airflow] robinedwards commented on a change in pull request #7251: [AIRFLOW-6628] Fix search auto complete behaviour

2020-01-27 Thread GitBox
robinedwards commented on a change in pull request #7251: [AIRFLOW-6628] Fix 
search auto complete behaviour
URL: https://github.com/apache/airflow/pull/7251#discussion_r371300306
 
 

 ##
 File path: airflow/www/views.py
 ##
 @@ -325,10 +319,36 @@ def get_int_arg(value, default=0):
 paging=wwwutils.generate_pages(current_page, num_of_pages,
search=escape(arg_search_query) if 
arg_search_query else None,
showPaused=not hide_paused),
-auto_complete_data=auto_complete_data,
 num_runs=num_runs,
 tags=tags)
 
+@expose('/dag_autocomplete')
+@has_access
 
 Review comment:
   Implemented the above


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [airflow] robinedwards commented on a change in pull request #7251: [AIRFLOW-6628] Fix search auto complete behaviour

2020-01-27 Thread GitBox
robinedwards commented on a change in pull request #7251: [AIRFLOW-6628] Fix 
search auto complete behaviour
URL: https://github.com/apache/airflow/pull/7251#discussion_r371150314
 
 

 ##
 File path: airflow/www/views.py
 ##
 @@ -325,10 +319,36 @@ def get_int_arg(value, default=0):
 paging=wwwutils.generate_pages(current_page, num_of_pages,
search=escape(arg_search_query) if 
arg_search_query else None,
showPaused=not hide_paused),
-auto_complete_data=auto_complete_data,
 num_runs=num_runs,
 tags=tags)
 
+@expose('/dag_autocomplete')
+@has_access
 
 Review comment:
   Just spoke with @mik-laj on Slack:
   
   "I think it would be better to create a new permission.  I will create the 
API in the near future and the model of permissions will change radically.
   each view is a new permission and this rule will make it easier for us to 
refactor in the future now."


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services


[GitHub] [airflow] robinedwards commented on a change in pull request #7251: [AIRFLOW-6628] Fix search auto complete behaviour

2020-01-27 Thread GitBox
robinedwards commented on a change in pull request #7251: [AIRFLOW-6628] Fix 
search auto complete behaviour
URL: https://github.com/apache/airflow/pull/7251#discussion_r371141027
 
 

 ##
 File path: airflow/www/views.py
 ##
 @@ -325,10 +319,36 @@ def get_int_arg(value, default=0):
 paging=wwwutils.generate_pages(current_page, num_of_pages,
search=escape(arg_search_query) if 
arg_search_query else None,
showPaused=not hide_paused),
-auto_complete_data=auto_complete_data,
 num_runs=num_runs,
 tags=tags)
 
+@expose('/dag_autocomplete')
+@has_access
 
 Review comment:
   Aha good spot, it seems I need to either define a new permission for this or 
piggy back the 'can_index' permission. What would you recommend?


This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services