You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by je...@apache.org on 2021/11/03 21:30:05 UTC

[airflow] 06/17: Fix Toggle Wrap on DAG code page (#19211)

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

jedcunningham pushed a commit to branch v2-2-test
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 7a3212d03543e25a2ec2be17d321811229583cd6
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>
    (cherry picked from commit a1632edac783878cb82d9099f4f973c9a10b0d0f)
---
 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;