You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by as...@apache.org on 2021/05/17 19:55:55 UTC
[airflow] branch master updated: fix modal actions (#15896)
This is an automated email from the ASF dual-hosted git repository.
ash pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/master by this push:
new a73ba4b fix modal actions (#15896)
a73ba4b is described below
commit a73ba4b3af65ff392a05fe09f656a91b51401c4d
Author: Brent Bovenzi <br...@gmail.com>
AuthorDate: Mon May 17 15:55:43 2021 -0400
fix modal actions (#15896)
Modal events are triggering twice. once, with an executionDate, and again without. Now the submit function will check that an executionDate exists before doing an action
---
airflow/www/static/js/dag.js | 35 +++++++++++++++++++++--------------
1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/airflow/www/static/js/dag.js b/airflow/www/static/js/dag.js
index 5a14c67..39ffedc 100644
--- a/airflow/www/static/js/dag.js
+++ b/airflow/www/static/js/dag.js
@@ -211,9 +211,10 @@ export function callModal(t, d, extraLinks, tryNumbers, sd) {
export function callModalDag(dag) {
$('#dagModal').modal({});
$('#dagModal').css('margin-top', '0');
+ executionDate = dag.execution_date;
updateButtonUrl(buttons.dag_graph_view, {
- dag_id: dag && dag.execution_date,
- execution_date: dag && dag.dag_id,
+ dag_id: dag && dag.dag_id,
+ execution_date: dag && dag.execution_date,
});
}
@@ -221,25 +222,31 @@ export function callModalDag(dag) {
$('form[data-action]').on('submit', function submit(e) {
e.preventDefault();
const form = $(this).get(0);
- form.execution_date.value = executionDate;
- form.origin.value = window.location;
- if (form.task_id) {
- form.task_id.value = taskId;
+ // Somehow submit is fired twice. Only once is the executionDate valid
+ if (executionDate) {
+ form.execution_date.value = executionDate;
+ form.origin.value = window.location;
+ if (form.task_id) {
+ form.task_id.value = taskId;
+ }
+ form.action = $(this).data('action');
+ form.submit();
}
- form.action = $(this).data('action');
- form.submit();
});
// DAG Modal actions
$('form button[data-action]').on('click', function onClick() {
const form = $(this).closest('form').get(0);
- form.execution_date.value = executionDate;
- form.origin.value = window.location;
- if (form.task_id) {
- form.task_id.value = taskId;
+ // Somehow submit is fired twice. Only once is the executionDate valid
+ if (executionDate) {
+ form.execution_date.value = executionDate;
+ form.origin.value = window.location;
+ if (form.task_id) {
+ form.task_id.value = taskId;
+ }
+ form.action = $(this).data('action');
+ form.submit();
}
- form.action = $(this).data('action');
- form.submit();
});
$('#pause_resume').on('change', function onChange() {