Merge lp://staging/~mwasilew/lava-scheduler/log_linenumbers into lp://staging/lava-scheduler
Proposed by
Milosz Wasilewski
Status: | Merged |
---|---|
Merged at revision: | 252 |
Proposed branch: | lp://staging/~mwasilew/lava-scheduler/log_linenumbers |
Merge into: | lp://staging/lava-scheduler |
Diff against target: |
90 lines (+57/-1) 3 files modified
lava_scheduler_app/static/lava_scheduler_app/css/logfile.css (+10/-0) lava_scheduler_app/templates/lava_scheduler_app/job_log_file.html (+2/-1) lava_scheduler_app/templatetags/linenumbers.py (+45/-0) |
To merge this branch: | bzr merge lp://staging/~mwasilew/lava-scheduler/log_linenumbers |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Antonio Terceiro | Needs Fixing | ||
Review via email: mp+177597@code.staging.launchpad.net |
Description of the change
The patch line numbers to the full log view. There is also direct URL and line highlight.
To post a comment you must log in.
Hi Milosz,
This is very nice, thanks!
Follows a few comments to improve your contribution.
review needs-fixing
I don't have any code-specific comments, since I am going to suggest a
slightlly different approach which will probably change the details of
the code a lot.
Using a table breaks with very long lines (see attachment). The log is
already presented in preformated text, why don't you just prefix each
line with a number in a link?
i.e.
<pre> L_X_Y'> $LINENO< /a> {ACTUAL LOG LINE GOES HERE}
...
<a href='#
...
</pre>
You just need to make sure $LINENO has always the same numbers of
characters with the numbers aligned to the right, i.e. " 1", " 2", ...
" 10", ... "100". I would just pick a number of characters that can fit
the largest log you can think of, like 6, for a log of up to 10⁶ lines.
Doing this would simplify your code a lot ...
Also, why don't we use a direct counting instead of sectioned counting?
I think it's more natural for users.
I.e.
1
2
3
4
instead of
Section 1.1
Section 1.2
...
(even with the spaces between the sections, I think direct numbering is
still better)
Another problem with this approach is that it doesn't take into account
the case of when you are watching a log while the job is still running:
only the lines that were already available when you loaded the page get
line numbers, the new ones don't (see attachment). Note the poll
function right below #logfile_content.
if I were you I would do the following:
when rendering the template, just prefix every line with a link whose
content has a fixed width in number of characters. (you can still wrap
each line in a div to get the nice :target effect)
modify the poll() function to do the same on the client side, just
incrementing a counter left in the HTML by the server-side code.
or maybe even doing everything on the client side already (???)