Skip to content

Commit

Permalink
CP(55bb579) [AIRFLOW-5597] Linkify urls in task instance log (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
vshshjn7 authored and msumit committed Oct 17, 2019
1 parent 91d2b00 commit 94cdcf6
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions airflow/www/templates/airflow/ti_log.html
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,18 @@ <h4>{{ title }}</h4>
if (res.message) {
// Auto scroll window to the end if current window location is near the end.
if(auto_tailing && checkAutoTailingCondition()) {
var should_scroll = true
var should_scroll = true;
}
// The message may contain HTML, so either have to escape it or write it as text.
document.getElementById(`try-${try_number}`).textContent += res.message + "\n";
var escaped_message = escapeHtml(res.message);

// Detect urls
var url_regex = /http(s)?:\/\/[\w\.\-]+(\.?:[\w\.\-]+)*([\/?#][\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=\.%]+)?/g;
var linkified_message = escaped_message.replace(url_regex, function(url) {
return "<a href=\"" + url + "\" target=\"_blank\">" + url + "</a>";
});

document.getElementById(`try-${try_number}`).innerHTML += linkified_message + "<br/>";
// Auto scroll window to the end if current window location is near the end.
if(should_scroll) {
scrollBottom();
Expand Down

0 comments on commit 94cdcf6

Please sign in to comment.