Skip to content

Commit

Permalink
[AIRFLOW-1801][AIRFLOW-288] Url encode execution dates
Browse files Browse the repository at this point in the history
Execution dates can contain special characters
that
need to be url encoded. In case of timezone
information
this information is lost if not url encoded.

Closes #2779 from bolkedebruin/AIRFLOW-1801
  • Loading branch information
bolkedebruin authored and Fokko Driesprong committed Nov 12, 2017
1 parent faa9a52 commit 9ec7f0f
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions airflow/www/templates/airflow/dag.html
Original file line number Diff line number Diff line change
Expand Up @@ -304,39 +304,39 @@ <h4 class="modal-title" id="dagModalLabel">

$("#btn_rendered").click(function(){
url = "{{ url_for('airflow.rendered') }}" +
"?task_id=" + task_id +
"&dag_id=" + dag_id +
"&execution_date=" + execution_date;
"?task_id=" + encodeURIComponent(task_id) +
"&dag_id=" + encodeURIComponent(dag_id) +
"&execution_date=" + encodeURIComponent(execution_date);
window.location = url;
});

$("#btn_subdag").click(function(){
url = "{{ url_for('airflow.graph') }}" +
"?dag_id=" + subdag_id +
"&execution_date=" + execution_date;
"?dag_id=" + encodeURIComponent(subdag_id) +
"&execution_date=" + encodeURIComponent(execution_date);
window.location = url;
});

$("#btn_log").click(function(){
url = "{{ url_for('airflow.log') }}" +
"?task_id=" + task_id +
"&dag_id=" + dag_id +
"&execution_date=" + execution_date;
"?task_id=" + encodeURIComponent(task_id) +
"&dag_id=" + encodeURIComponent(dag_id) +
"&execution_date=" + encodeURIComponent(execution_date);
window.location = url;
});

$("#btn_task").click(function(){
url = "{{ url_for('airflow.task') }}" +
"?task_id=" + task_id +
"&dag_id=" + dag_id +
"&execution_date=" + execution_date;
"?task_id=" + encodeURIComponent(task_id) +
"&dag_id=" + encodeURIComponent(dag_id) +
"&execution_date=" + encodeURIComponent(execution_date);
window.location = url;
});

$("#btn_ti").click(function(){
url = "/admin/taskinstance/" +
"?flt1_dag_id_equals=" + dag_id +
"&flt2_task_id_equals=" + task_id +
"?flt1_dag_id_equals=" + encodeURIComponent(dag_id) +
"&flt2_task_id_equals=" + encodeURIComponent(task_id) +
"&sort=3&desc=1";
window.location = url;
});
Expand All @@ -348,7 +348,7 @@ <h4 class="modal-title" id="dagModalLabel">
"&ignore_all_deps=" + $('#btn_ignore_all_deps').hasClass('active') +
"&ignore_task_deps=" + $('#btn_ignore_task_deps').hasClass('active') +
"&ignore_ti_state=" + $('#btn_ignore_ti_state').hasClass('active') +
"&execution_date=" + execution_date +
"&execution_date=" + encodeURIComponent(execution_date) +
"&origin=" + encodeURIComponent(window.location);
window.location = url;
});
Expand All @@ -362,7 +362,7 @@ <h4 class="modal-title" id="dagModalLabel">
"&upstream=" + $('#btn_upstream').hasClass('active') +
"&downstream=" + $('#btn_downstream').hasClass('active') +
"&recursive=" + $('#btn_recursive').hasClass('active') +
"&execution_date=" + execution_date +
"&execution_date=" + encodeURIComponent(execution_date) +
"&origin=" + encodeURIComponent(window.location);
window.location = url;
});
Expand All @@ -371,7 +371,7 @@ <h4 class="modal-title" id="dagModalLabel">
url = "{{ url_for('airflow.dagrun_clear') }}" +
"?task_id=" + encodeURIComponent(task_id) +
"&dag_id=" + encodeURIComponent(dag_id) +
"&execution_date=" + execution_date +
"&execution_date=" + encodeURIComponent(execution_date) +
"&origin=" + encodeURIComponent(window.location);
window.location = url;
});
Expand All @@ -384,7 +384,7 @@ <h4 class="modal-title" id="dagModalLabel">
"&downstream=" + $('#btn_success_downstream').hasClass('active') +
"&future=" + $('#btn_success_future').hasClass('active') +
"&past=" + $('#btn_success_past').hasClass('active') +
"&execution_date=" + execution_date +
"&execution_date=" + encodeURIComponent(execution_date) +
"&origin=" + encodeURIComponent(window.location);

window.location = url;
Expand All @@ -393,22 +393,22 @@ <h4 class="modal-title" id="dagModalLabel">
$('#btn_dagrun_success').click(function(){
url = "{{ url_for('airflow.dagrun_success') }}" +
"?dag_id=" + encodeURIComponent(dag_id) +
"&execution_date=" + execution_date +
"&execution_date=" + encodeURIComponent(execution_date) +
"&origin=" + encodeURIComponent(window.location);
window.location = url;
});

$("#btn_gantt").click(function(){
url = "{{ url_for('airflow.gantt') }}" +
"?dag_id=" + dag_id +
"&execution_date=" + execution_date;
"?dag_id=" + encodeURIComponent(dag_id) +
"&execution_date=" + encodeURIComponent(execution_date);
window.location = url;
});

$("#btn_graph").click(function(){
url = "{{ url_for('airflow.graph') }}" +
"?dag_id=" + dag_id +
"&execution_date=" + execution_date;
"?dag_id=" + encodeURIComponent(dag_id) +
"&execution_date=" + encodeURIComponent(execution_date);
window.location = url;
});

Expand All @@ -419,7 +419,7 @@ <h4 class="modal-title" id="dagModalLabel">
} else {
is_paused = 'false'
}
url = "{{ url_for('airflow.paused') }}" + '?is_paused=' + is_paused + '&dag_id=' + dag_id;
url = "{{ url_for('airflow.paused') }}" + '?is_paused=' + is_paused + '&dag_id=' + encodeURIComponent(dag_id);
$.post(url);
});

Expand Down

0 comments on commit 9ec7f0f

Please sign in to comment.