Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CP(55bb579) [AIRFLOW-5597] Linkify urls in task instance log #16

Merged
merged 1 commit into from
Oct 17, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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