You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/01/02 16:04:20 UTC

[GitHub] [airflow] ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger

ohadmata commented on a change in pull request #6998: [AIRFLOW-6404] - ANSI color support for WebUI logger
URL: https://github.com/apache/airflow/pull/6998#discussion_r362526965
 
 

 ##########
 File path: airflow/www/templates/airflow/ti_log.html
 ##########
 @@ -123,8 +123,32 @@ <h4>{{ title }}</h4>
             if(auto_tailing && checkAutoTailingCondition()) {
               var should_scroll = true
             }
+            
+            // ANSI color support
+            var ansi_color_regex = /.\[([0-9][0-9])m(.*?).\[0m/gs;
+            var res.message = res.message.replace(ansi_color_regex, function(match, color, content) {
+              var colors = {
+                30: 'black',  40: 'black',
+                31: 'red',    41: 'red',
+                32: 'green',  42: 'green',
+                33: 'yellow', 43: 'yellow',
+                34: 'blue',   44: 'blue',
+                35: 'magenta',45: 'magenta',
+                36: 'cyan',   46: 'cyan',
+                37: 'white',  47: 'white'
+              }
+
+              if (30 <= parseInt(color) && parseInt(color) <= 37) {
 
 Review comment:
   I tested the change in a local environment with ansi_up and it's working like a magic :-)
   The problem is that I don't know where I should inclute the new js file.
   Some help please 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services