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

Add interactive log viewer #5836

Merged
merged 1 commit into from
Aug 15, 2024
Merged

Add interactive log viewer #5836

merged 1 commit into from
Aug 15, 2024

Conversation

perlpunk
Copy link
Contributor

@perlpunk perlpunk commented Aug 7, 2024

@okurz

This comment was marked as resolved.

@perlpunk perlpunk changed the title Proof of Conecpt: Interactive log viewer Proof of Concept: Interactive log viewer Aug 7, 2024
@perlpunk
Copy link
Contributor Author

perlpunk commented Aug 7, 2024

@asmorodskyi WDYT?

@perlpunk

This comment was marked as resolved.

Copy link
Contributor

@Martchus Martchus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks generally good. I only have a few suggestions regarding the JavaScript code.

assets/javascripts/test_result.js Outdated Show resolved Hide resolved
assets/javascripts/test_result.js Outdated Show resolved Hide resolved
assets/javascripts/test_result.js Outdated Show resolved Hide resolved
assets/javascripts/test_result.js Outdated Show resolved Hide resolved
templates/webapi/test/logfile.html.ep Outdated Show resolved Hide resolved
assets/javascripts/test_result.js Outdated Show resolved Hide resolved
assets/javascripts/test_result.js Outdated Show resolved Hide resolved
@asmorodskyi
Copy link
Member

@asmorodskyi WDYT?

Thanks for demo ! LGTM ! This is certainly step in right direction !

Copy link
Member

@asmorodskyi asmorodskyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@perlpunk
Copy link
Contributor Author

perlpunk commented Aug 9, 2024

The feature seems to work like I want it now. Feel free to try it out.
It will add the current search to the url, so you can bookmark it. I want to modify how it gets added to the url though.

And I still need to write a test.

assets/javascripts/test_result.js Outdated Show resolved Hide resolved
assets/javascripts/test_result.js Outdated Show resolved Hide resolved
templates/webapi/test/logfile.html.ep Outdated Show resolved Hide resolved
@perlpunk perlpunk force-pushed the logfilter branch 3 times, most recently from 933fdc9 to 3e0a7f5 Compare August 13, 2024 11:54
@perlpunk perlpunk changed the title Proof of Concept: Interactive log viewer Add interactive log viewer Aug 13, 2024
@perlpunk perlpunk marked this pull request as ready for review August 13, 2024 11:57
@okurz
Copy link
Member

okurz commented Aug 13, 2024

Need to tidy

@perlpunk
Copy link
Contributor Author

I added the test and other small fixes. Reviews welcome

Copy link
Contributor

@Martchus Martchus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't tested it yet but it looks generally good and I see you have implemented my suggestion. Now I only have a few coding-style-related remarks.

assets/javascripts/test_result.js Outdated Show resolved Hide resolved
assets/javascripts/test_result.js Outdated Show resolved Hide resolved
regex = new RegExp(match[1], match[2]);
}
displaySearchInfo('Searching…');
$('.embedded-logfile').each(function (index, logFileElement) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd avoid using jQuery in new code. This could be written using plain JavaScript like this:

Suggested change
$('.embedded-logfile').each(function (index, logFileElement) {
Array.from(document.getElementsByClassName('embedded-logfile')).forEach((logFileElement) => {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's using the same code as in the existing loadEmbeddedLogFiles and it would have been weird to use one style in one function and one in the other. And when looking for removing jquery from the existing code, how far should I go?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can keep it. I'd just avoid it in new code even though it means we don't have a consistent style everywhere.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, and you can actually avoid the outer Array.from(…) in my example. The node list should also have a forEach method.

assets/javascripts/test_result.js Outdated Show resolved Hide resolved
assets/javascripts/test_result.js Outdated Show resolved Hide resolved
assets/javascripts/test_result.js Outdated Show resolved Hide resolved
assets/javascripts/test_result.js Outdated Show resolved Hide resolved
assets/javascripts/test_result.js Outdated Show resolved Hide resolved
assets/javascripts/test_result.js Outdated Show resolved Hide resolved
assets/javascripts/test_result.js Show resolved Hide resolved
@perlpunk
Copy link
Contributor Author

Updated style suggestions

@perlpunk perlpunk force-pushed the logfilter branch 2 times, most recently from 60b08e6 to b76b60c Compare August 14, 2024 19:59
@perlpunk

This comment was marked as resolved.

One can now filter the log files for substring and regexes.

Issue: https://progress.opensuse.org/issues/162218
Copy link

codecov bot commented Aug 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.50%. Comparing base (b24c267) to head (5313e25).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5836   +/-   ##
=======================================
  Coverage   98.50%   98.50%           
=======================================
  Files         395      395           
  Lines       38759    38767    +8     
=======================================
+ Hits        38180    38188    +8     
  Misses        579      579           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mergify mergify bot merged commit ab9f78b into os-autoinst:master Aug 15, 2024
43 checks passed
@perlpunk perlpunk deleted the logfilter branch August 15, 2024 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants