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:
[email protected]
With regards,
Apache Git Services