You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/09/21 12:43:05 UTC

[GitHub] [airflow] bbovenzi opened a new pull request #18405: Move tags filter cookie to frontend

bbovenzi opened a new pull request #18405:
URL: https://github.com/apache/airflow/pull/18405


   It turns out that the filter_tags_cookie does not work as intended. It caused extra page loads with duplicated banner messages. Instead the cookie will now be managed by `localstorage` in the js frontend instead of the webserver and remove an extraneous UI - webserver trip.
   
   Closes #17727
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in [UPDATING.md](https://github.com/apache/airflow/blob/main/UPDATING.md).
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] bbovenzi closed pull request #18405: Move tags filter cookie to frontend

Posted by GitBox <gi...@apache.org>.
bbovenzi closed pull request #18405:
URL: https://github.com/apache/airflow/pull/18405


   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] ashb commented on a change in pull request #18405: Move tags filter cookie to frontend

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #18405:
URL: https://github.com/apache/airflow/pull/18405#discussion_r713280705



##########
File path: airflow/www/static/js/dags.js
##########
@@ -37,6 +37,20 @@ const lastDagRunsUrl = getMetaValue('last_dag_runs_url');
 const dagStatsUrl = getMetaValue('dag_stats_url');
 const taskStatsUrl = getMetaValue('task_stats_url');
 
+const FILTER_TAGS = 'filter_tags';
+
+const filterTags = localStorage.getItem(FILTER_TAGS);
+const initialQuery = new URLSearchParams(window.location.search);
+
+// Update the url if there is no tags query but localstorage has tags saved
+if (!initialQuery.has('tags') && filterTags) {
+  const tags = JSON.parse(filterTags);
+  tags.forEach((tag) => {
+    initialQuery.append('tags', tag);
+  });
+  window.location = `${DAGS_INDEX}?${initialQuery.toString()}`;

Review comment:
       I'm confused - This still involves a round trip




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] bbovenzi commented on a change in pull request #18405: Move tags filter cookie to frontend

Posted by GitBox <gi...@apache.org>.
bbovenzi commented on a change in pull request #18405:
URL: https://github.com/apache/airflow/pull/18405#discussion_r713348938



##########
File path: airflow/www/static/js/dags.js
##########
@@ -37,6 +37,20 @@ const lastDagRunsUrl = getMetaValue('last_dag_runs_url');
 const dagStatsUrl = getMetaValue('dag_stats_url');
 const taskStatsUrl = getMetaValue('task_stats_url');
 
+const FILTER_TAGS = 'filter_tags';
+
+const filterTags = localStorage.getItem(FILTER_TAGS);
+const initialQuery = new URLSearchParams(window.location.search);
+
+// Update the url if there is no tags query but localstorage has tags saved
+if (!initialQuery.has('tags') && filterTags) {
+  const tags = JSON.parse(filterTags);
+  tags.forEach((tag) => {
+    initialQuery.append('tags', tag);
+  });
+  window.location = `${DAGS_INDEX}?${initialQuery.toString()}`;

Review comment:
       Unfortunately, this one needed to stay. but reseting to no tags no longer requires 2 redirects (one in js and one in views.py)




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] bbovenzi commented on pull request #18405: Move tags filter cookie to frontend

Posted by GitBox <gi...@apache.org>.
bbovenzi commented on pull request #18405:
URL: https://github.com/apache/airflow/pull/18405#issuecomment-925688078


   Closing in favor of a simpler solution


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [airflow] bbovenzi commented on a change in pull request #18405: Move tags filter cookie to frontend

Posted by GitBox <gi...@apache.org>.
bbovenzi commented on a change in pull request #18405:
URL: https://github.com/apache/airflow/pull/18405#discussion_r713348938



##########
File path: airflow/www/static/js/dags.js
##########
@@ -37,6 +37,20 @@ const lastDagRunsUrl = getMetaValue('last_dag_runs_url');
 const dagStatsUrl = getMetaValue('dag_stats_url');
 const taskStatsUrl = getMetaValue('task_stats_url');
 
+const FILTER_TAGS = 'filter_tags';
+
+const filterTags = localStorage.getItem(FILTER_TAGS);
+const initialQuery = new URLSearchParams(window.location.search);
+
+// Update the url if there is no tags query but localstorage has tags saved
+if (!initialQuery.has('tags') && filterTags) {
+  const tags = JSON.parse(filterTags);
+  tags.forEach((tag) => {
+    initialQuery.append('tags', tag);
+  });
+  window.location = `${DAGS_INDEX}?${initialQuery.toString()}`;

Review comment:
       Unfortunately, this one needed to stay. but reseting to no tags no longer requires 2 redirects.




-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org