-
Notifications
You must be signed in to change notification settings - Fork 72
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
Use MutationObserver to observe log for work instance_linker.js correctly #68
Use MutationObserver to observe log for work instance_linker.js correctly #68
Conversation
oh CI failed... I'll confirm it. Maybe arrow function... |
df34ab7
to
78a1cc1
Compare
} | ||
var logParent = document.querySelector('#logs tbody'); | ||
var observer = new MutationObserver(function(mutations) { | ||
if (mutations.some(function(m) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about separate as a named function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should do that 👍
); | ||
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver; | ||
if (!MutationObserver) { | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PhantomJS supports MutationObserver from 2.0. But It seems that TravisCI uses PhantomJS 1.x currently (as default). So if browser does not support MutationObserver, this function (instance linker) should be disabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But recent modern browsers support MutationObserver like that https://caniuse.com/#feat=mutationobserver
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you about #70. I'll add a test about this.
$('td.log').each(function() { | ||
var logText = $(this).html(); | ||
$(this).html( | ||
logText.replace(/instance#(\d+)\/(\d+)(?:\s+|\.|$)/, function(match, jobId, instanceId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI I added |$
I fix CI failing in #69 🙏 |
Merged #69. Please rebase this branch. |
6de36ea
to
5cb4b5f
Compare
It seems ready to go. ping @eisuke ? |
👍 |
I forgot about this... |
instance_linker.js that makes hyperlink from child job instance to parent job instance had not worked correctly. This PR changes it works fine.
logs are appended to
#logs
element by jQuery. So we need to observe changes of the element with MutationObserver.I'm not sure about JavaScript, if someone have better idea to solve it, please give me comments.
before
after