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/11/03 14:19:59 UTC

[airflow] branch main updated: Fix Toggle Wrap on DAG code page (#19211)

This is an automated email from the ASF dual-hosted git repository.

ash pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new a1632ed  Fix Toggle Wrap on DAG code page (#19211)
a1632ed is described below

commit a1632edac783878cb82d9099f4f973c9a10b0d0f
Author: PApostol <50...@users.noreply.github.com>
AuthorDate: Wed Nov 3 14:19:31 2021 +0000

    Fix Toggle Wrap on DAG code page (#19211)
    
    Co-authored-by: Brent Bovenzi <br...@gmail.com>
---
 airflow/www/static/js/dag_code.js | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/airflow/www/static/js/dag_code.js b/airflow/www/static/js/dag_code.js
index 701e87e..d9112ee 100644
--- a/airflow/www/static/js/dag_code.js
+++ b/airflow/www/static/js/dag_code.js
@@ -17,13 +17,19 @@
  * under the License.
  */
 
-/* global $ */
+/* global window, $ */
 
 import getMetaValue from './meta_value';
 
+function toggleWrap() {
+  $('.code pre').toggleClass('wrap');
+}
+
 const isWrapped = getMetaValue('wrapped');
 
 // pygments generates the HTML so set wrap toggle via js
-if (isWrapped) {
-  $('.code pre').toggleClass('wrap');
+if (isWrapped === 'True') {
+  toggleWrap();
 }
+
+window.toggleWrap = toggleWrap;