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/07 15:30:40 UTC

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

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