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 2020/04/03 20:25:51 UTC

[GitHub] [airflow] ryanahamilton opened a new pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

ryanahamilton opened a new pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106
 
 
   Seeks to resolve [[AIRFLOW-7049]](https://issues.apache.org/jira/browse/AIRFLOW-7049) by replacing the problematic "show/hide paused DAGs" toggle with a more robust status filter that saves and persists the user's selection.
   
   Status Filter:
   
   ![image](https://user-images.githubusercontent.com/3267/78398505-2d74f900-75c1-11ea-8258-20f357917ded.png)
   
   In context of the DAGs (home) view:
   
   ![image](https://user-images.githubusercontent.com/3267/78398608-6319e200-75c1-11ea-9a42-d3d801c2345d.png)
   
   Status logic:
   
   - The status filter is set to "all" by default. If the preexisting webserver variable `hide_paused_dags_by_default` is set to `True`, the default is "active".
   - The currently selected status will always be saved in `flask_session[FILTER_STATUS_COOKIE]`. Value of `all`, `active`, or `paused`.
   - A status param in the URL will always override and resave the cookie value. e.g. `/home?status=active`
   - If a user leaves the page and returns to `/home`, the last saved cookie value will be selected.
   
   Of note:
   
   - The status filter buttons include a number count correlating to the number of DAGs for each.
   - Status params are passed along within the pagination links
   - The `dags.html` diff is so large because I fixed a bunch of indentation while I was in there.
   
   Tests:
   
   - Added a view test to confirm URL parameter values are saving to cookie value.
   
   ---
   Make sure to mark the boxes below before creating PR: [x]
   
   - [ x ] Description above provides context of the change
   - [ x ] Unit tests coverage for changes (not needed for documentation changes)
   - [ x ] Commits follow "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)"
   - [ x ] Relevant documentation is updated including usage instructions.
   - [ x ] I will engage committers as explained in [Contribution Workflow Example](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#contribution-workflow-example).
   
   ---
   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/master/UPDATING.md).
   Read the [Pull Request Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines) for more information.
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] btallman commented on issue #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
btallman commented on issue #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#issuecomment-608701438
 
 
   Very nice improvement to my original hack!

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] codecov-io edited a comment on issue #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#issuecomment-609070896
 
 
   # [Codecov](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=h1) Report
   > Merging [#8106](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/1000b4b13a00bf5c39fd871bbc73fa6798ec6b6d&el=desc) will **decrease** coverage by `0.44%`.
   > The diff coverage is `93.54%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/airflow/pull/8106/graphs/tree.svg?width=650&height=150&src=pr&token=WdLKlKHOAU)](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #8106      +/-   ##
   ==========================================
   - Coverage   88.24%   87.80%   -0.45%     
   ==========================================
     Files         932      935       +3     
     Lines       45009    45207     +198     
   ==========================================
   - Hits        39719    39694      -25     
   - Misses       5290     5513     +223     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [airflow/www/views.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy93d3cvdmlld3MucHk=) | `76.86% <93.10%> (+0.33%)` | :arrow_up: |
   | [airflow/www/utils.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy93d3cvdXRpbHMucHk=) | `80.11% <100.00%> (-0.75%)` | :arrow_down: |
   | [...flow/providers/apache/cassandra/hooks/cassandra.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYXBhY2hlL2Nhc3NhbmRyYS9ob29rcy9jYXNzYW5kcmEucHk=) | `21.25% <0.00%> (-72.50%)` | :arrow_down: |
   | [...w/providers/apache/hive/operators/mysql\_to\_hive.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYXBhY2hlL2hpdmUvb3BlcmF0b3JzL215c3FsX3RvX2hpdmUucHk=) | `35.84% <0.00%> (-64.16%)` | :arrow_down: |
   | [airflow/providers/postgres/operators/postgres.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvcG9zdGdyZXMvb3BlcmF0b3JzL3Bvc3RncmVzLnB5) | `47.82% <0.00%> (-52.18%)` | :arrow_down: |
   | [airflow/providers/redis/operators/redis\_publish.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvcmVkaXMvb3BlcmF0b3JzL3JlZGlzX3B1Ymxpc2gucHk=) | `50.00% <0.00%> (-50.00%)` | :arrow_down: |
   | [airflow/providers/mongo/sensors/mongo.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbW9uZ28vc2Vuc29ycy9tb25nby5weQ==) | `53.33% <0.00%> (-46.67%)` | :arrow_down: |
   | [airflow/providers/mysql/operators/mysql.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbXlzcWwvb3BlcmF0b3JzL215c3FsLnB5) | `55.00% <0.00%> (-45.00%)` | :arrow_down: |
   | [airflow/providers/redis/sensors/redis\_key.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvcmVkaXMvc2Vuc29ycy9yZWRpc19rZXkucHk=) | `61.53% <0.00%> (-38.47%)` | :arrow_down: |
   | [airflow/executors/celery\_executor.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGVjdXRvcnMvY2VsZXJ5X2V4ZWN1dG9yLnB5) | `50.67% <0.00%> (-37.84%)` | :arrow_down: |
   | ... and [18 more](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=footer). Last update [1000b4b...3856a5e](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ashb commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#discussion_r405405841
 
 

 ##########
 File path: tests/www/test_views.py
 ##########
 @@ -1534,7 +1549,7 @@ def test_dag_autocomplete_success(self):
         self.login(username='all_dag_user',
                    password='all_dag_user')
         resp = self.client.get(
-            'dagmodel/autocomplete?query=example_bash&showPaused=True',
+            'dagmodel/autocomplete?query=example_bash&status=all',
 
 Review comment:
   Oh, the "all" is the default is why. I suspect if you added a `self.client.get('home?status=paused', follow_redirects=True)` just before this line this test would then start failing.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ashb commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#discussion_r404758983
 
 

 ##########
 File path: airflow/www/views.py
 ##########
 @@ -82,6 +82,7 @@
 
 PAGE_SIZE = conf.getint('webserver', 'page_size')
 FILTER_TAGS_COOKIE = 'tags_filter'
+FILTER_STATUS_COOKIE = 'status_filter'
 
 Review comment:
   ```suggestion
   FILTER_STATUS_COOKIE = 'dag_status_filter'
   ```
   
   is a slightly more descriptive cookie name.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ashb commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#discussion_r404730204
 
 

 ##########
 File path: airflow/www/templates/airflow/dags.html
 ##########
 @@ -237,321 +240,309 @@ <h2>DAGs</h2>
   <script src="{{ url_for_asset('dataTables.bootstrap.min.js') }}"></script>
   <script src="{{ url_for_asset('bootstrap-toggle.min.js') }}"></script>
   <script>
+    const DAGS_INDEX = "{{ url_for('Airflow.index') }}";
+    const ENTER_KEY_CODE = 13;
+
+    $('#tags_filter').select2({
+      placeholder: "Filter dags",
+      allowClear: true
+    });
+
+    $('#dag_query').on('keypress', function (e) {
+      // check for key press on ENTER (key code 13) to trigger the search
+      if (e.which === ENTER_KEY_CODE) {
+        var query = new URLSearchParams(window.location.search);
+        query.set("search", e.target.value.trim());
+        query.delete("page");
+        window.location = DAGS_INDEX + "?" + query.toString();
+        e.preventDefault();
+      }
+    });
 
-      const DAGS_INDEX = "{{ url_for('Airflow.index') }}";
-      const ENTER_KEY_CODE = 13;
+    $('#page_size').on('change', function() {
+      p_size = $(this).val();
+      window.location = DAGS_INDEX + "?page_size=" + p_size;
+    });
 
-      $('#tags_filter').select2({
-        placeholder: "Filter dags",
-        allowClear: true
-      });
+    function confirmTriggerDag(link, dag_id){
+      if (confirm("Are you sure you want to run '"+dag_id+"' now?")) {
+        postAsForm(link.href, {});
+      }
+      // Never follow the link
+      return false;
+    }
+
+    function confirmDeleteDag(link, dag_id){
+      if (confirm("Are you sure you want to delete '"+dag_id+"' now?\n\
+        This option will delete ALL metadata, DAG runs, etc.\n\
+        EXCEPT Log.\n\
+        This cannot be undone.")) {
+        postAsForm(link.href, {});
+      }
+      return false;
+    }
 
-      $('#dag_query').on('keypress', function (e) {
-        // check for key press on ENTER (key code 13) to trigger the search
-        if (e.which === ENTER_KEY_CODE) {
-          var query = new URLSearchParams(window.location.search);
-          query.set("search", e.target.value.trim());
-          query.delete("page");
-          window.location = DAGS_INDEX + "?" + query.toString();
-          e.preventDefault();
-        }
-      });
+    var encoded_dag_ids = new URLSearchParams();
 
-      $('#page_size').on('change', function() {
-        p_size = $(this).val();
-        window.location = DAGS_INDEX + "?page_size=" + p_size;
-      });
+    $.each($("[id^=toggle]"), function(i, v) {
+      var dag_id = $(v).attr('dag_id');
+      encoded_dag_ids.append('dag_ids', dag_id);
 
-      function confirmTriggerDag(link, dag_id){
-        if (confirm("Are you sure you want to run '"+dag_id+"' now?")) {
-          postAsForm(link.href, {});
+      $(v).change (function() {
+        if ($(v).prop('checked')) {
+          is_paused = 'true'
+        } else {
+          is_paused = 'false'
         }
-        // Never follow the link
-        return false;
-      }
-
-      function confirmDeleteDag(link, dag_id){
-        if (confirm("Are you sure you want to delete '"+dag_id+"' now?\n\
-          This option will delete ALL metadata, DAG runs, etc.\n\
-          EXCEPT Log.\n\
-          This cannot be undone.")) {
-          postAsForm(link.href, {});
+        url = 'paused?is_paused=' + is_paused + '&dag_id=' + dag_id;
+        $.post(url);
 
 Review comment:
   You've removed the .fail handler here -- we should probably keep that, no?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ashb commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#discussion_r404761600
 
 

 ##########
 File path: airflow/www/views.py
 ##########
 @@ -2782,10 +2803,14 @@ def autocomplete(self, session=None):
             ~DagModel.is_subdag, DagModel.is_active,
             DagModel.owners.ilike('%' + query + '%'))
 
-        # Hide paused dags
-        if request.args.get('showPaused', 'True').lower() == 'false':
+        # Hide DAGs if not showing status: "all"
 
 Review comment:
   Not sure off the top of my head how this auto-complete works, but might it be better to allow auto-completing of all dags, even ones that aren't shown? Or is the filtering/searching done client side based on the visible data only?
   
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ryanahamilton commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
ryanahamilton commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#discussion_r404928253
 
 

 ##########
 File path: airflow/www/views.py
 ##########
 @@ -313,25 +326,33 @@ def get_int_arg(value, default=0):
                     filename=filename),
                 "error")
 
-        num_of_all_dags = dags_query.count()
+        num_of_all_dags = current_dags.count()
         num_of_pages = int(math.ceil(num_of_all_dags / float(dags_per_page)))
 
+        status_count_all = all_dags.count()
+        status_count_active = active_dags.count()
+        status_count_paused = paused_dags.count()
 
 Review comment:
   Updated (with your sum suggestion).

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ryanahamilton commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
ryanahamilton commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#discussion_r404905113
 
 

 ##########
 File path: airflow/www/templates/airflow/dags.html
 ##########
 @@ -238,320 +241,319 @@ <h2>DAGs</h2>
   <script src="{{ url_for_asset('bootstrap-toggle.min.js') }}"></script>
   <script>
 
-      const DAGS_INDEX = "{{ url_for('Airflow.index') }}";
-      const ENTER_KEY_CODE = 13;
-
-      $('#tags_filter').select2({
-        placeholder: "Filter dags",
-        allowClear: true
-      });
-
-      $('#dag_query').on('keypress', function (e) {
-        // check for key press on ENTER (key code 13) to trigger the search
-        if (e.which === ENTER_KEY_CODE) {
-          var query = new URLSearchParams(window.location.search);
-          query.set("search", e.target.value.trim());
-          query.delete("page");
-          window.location = DAGS_INDEX + "?" + query.toString();
-          e.preventDefault();
-        }
-      });
+    const DAGS_INDEX = "{{ url_for('Airflow.index') }}";
+    const ENTER_KEY_CODE = 13;
+
+    $('#tags_filter').select2({
+      placeholder: "Filter dags",
+      allowClear: true
+    });
+
+    $('#dag_query').on('keypress', function (e) {
+      // check for key press on ENTER (key code 13) to trigger the search
+      if (e.which === ENTER_KEY_CODE) {
+        var query = new URLSearchParams(window.location.search);
+        query.set("search", e.target.value.trim());
+        query.delete("page");
+        window.location = DAGS_INDEX + "?" + query.toString();
+        e.preventDefault();
+      }
+    });
 
-      $('#page_size').on('change', function() {
-        p_size = $(this).val();
-        window.location = DAGS_INDEX + "?page_size=" + p_size;
-      });
+    $('#page_size').on('change', function() {
+      p_size = $(this).val();
+      window.location = DAGS_INDEX + "?page_size=" + p_size;
+    });
 
-      function confirmTriggerDag(link, dag_id){
-        if (confirm("Are you sure you want to run '"+dag_id+"' now?")) {
-          postAsForm(link.href, {});
-        }
-        // Never follow the link
-        return false;
+    function confirmTriggerDag(link, dag_id){
+      if (confirm("Are you sure you want to run '"+dag_id+"' now?")) {
+        postAsForm(link.href, {});
       }
-
-      function confirmDeleteDag(link, dag_id){
-        if (confirm("Are you sure you want to delete '"+dag_id+"' now?\n\
-          This option will delete ALL metadata, DAG runs, etc.\n\
-          EXCEPT Log.\n\
-          This cannot be undone.")) {
-          postAsForm(link.href, {});
-        }
-        return false;
+      // Never follow the link
+      return false;
+    }
+
+    function confirmDeleteDag(link, dag_id){
+      if (confirm("Are you sure you want to delete '"+dag_id+"' now?\n\
+        This option will delete ALL metadata, DAG runs, etc.\n\
+        EXCEPT Log.\n\
+        This cannot be undone.")) {
+        postAsForm(link.href, {});
       }
-
-      var encoded_dag_ids = new URLSearchParams();
-
-      $.each($("[id^=toggle]"), function(i, v) {
-        var $input = $(v);
-        var dag_id = $input.attr('dag_id');
-        encoded_dag_ids.append('dag_ids', dag_id);
-
-        $input.change(function() {
-          var $buttons = $input.parent('.toggle').find('.btn');
-          $buttons.removeClass('btn-danger');
-          if ($input.prop('checked')) {
-            is_paused = 'true'
+      return false;
+    }
+
+    var encoded_dag_ids = new URLSearchParams();
+
+    $.each($("[id^=toggle]"), function(i, v) {
+      var $input = $(v);
+      var dag_id = $input.attr('dag_id');
+      encoded_dag_ids.append('dag_ids', dag_id);
+
+      $input.change(function() {
+        var $buttons = $input.parent('.toggle').find('.btn');
+        $buttons.removeClass('btn-danger');
+        if ($input.prop('checked')) {
+          is_paused = 'true'
+        } else {
+          is_paused = 'false'
+        }
+        var url = 'paused?is_paused=' + is_paused + '&dag_id=' + dag_id;
 
 Review comment:
   yeah, I pushed prematurely 😬 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ryanahamilton commented on issue #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
ryanahamilton commented on issue #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#issuecomment-610361895
 
 
   Thank you @ashb, will get those edits taken care of! 
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ryanahamilton commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
ryanahamilton commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#discussion_r404929237
 
 

 ##########
 File path: tests/www/test_views.py
 ##########
 @@ -1534,7 +1549,7 @@ def test_dag_autocomplete_success(self):
         self.login(username='all_dag_user',
                    password='all_dag_user')
         resp = self.client.get(
-            'dagmodel/autocomplete?query=example_bash&showPaused=True',
+            'dagmodel/autocomplete?query=example_bash&status=all',
 
 Review comment:
   I didn't change anything for this, but ran the single test alone and it still passed.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ashb commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#discussion_r404760859
 
 

 ##########
 File path: airflow/www/views.py
 ##########
 @@ -313,25 +326,33 @@ def get_int_arg(value, default=0):
                     filename=filename),
                 "error")
 
-        num_of_all_dags = dags_query.count()
+        num_of_all_dags = current_dags.count()
         num_of_pages = int(math.ceil(num_of_all_dags / float(dags_per_page)))
 
+        status_count_all = all_dags.count()
+        status_count_active = active_dags.count()
+        status_count_paused = paused_dags.count()
 
 Review comment:
   This does three queries - we could do it with two very easily as `count_all == count_active+count_paused`, right?
   
   (We could _attempt_ to do it as one query with `SELECT is_paused, count(*) ... GROUP BY is_paused` but that may or may not be more efficient in the end)

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ryanahamilton commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
ryanahamilton commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#discussion_r404776205
 
 

 ##########
 File path: airflow/www/views.py
 ##########
 @@ -82,6 +82,7 @@
 
 PAGE_SIZE = conf.getint('webserver', 'page_size')
 FILTER_TAGS_COOKIE = 'tags_filter'
+FILTER_STATUS_COOKIE = 'status_filter'
 
 Review comment:
   I was just continuing the pattern of the cookie above it, but understand the desire. Should I go ahead and give that one a `dag_` prefix too?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ashb commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#discussion_r404759490
 
 

 ##########
 File path: airflow/www/views.py
 ##########
 @@ -251,16 +252,21 @@ def get_int_arg(value, default=0):
             elif cookie_val:
                 arg_tags_filter = cookie_val.split(',')
 
+        if request.args.get('status') is None:
 
 Review comment:
   ```suggestion
           if arg_status_filter is None:
   ```
   
   We've already got it once, no need to ask for it again.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] codecov-io edited a comment on issue #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#issuecomment-609070896
 
 
   # [Codecov](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=h1) Report
   > Merging [#8106](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/1000b4b13a00bf5c39fd871bbc73fa6798ec6b6d&el=desc) will **decrease** coverage by `0.44%`.
   > The diff coverage is `93.54%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/airflow/pull/8106/graphs/tree.svg?width=650&height=150&src=pr&token=WdLKlKHOAU)](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #8106      +/-   ##
   ==========================================
   - Coverage   88.24%   87.80%   -0.45%     
   ==========================================
     Files         932      935       +3     
     Lines       45009    45207     +198     
   ==========================================
   - Hits        39719    39694      -25     
   - Misses       5290     5513     +223     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [airflow/www/views.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy93d3cvdmlld3MucHk=) | `76.86% <93.10%> (+0.33%)` | :arrow_up: |
   | [airflow/www/utils.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy93d3cvdXRpbHMucHk=) | `80.11% <100.00%> (-0.75%)` | :arrow_down: |
   | [...flow/providers/apache/cassandra/hooks/cassandra.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYXBhY2hlL2Nhc3NhbmRyYS9ob29rcy9jYXNzYW5kcmEucHk=) | `21.25% <0.00%> (-72.50%)` | :arrow_down: |
   | [...w/providers/apache/hive/operators/mysql\_to\_hive.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYXBhY2hlL2hpdmUvb3BlcmF0b3JzL215c3FsX3RvX2hpdmUucHk=) | `35.84% <0.00%> (-64.16%)` | :arrow_down: |
   | [airflow/providers/postgres/operators/postgres.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvcG9zdGdyZXMvb3BlcmF0b3JzL3Bvc3RncmVzLnB5) | `47.82% <0.00%> (-52.18%)` | :arrow_down: |
   | [airflow/providers/redis/operators/redis\_publish.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvcmVkaXMvb3BlcmF0b3JzL3JlZGlzX3B1Ymxpc2gucHk=) | `50.00% <0.00%> (-50.00%)` | :arrow_down: |
   | [airflow/providers/mongo/sensors/mongo.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbW9uZ28vc2Vuc29ycy9tb25nby5weQ==) | `53.33% <0.00%> (-46.67%)` | :arrow_down: |
   | [airflow/providers/mysql/operators/mysql.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbXlzcWwvb3BlcmF0b3JzL215c3FsLnB5) | `55.00% <0.00%> (-45.00%)` | :arrow_down: |
   | [airflow/providers/redis/sensors/redis\_key.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvcmVkaXMvc2Vuc29ycy9yZWRpc19rZXkucHk=) | `61.53% <0.00%> (-38.47%)` | :arrow_down: |
   | [airflow/executors/celery\_executor.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGVjdXRvcnMvY2VsZXJ5X2V4ZWN1dG9yLnB5) | `50.67% <0.00%> (-37.84%)` | :arrow_down: |
   | ... and [18 more](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=footer). Last update [1000b4b...3856a5e](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ashb commented on issue #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
ashb commented on issue #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#issuecomment-610326754
 
 
   What do you think about "Enabled" instead of "Active" -- cos even ignoring the is_active concept inside Airflow, Active could be taken to mean "is actively running/executing"
   
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ashb commented on issue #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
ashb commented on issue #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#issuecomment-610440894
 
 
   After playing with this and seeing what it looks like we've decided that Active/Paused is the clearest, and the risk of confusion with the is_active column on the Dag table is minimal as that is never exposed to users, and only shows up in about 3 places in the code anyway.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ashb commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#discussion_r404763358
 
 

 ##########
 File path: tests/www/test_views.py
 ##########
 @@ -1534,7 +1549,7 @@ def test_dag_autocomplete_success(self):
         self.login(username='all_dag_user',
                    password='all_dag_user')
         resp = self.client.get(
-            'dagmodel/autocomplete?query=example_bash&showPaused=True',
+            'dagmodel/autocomplete?query=example_bash&status=all',
 
 Review comment:
   This end point only looks at the cookie value (which is correct) so we shouldn't pass this argument here, but instead set a cookie on the request.
   
   I suspect this is working right now because `home?status=all` was the last time we set set the status, and tests are currently run top-to-bottom, but if you ran just this single test on its own it might fail.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ryanahamilton commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
ryanahamilton commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#discussion_r404926976
 
 

 ##########
 File path: airflow/www/templates/airflow/dags.html
 ##########
 @@ -237,321 +240,309 @@ <h2>DAGs</h2>
   <script src="{{ url_for_asset('dataTables.bootstrap.min.js') }}"></script>
   <script src="{{ url_for_asset('bootstrap-toggle.min.js') }}"></script>
   <script>
+    const DAGS_INDEX = "{{ url_for('Airflow.index') }}";
+    const ENTER_KEY_CODE = 13;
+
+    $('#tags_filter').select2({
+      placeholder: "Filter dags",
+      allowClear: true
+    });
+
+    $('#dag_query').on('keypress', function (e) {
+      // check for key press on ENTER (key code 13) to trigger the search
+      if (e.which === ENTER_KEY_CODE) {
+        var query = new URLSearchParams(window.location.search);
+        query.set("search", e.target.value.trim());
+        query.delete("page");
+        window.location = DAGS_INDEX + "?" + query.toString();
+        e.preventDefault();
+      }
+    });
 
-      const DAGS_INDEX = "{{ url_for('Airflow.index') }}";
-      const ENTER_KEY_CODE = 13;
+    $('#page_size').on('change', function() {
+      p_size = $(this).val();
+      window.location = DAGS_INDEX + "?page_size=" + p_size;
+    });
 
-      $('#tags_filter').select2({
-        placeholder: "Filter dags",
-        allowClear: true
-      });
+    function confirmTriggerDag(link, dag_id){
+      if (confirm("Are you sure you want to run '"+dag_id+"' now?")) {
+        postAsForm(link.href, {});
+      }
+      // Never follow the link
+      return false;
+    }
+
+    function confirmDeleteDag(link, dag_id){
+      if (confirm("Are you sure you want to delete '"+dag_id+"' now?\n\
+        This option will delete ALL metadata, DAG runs, etc.\n\
+        EXCEPT Log.\n\
+        This cannot be undone.")) {
+        postAsForm(link.href, {});
+      }
+      return false;
+    }
 
-      $('#dag_query').on('keypress', function (e) {
-        // check for key press on ENTER (key code 13) to trigger the search
-        if (e.which === ENTER_KEY_CODE) {
-          var query = new URLSearchParams(window.location.search);
-          query.set("search", e.target.value.trim());
-          query.delete("page");
-          window.location = DAGS_INDEX + "?" + query.toString();
-          e.preventDefault();
-        }
-      });
+    var encoded_dag_ids = new URLSearchParams();
 
-      $('#page_size').on('change', function() {
-        p_size = $(this).val();
-        window.location = DAGS_INDEX + "?page_size=" + p_size;
-      });
+    $.each($("[id^=toggle]"), function(i, v) {
+      var dag_id = $(v).attr('dag_id');
+      encoded_dag_ids.append('dag_ids', dag_id);
 
-      function confirmTriggerDag(link, dag_id){
-        if (confirm("Are you sure you want to run '"+dag_id+"' now?")) {
-          postAsForm(link.href, {});
+      $(v).change (function() {
+        if ($(v).prop('checked')) {
+          is_paused = 'true'
+        } else {
+          is_paused = 'false'
         }
-        // Never follow the link
-        return false;
-      }
-
-      function confirmDeleteDag(link, dag_id){
-        if (confirm("Are you sure you want to delete '"+dag_id+"' now?\n\
-          This option will delete ALL metadata, DAG runs, etc.\n\
-          EXCEPT Log.\n\
-          This cannot be undone.")) {
-          postAsForm(link.href, {});
+        url = 'paused?is_paused=' + is_paused + '&dag_id=' + dag_id;
 
 Review comment:
   Updated.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ashb commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#discussion_r404761867
 
 

 ##########
 File path: airflow/www/views.py
 ##########
 @@ -2782,10 +2803,14 @@ def autocomplete(self, session=None):
             ~DagModel.is_subdag, DagModel.is_active,
             DagModel.owners.ilike('%' + query + '%'))
 
-        # Hide paused dags
-        if request.args.get('showPaused', 'True').lower() == 'false':
+        # Hide DAGs if not showing status: "all"
 
 Review comment:
   I guess this is the "same" behaviour as before, just updated to the new mechanism so this is fine.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] codecov-io edited a comment on issue #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#issuecomment-609070896
 
 
   # [Codecov](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=h1) Report
   > Merging [#8106](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/1000b4b13a00bf5c39fd871bbc73fa6798ec6b6d&el=desc) will **decrease** coverage by `0.44%`.
   > The diff coverage is `93.54%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/airflow/pull/8106/graphs/tree.svg?width=650&height=150&src=pr&token=WdLKlKHOAU)](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #8106      +/-   ##
   ==========================================
   - Coverage   88.24%   87.80%   -0.45%     
   ==========================================
     Files         932      935       +3     
     Lines       45009    45207     +198     
   ==========================================
   - Hits        39719    39694      -25     
   - Misses       5290     5513     +223     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [airflow/www/views.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy93d3cvdmlld3MucHk=) | `76.86% <93.10%> (+0.33%)` | :arrow_up: |
   | [airflow/www/utils.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy93d3cvdXRpbHMucHk=) | `80.11% <100.00%> (-0.75%)` | :arrow_down: |
   | [...flow/providers/apache/cassandra/hooks/cassandra.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYXBhY2hlL2Nhc3NhbmRyYS9ob29rcy9jYXNzYW5kcmEucHk=) | `21.25% <0.00%> (-72.50%)` | :arrow_down: |
   | [...w/providers/apache/hive/operators/mysql\_to\_hive.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYXBhY2hlL2hpdmUvb3BlcmF0b3JzL215c3FsX3RvX2hpdmUucHk=) | `35.84% <0.00%> (-64.16%)` | :arrow_down: |
   | [airflow/providers/postgres/operators/postgres.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvcG9zdGdyZXMvb3BlcmF0b3JzL3Bvc3RncmVzLnB5) | `47.82% <0.00%> (-52.18%)` | :arrow_down: |
   | [airflow/providers/redis/operators/redis\_publish.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvcmVkaXMvb3BlcmF0b3JzL3JlZGlzX3B1Ymxpc2gucHk=) | `50.00% <0.00%> (-50.00%)` | :arrow_down: |
   | [airflow/providers/mongo/sensors/mongo.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbW9uZ28vc2Vuc29ycy9tb25nby5weQ==) | `53.33% <0.00%> (-46.67%)` | :arrow_down: |
   | [airflow/providers/mysql/operators/mysql.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbXlzcWwvb3BlcmF0b3JzL215c3FsLnB5) | `55.00% <0.00%> (-45.00%)` | :arrow_down: |
   | [airflow/providers/redis/sensors/redis\_key.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvcmVkaXMvc2Vuc29ycy9yZWRpc19rZXkucHk=) | `61.53% <0.00%> (-38.47%)` | :arrow_down: |
   | [airflow/executors/celery\_executor.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGVjdXRvcnMvY2VsZXJ5X2V4ZWN1dG9yLnB5) | `50.67% <0.00%> (-37.84%)` | :arrow_down: |
   | ... and [18 more](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=footer). Last update [1000b4b...3856a5e](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ryanahamilton commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
ryanahamilton commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#discussion_r404927690
 
 

 ##########
 File path: airflow/www/templates/airflow/dags.html
 ##########
 @@ -237,321 +240,309 @@ <h2>DAGs</h2>
   <script src="{{ url_for_asset('dataTables.bootstrap.min.js') }}"></script>
   <script src="{{ url_for_asset('bootstrap-toggle.min.js') }}"></script>
   <script>
+    const DAGS_INDEX = "{{ url_for('Airflow.index') }}";
+    const ENTER_KEY_CODE = 13;
+
+    $('#tags_filter').select2({
+      placeholder: "Filter dags",
+      allowClear: true
+    });
+
+    $('#dag_query').on('keypress', function (e) {
+      // check for key press on ENTER (key code 13) to trigger the search
+      if (e.which === ENTER_KEY_CODE) {
+        var query = new URLSearchParams(window.location.search);
+        query.set("search", e.target.value.trim());
+        query.delete("page");
+        window.location = DAGS_INDEX + "?" + query.toString();
+        e.preventDefault();
+      }
+    });
 
-      const DAGS_INDEX = "{{ url_for('Airflow.index') }}";
-      const ENTER_KEY_CODE = 13;
+    $('#page_size').on('change', function() {
+      p_size = $(this).val();
+      window.location = DAGS_INDEX + "?page_size=" + p_size;
+    });
 
-      $('#tags_filter').select2({
-        placeholder: "Filter dags",
-        allowClear: true
-      });
+    function confirmTriggerDag(link, dag_id){
+      if (confirm("Are you sure you want to run '"+dag_id+"' now?")) {
+        postAsForm(link.href, {});
+      }
+      // Never follow the link
+      return false;
+    }
+
+    function confirmDeleteDag(link, dag_id){
+      if (confirm("Are you sure you want to delete '"+dag_id+"' now?\n\
+        This option will delete ALL metadata, DAG runs, etc.\n\
+        EXCEPT Log.\n\
+        This cannot be undone.")) {
+        postAsForm(link.href, {});
+      }
+      return false;
+    }
 
-      $('#dag_query').on('keypress', function (e) {
-        // check for key press on ENTER (key code 13) to trigger the search
-        if (e.which === ENTER_KEY_CODE) {
-          var query = new URLSearchParams(window.location.search);
-          query.set("search", e.target.value.trim());
-          query.delete("page");
-          window.location = DAGS_INDEX + "?" + query.toString();
-          e.preventDefault();
-        }
-      });
+    var encoded_dag_ids = new URLSearchParams();
 
-      $('#page_size').on('change', function() {
-        p_size = $(this).val();
-        window.location = DAGS_INDEX + "?page_size=" + p_size;
-      });
+    $.each($("[id^=toggle]"), function(i, v) {
+      var dag_id = $(v).attr('dag_id');
+      encoded_dag_ids.append('dag_ids', dag_id);
 
-      function confirmTriggerDag(link, dag_id){
-        if (confirm("Are you sure you want to run '"+dag_id+"' now?")) {
-          postAsForm(link.href, {});
+      $(v).change (function() {
+        if ($(v).prop('checked')) {
+          is_paused = 'true'
+        } else {
+          is_paused = 'false'
         }
-        // Never follow the link
-        return false;
-      }
-
-      function confirmDeleteDag(link, dag_id){
-        if (confirm("Are you sure you want to delete '"+dag_id+"' now?\n\
-          This option will delete ALL metadata, DAG runs, etc.\n\
-          EXCEPT Log.\n\
-          This cannot be undone.")) {
-          postAsForm(link.href, {});
+        url = 'paused?is_paused=' + is_paused + '&dag_id=' + dag_id;
+        $.post(url);
 
 Review comment:
   This was an unintentional change from a bad rebasing. Should be fixed 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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] kaxil commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#discussion_r404902715
 
 

 ##########
 File path: airflow/www/templates/airflow/dags.html
 ##########
 @@ -238,320 +241,319 @@ <h2>DAGs</h2>
   <script src="{{ url_for_asset('bootstrap-toggle.min.js') }}"></script>
   <script>
 
-      const DAGS_INDEX = "{{ url_for('Airflow.index') }}";
-      const ENTER_KEY_CODE = 13;
-
-      $('#tags_filter').select2({
-        placeholder: "Filter dags",
-        allowClear: true
-      });
-
-      $('#dag_query').on('keypress', function (e) {
-        // check for key press on ENTER (key code 13) to trigger the search
-        if (e.which === ENTER_KEY_CODE) {
-          var query = new URLSearchParams(window.location.search);
-          query.set("search", e.target.value.trim());
-          query.delete("page");
-          window.location = DAGS_INDEX + "?" + query.toString();
-          e.preventDefault();
-        }
-      });
+    const DAGS_INDEX = "{{ url_for('Airflow.index') }}";
+    const ENTER_KEY_CODE = 13;
+
+    $('#tags_filter').select2({
+      placeholder: "Filter dags",
+      allowClear: true
+    });
+
+    $('#dag_query').on('keypress', function (e) {
+      // check for key press on ENTER (key code 13) to trigger the search
+      if (e.which === ENTER_KEY_CODE) {
+        var query = new URLSearchParams(window.location.search);
+        query.set("search", e.target.value.trim());
+        query.delete("page");
+        window.location = DAGS_INDEX + "?" + query.toString();
+        e.preventDefault();
+      }
+    });
 
-      $('#page_size').on('change', function() {
-        p_size = $(this).val();
-        window.location = DAGS_INDEX + "?page_size=" + p_size;
-      });
+    $('#page_size').on('change', function() {
+      p_size = $(this).val();
+      window.location = DAGS_INDEX + "?page_size=" + p_size;
+    });
 
-      function confirmTriggerDag(link, dag_id){
-        if (confirm("Are you sure you want to run '"+dag_id+"' now?")) {
-          postAsForm(link.href, {});
-        }
-        // Never follow the link
-        return false;
+    function confirmTriggerDag(link, dag_id){
+      if (confirm("Are you sure you want to run '"+dag_id+"' now?")) {
+        postAsForm(link.href, {});
       }
-
-      function confirmDeleteDag(link, dag_id){
-        if (confirm("Are you sure you want to delete '"+dag_id+"' now?\n\
-          This option will delete ALL metadata, DAG runs, etc.\n\
-          EXCEPT Log.\n\
-          This cannot be undone.")) {
-          postAsForm(link.href, {});
-        }
-        return false;
+      // Never follow the link
+      return false;
+    }
+
+    function confirmDeleteDag(link, dag_id){
+      if (confirm("Are you sure you want to delete '"+dag_id+"' now?\n\
+        This option will delete ALL metadata, DAG runs, etc.\n\
+        EXCEPT Log.\n\
+        This cannot be undone.")) {
+        postAsForm(link.href, {});
       }
-
-      var encoded_dag_ids = new URLSearchParams();
-
-      $.each($("[id^=toggle]"), function(i, v) {
-        var $input = $(v);
-        var dag_id = $input.attr('dag_id');
-        encoded_dag_ids.append('dag_ids', dag_id);
-
-        $input.change(function() {
-          var $buttons = $input.parent('.toggle').find('.btn');
-          $buttons.removeClass('btn-danger');
-          if ($input.prop('checked')) {
-            is_paused = 'true'
+      return false;
+    }
+
+    var encoded_dag_ids = new URLSearchParams();
+
+    $.each($("[id^=toggle]"), function(i, v) {
+      var $input = $(v);
+      var dag_id = $input.attr('dag_id');
+      encoded_dag_ids.append('dag_ids', dag_id);
+
+      $input.change(function() {
+        var $buttons = $input.parent('.toggle').find('.btn');
+        $buttons.removeClass('btn-danger');
+        if ($input.prop('checked')) {
+          is_paused = 'true'
+        } else {
+          is_paused = 'false'
+        }
+        var url = 'paused?is_paused=' + is_paused + '&dag_id=' + dag_id;
 
 Review comment:
   ```suggestion
           var url = 'paused?is_paused=' + is_paused + '&dag_id=' + encodeURIComponent(dag_id);
   ```
   
   You probably missed this one https://github.com/apache/airflow/pull/8106#discussion_r404729864

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] codecov-io edited a comment on issue #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#issuecomment-609070896
 
 
   # [Codecov](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=h1) Report
   > Merging [#8106](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/b46d6c060280da59193a28cf67e791eb825cb51c&el=desc) will **decrease** coverage by `27.74%`.
   > The diff coverage is `93.54%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/airflow/pull/8106/graphs/tree.svg?width=650&height=150&src=pr&token=WdLKlKHOAU)](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           master    #8106       +/-   ##
   ===========================================
   - Coverage   88.30%   60.55%   -27.75%     
   ===========================================
     Files         936      936               
     Lines       45272    45283       +11     
   ===========================================
   - Hits        39979    27423    -12556     
   - Misses       5293    17860    +12567     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [airflow/www/views.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy93d3cvdmlld3MucHk=) | `77.01% <93.10%> (+0.33%)` | :arrow_up: |
   | [airflow/www/utils.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy93d3cvdXRpbHMucHk=) | `80.11% <100.00%> (-0.75%)` | :arrow_down: |
   | [airflow/providers/exasol/operators/exasol.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZXhhc29sL29wZXJhdG9ycy9leGFzb2wucHk=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [airflow/providers/amazon/aws/hooks/kinesis.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYW1hem9uL2F3cy9ob29rcy9raW5lc2lzLnB5) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [airflow/providers/apache/livy/sensors/livy.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYXBhY2hlL2xpdnkvc2Vuc29ycy9saXZ5LnB5) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [airflow/providers/amazon/aws/sensors/redshift.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYW1hem9uL2F3cy9zZW5zb3JzL3JlZHNoaWZ0LnB5) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [airflow/providers/mysql/operators/s3\_to\_mysql.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbXlzcWwvb3BlcmF0b3JzL3MzX3RvX215c3FsLnB5) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [airflow/providers/postgres/operators/postgres.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvcG9zdGdyZXMvb3BlcmF0b3JzL3Bvc3RncmVzLnB5) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [airflow/providers/microsoft/azure/operators/adx.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbWljcm9zb2Z0L2F6dXJlL29wZXJhdG9ycy9hZHgucHk=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...irflow/providers/amazon/aws/hooks/batch\_waiters.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYW1hem9uL2F3cy9ob29rcy9iYXRjaF93YWl0ZXJzLnB5) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | ... and [322 more](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=footer). Last update [b46d6c0...2a1834f](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] codecov-io commented on issue #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
codecov-io commented on issue #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#issuecomment-609070896
 
 
   # [Codecov](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=h1) Report
   > Merging [#8106](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/1000b4b13a00bf5c39fd871bbc73fa6798ec6b6d&el=desc) will **decrease** coverage by `0.44%`.
   > The diff coverage is `93.54%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/airflow/pull/8106/graphs/tree.svg?width=650&height=150&src=pr&token=WdLKlKHOAU)](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #8106      +/-   ##
   ==========================================
   - Coverage   88.24%   87.80%   -0.45%     
   ==========================================
     Files         932      935       +3     
     Lines       45009    45207     +198     
   ==========================================
   - Hits        39719    39694      -25     
   - Misses       5290     5513     +223     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [airflow/www/views.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy93d3cvdmlld3MucHk=) | `76.86% <93.10%> (+0.33%)` | :arrow_up: |
   | [airflow/www/utils.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy93d3cvdXRpbHMucHk=) | `80.11% <100.00%> (-0.75%)` | :arrow_down: |
   | [...flow/providers/apache/cassandra/hooks/cassandra.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYXBhY2hlL2Nhc3NhbmRyYS9ob29rcy9jYXNzYW5kcmEucHk=) | `21.25% <0.00%> (-72.50%)` | :arrow_down: |
   | [...w/providers/apache/hive/operators/mysql\_to\_hive.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYXBhY2hlL2hpdmUvb3BlcmF0b3JzL215c3FsX3RvX2hpdmUucHk=) | `35.84% <0.00%> (-64.16%)` | :arrow_down: |
   | [airflow/providers/postgres/operators/postgres.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvcG9zdGdyZXMvb3BlcmF0b3JzL3Bvc3RncmVzLnB5) | `47.82% <0.00%> (-52.18%)` | :arrow_down: |
   | [airflow/providers/redis/operators/redis\_publish.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvcmVkaXMvb3BlcmF0b3JzL3JlZGlzX3B1Ymxpc2gucHk=) | `50.00% <0.00%> (-50.00%)` | :arrow_down: |
   | [airflow/providers/mongo/sensors/mongo.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbW9uZ28vc2Vuc29ycy9tb25nby5weQ==) | `53.33% <0.00%> (-46.67%)` | :arrow_down: |
   | [airflow/providers/mysql/operators/mysql.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbXlzcWwvb3BlcmF0b3JzL215c3FsLnB5) | `55.00% <0.00%> (-45.00%)` | :arrow_down: |
   | [airflow/providers/redis/sensors/redis\_key.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvcmVkaXMvc2Vuc29ycy9yZWRpc19rZXkucHk=) | `61.53% <0.00%> (-38.47%)` | :arrow_down: |
   | [airflow/executors/celery\_executor.py](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGVjdXRvcnMvY2VsZXJ5X2V4ZWN1dG9yLnB5) | `50.67% <0.00%> (-37.84%)` | :arrow_down: |
   | ... and [18 more](https://codecov.io/gh/apache/airflow/pull/8106/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=footer). Last update [1000b4b...3856a5e](https://codecov.io/gh/apache/airflow/pull/8106?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ashb commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
ashb commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#discussion_r404729864
 
 

 ##########
 File path: airflow/www/templates/airflow/dags.html
 ##########
 @@ -237,321 +240,309 @@ <h2>DAGs</h2>
   <script src="{{ url_for_asset('dataTables.bootstrap.min.js') }}"></script>
   <script src="{{ url_for_asset('bootstrap-toggle.min.js') }}"></script>
   <script>
+    const DAGS_INDEX = "{{ url_for('Airflow.index') }}";
+    const ENTER_KEY_CODE = 13;
+
+    $('#tags_filter').select2({
+      placeholder: "Filter dags",
+      allowClear: true
+    });
+
+    $('#dag_query').on('keypress', function (e) {
+      // check for key press on ENTER (key code 13) to trigger the search
+      if (e.which === ENTER_KEY_CODE) {
+        var query = new URLSearchParams(window.location.search);
+        query.set("search", e.target.value.trim());
+        query.delete("page");
+        window.location = DAGS_INDEX + "?" + query.toString();
+        e.preventDefault();
+      }
+    });
 
-      const DAGS_INDEX = "{{ url_for('Airflow.index') }}";
-      const ENTER_KEY_CODE = 13;
+    $('#page_size').on('change', function() {
+      p_size = $(this).val();
+      window.location = DAGS_INDEX + "?page_size=" + p_size;
+    });
 
-      $('#tags_filter').select2({
-        placeholder: "Filter dags",
-        allowClear: true
-      });
+    function confirmTriggerDag(link, dag_id){
+      if (confirm("Are you sure you want to run '"+dag_id+"' now?")) {
+        postAsForm(link.href, {});
+      }
+      // Never follow the link
+      return false;
+    }
+
+    function confirmDeleteDag(link, dag_id){
+      if (confirm("Are you sure you want to delete '"+dag_id+"' now?\n\
+        This option will delete ALL metadata, DAG runs, etc.\n\
+        EXCEPT Log.\n\
+        This cannot be undone.")) {
+        postAsForm(link.href, {});
+      }
+      return false;
+    }
 
-      $('#dag_query').on('keypress', function (e) {
-        // check for key press on ENTER (key code 13) to trigger the search
-        if (e.which === ENTER_KEY_CODE) {
-          var query = new URLSearchParams(window.location.search);
-          query.set("search", e.target.value.trim());
-          query.delete("page");
-          window.location = DAGS_INDEX + "?" + query.toString();
-          e.preventDefault();
-        }
-      });
+    var encoded_dag_ids = new URLSearchParams();
 
-      $('#page_size').on('change', function() {
-        p_size = $(this).val();
-        window.location = DAGS_INDEX + "?page_size=" + p_size;
-      });
+    $.each($("[id^=toggle]"), function(i, v) {
+      var dag_id = $(v).attr('dag_id');
+      encoded_dag_ids.append('dag_ids', dag_id);
 
-      function confirmTriggerDag(link, dag_id){
-        if (confirm("Are you sure you want to run '"+dag_id+"' now?")) {
-          postAsForm(link.href, {});
+      $(v).change (function() {
+        if ($(v).prop('checked')) {
+          is_paused = 'true'
+        } else {
+          is_paused = 'false'
         }
-        // Never follow the link
-        return false;
-      }
-
-      function confirmDeleteDag(link, dag_id){
-        if (confirm("Are you sure you want to delete '"+dag_id+"' now?\n\
-          This option will delete ALL metadata, DAG runs, etc.\n\
-          EXCEPT Log.\n\
-          This cannot be undone.")) {
-          postAsForm(link.href, {});
+        url = 'paused?is_paused=' + is_paused + '&dag_id=' + dag_id;
 
 Review comment:
   ```suggestion
           url = 'paused?is_paused=' + is_paused + '&dag_id=' + encodeURIComponent(dag_id);
   ```

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ryanahamilton commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
ryanahamilton commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#discussion_r404929379
 
 

 ##########
 File path: airflow/www/templates/airflow/dags.html
 ##########
 @@ -238,320 +241,319 @@ <h2>DAGs</h2>
   <script src="{{ url_for_asset('bootstrap-toggle.min.js') }}"></script>
   <script>
 
-      const DAGS_INDEX = "{{ url_for('Airflow.index') }}";
-      const ENTER_KEY_CODE = 13;
-
-      $('#tags_filter').select2({
-        placeholder: "Filter dags",
-        allowClear: true
-      });
-
-      $('#dag_query').on('keypress', function (e) {
-        // check for key press on ENTER (key code 13) to trigger the search
-        if (e.which === ENTER_KEY_CODE) {
-          var query = new URLSearchParams(window.location.search);
-          query.set("search", e.target.value.trim());
-          query.delete("page");
-          window.location = DAGS_INDEX + "?" + query.toString();
-          e.preventDefault();
-        }
-      });
+    const DAGS_INDEX = "{{ url_for('Airflow.index') }}";
+    const ENTER_KEY_CODE = 13;
+
+    $('#tags_filter').select2({
+      placeholder: "Filter dags",
+      allowClear: true
+    });
+
+    $('#dag_query').on('keypress', function (e) {
+      // check for key press on ENTER (key code 13) to trigger the search
+      if (e.which === ENTER_KEY_CODE) {
+        var query = new URLSearchParams(window.location.search);
+        query.set("search", e.target.value.trim());
+        query.delete("page");
+        window.location = DAGS_INDEX + "?" + query.toString();
+        e.preventDefault();
+      }
+    });
 
-      $('#page_size').on('change', function() {
-        p_size = $(this).val();
-        window.location = DAGS_INDEX + "?page_size=" + p_size;
-      });
+    $('#page_size').on('change', function() {
+      p_size = $(this).val();
+      window.location = DAGS_INDEX + "?page_size=" + p_size;
+    });
 
-      function confirmTriggerDag(link, dag_id){
-        if (confirm("Are you sure you want to run '"+dag_id+"' now?")) {
-          postAsForm(link.href, {});
-        }
-        // Never follow the link
-        return false;
+    function confirmTriggerDag(link, dag_id){
+      if (confirm("Are you sure you want to run '"+dag_id+"' now?")) {
+        postAsForm(link.href, {});
       }
-
-      function confirmDeleteDag(link, dag_id){
-        if (confirm("Are you sure you want to delete '"+dag_id+"' now?\n\
-          This option will delete ALL metadata, DAG runs, etc.\n\
-          EXCEPT Log.\n\
-          This cannot be undone.")) {
-          postAsForm(link.href, {});
-        }
-        return false;
+      // Never follow the link
+      return false;
+    }
+
+    function confirmDeleteDag(link, dag_id){
+      if (confirm("Are you sure you want to delete '"+dag_id+"' now?\n\
+        This option will delete ALL metadata, DAG runs, etc.\n\
+        EXCEPT Log.\n\
+        This cannot be undone.")) {
+        postAsForm(link.href, {});
       }
-
-      var encoded_dag_ids = new URLSearchParams();
-
-      $.each($("[id^=toggle]"), function(i, v) {
-        var $input = $(v);
-        var dag_id = $input.attr('dag_id');
-        encoded_dag_ids.append('dag_ids', dag_id);
-
-        $input.change(function() {
-          var $buttons = $input.parent('.toggle').find('.btn');
-          $buttons.removeClass('btn-danger');
-          if ($input.prop('checked')) {
-            is_paused = 'true'
+      return false;
+    }
+
+    var encoded_dag_ids = new URLSearchParams();
+
+    $.each($("[id^=toggle]"), function(i, v) {
+      var $input = $(v);
+      var dag_id = $input.attr('dag_id');
+      encoded_dag_ids.append('dag_ids', dag_id);
+
+      $input.change(function() {
+        var $buttons = $input.parent('.toggle').find('.btn');
+        $buttons.removeClass('btn-danger');
+        if ($input.prop('checked')) {
+          is_paused = 'true'
+        } else {
+          is_paused = 'false'
+        }
+        var url = 'paused?is_paused=' + is_paused + '&dag_id=' + dag_id;
 
 Review comment:
   Updated.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ryanahamilton commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
ryanahamilton commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#discussion_r404928017
 
 

 ##########
 File path: airflow/www/views.py
 ##########
 @@ -251,16 +252,21 @@ def get_int_arg(value, default=0):
             elif cookie_val:
                 arg_tags_filter = cookie_val.split(',')
 
+        if request.args.get('status') is None:
 
 Review comment:
   Updated.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ryanahamilton commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
ryanahamilton commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#discussion_r404927919
 
 

 ##########
 File path: airflow/www/views.py
 ##########
 @@ -82,6 +82,7 @@
 
 PAGE_SIZE = conf.getint('webserver', 'page_size')
 FILTER_TAGS_COOKIE = 'tags_filter'
+FILTER_STATUS_COOKIE = 'status_filter'
 
 Review comment:
   Updated (just the status cookie).

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ryanahamilton commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
ryanahamilton commented on a change in pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106#discussion_r405727837
 
 

 ##########
 File path: tests/www/test_views.py
 ##########
 @@ -1534,7 +1549,7 @@ def test_dag_autocomplete_success(self):
         self.login(username='all_dag_user',
                    password='all_dag_user')
         resp = self.client.get(
-            'dagmodel/autocomplete?query=example_bash&showPaused=True',
+            'dagmodel/autocomplete?query=example_bash&status=all',
 
 Review comment:
   Correct, this wasn't needed. Removed the param.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [airflow] ashb merged pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status

Posted by GitBox <gi...@apache.org>.
ashb merged pull request #8106: [AIRFLOW-7049] Persistent display/filtering of DAG status
URL: https://github.com/apache/airflow/pull/8106
 
 
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services