From 634c12d08a8097bbb4dc7173dd56c0835acda735 Mon Sep 17 00:00:00 2001 From: Brent Bovenzi Date: Fri, 14 May 2021 02:07:40 -0400 Subject: [PATCH] Keep confirmDeleteDag inline html (#15836) Tests and delete functionality rely on `confirmDeleteDag` to be inside the html. It is simpler just to have it inline instead of refactoring all dependent tests to make it work in an external js file. --- airflow/www/static/js/dag.js | 14 +------------- airflow/www/static/js/dags.js | 14 +------------- airflow/www/templates/airflow/dag.html | 12 ++++++++++++ airflow/www/templates/airflow/dags.html | 10 ++++++++++ 4 files changed, 24 insertions(+), 26 deletions(-) diff --git a/airflow/www/static/js/dag.js b/airflow/www/static/js/dag.js index 4f463fe9a9c6..3b2b1e71980a 100644 --- a/airflow/www/static/js/dag.js +++ b/airflow/www/static/js/dag.js @@ -17,7 +17,7 @@ * under the License. */ -/* global document, window, $, confirm, postAsForm, confirm */ +/* global document, window, $, */ import getMetaValue from './meta_value'; @@ -216,18 +216,6 @@ export function callModalDag(dag) { }); } -// eslint-disable-next-line no-unused-vars -function confirmDeleteDag(link, id) { - // eslint-disable-next-line no-alert, no-restricted-globals - if (confirm(`Are you sure you want to delete '${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; -} - // Task Instance Modal actions $('form[data-action]').on('submit', function submit(e) { e.preventDefault(); diff --git a/airflow/www/static/js/dags.js b/airflow/www/static/js/dags.js index ef8db7e9f60b..7056a60d69f3 100644 --- a/airflow/www/static/js/dags.js +++ b/airflow/www/static/js/dags.js @@ -17,7 +17,7 @@ * under the License. */ -/* global document, window, $, d3, STATE_COLOR, postAsForm, isoDateToTimeEl, confirm */ +/* global document, window, $, d3, STATE_COLOR, isoDateToTimeEl, */ import getMetaValue from './meta_value'; @@ -81,18 +81,6 @@ $('#page_size').on('change', function onPageSizeChange() { window.location = `${DAGS_INDEX}?page_size=${pSize}`; }); -// eslint-disable-next-line no-unused-vars -function confirmDeleteDag(link, dagId) { - // eslint-disable-next-line no-alert, no-restricted-globals - if (confirm(`Are you sure you want to delete '${dagId}' now?\n\ - This option will delete ALL metadata, DAG runs, etc.\n\ - EXCEPT Log.\n\ - This cannot be undone.`)) { - postAsForm(link.href, {}); - } - return false; -} - const encodedDagIds = new URLSearchParams(); $.each($('[id^=toggle]'), function toggleId() { diff --git a/airflow/www/templates/airflow/dag.html b/airflow/www/templates/airflow/dag.html index 43aa23ebf63c..93d72034e031 100644 --- a/airflow/www/templates/airflow/dag.html +++ b/airflow/www/templates/airflow/dag.html @@ -403,4 +403,16 @@

{{ page_title }}

{% endblock %}