Show line numbers and allow jumping to specific lines in job logs#309
Show line numbers and allow jumping to specific lines in job logs#309tmcgilchrist merged 4 commits intoocurrent:masterfrom
Conversation
|
Could there be a special tag name for the last line as well by any chance? |
e2c717b to
bec17d6
Compare
Yes, that should be possible to do! I can add that if it's useful. Some thing like |
yes, that would be perfect! Thanks! |
|
@art-w pointed out that the log response would be streamed by the server and this JS code wouldn't behave correctly when the output has not yet been completely rendered. I'll take a look into how to do this correctly and update the PR. |
f6f8a36 to
f550b2c
Compare
|
I've updated the PR to use a MutationObserver to update the line numbers being displayed in the logs, as the logs get streamed from the server. |
f550b2c to
c7e0d23
Compare
I've also added a commit that always scrolls the page to the end when |
The job logs page is streamed from the server to the client, while the job is running. This commit uses Mutation observers on the pre tag to append line numbers to the newly added lines in the <pre> tag. We also add IDs to the line number span tags, which allows jumping to specific line using #L<num> in URL.
Either a line number or a range of line numbers can be specified in the URL hash, for example, L5 or L15-L30. This will highlight the line 5 or all lines 15 to 30 in the UI. Also, the page scrolls to the (first) line of the specified selection in the URL hash.
c7e0d23 to
7e234ac
Compare
|
@talex5 @tmcgilchrist could you please review this PR? |
|
Thanks @tmcgilchrist ! |
…, current_github, current_git, current_examples, current_docker and current (0.6) CHANGES: Core: - Implement labelling of clusters on the Graphviz diagram (@ewanmellor ocurrent/ocurrent#255) - Abort propagation on constant/equal changes (@art-w ocurrent/ocurrent#318) API: - GitHub: Record build status using CheckRun (@tmcgilchrist ocurrent/ocurrent#279) - GitHub: Add details_url to check_run. (@tmcgilchrist ocurrent/ocurrent#282) - GitHub: Add Current_github.Api.cmdliner_opt to allow writing pipelines which can optionally be run as GitHub apps. (@talex5 ocurrent/ocurrent#281) - GitHub: Provide markdown details for CheckRun. (@tmcgilchrist ocurrent/ocurrent#288) - GitHub: Fix wrong name used for repository (@tmcgilchrist ocurrent/ocurrent#289 ocurrent/ocurrent#290) - GitHub: Support Github rebuild via webooks. (@tmcgilchrist ocurrent/ocurrent#283) - GitHub: monitor GraphQL queries (@art-w ocurrent/ocurrent#298) - GitHub: Limit CheckRunStatus summary and text fields to 65535. (@tmcgilchrist ocurrent/ocurrent#300) - GitHub: Log extra context for Webhook validation failure. (@tmcgilchrist ocurrent/ocurrent#302) - GitLab: Initial GitLab plugin work. (@tmcgilchrist ocurrent/ocurrent#299) - Git: Make git reset less verbose (@kit-ty-kate ocurrent/ocurrent#293) Web UI: - Use Lwt.pause instead of Lwt_unix.yield (@MisterDA ocurrent/ocurrent#297) - Use `ansi` instead of `current_ansi` (@samoht ocurrent/ocurrent#321) - Show line numbers and allow jumping to specific lines in job logs (@punchagan ocurrent/ocurrent#309) Docker: - Explicitly set confirmation levels to allow for manually triggered jobs. (@tmcgilchrist ocurrent/ocurrent#304) - Stop using `Dockerfile.t` completely and use strings instead. (@MisterDA ocurrent/ocurrent#301 ocurrent/ocurrent#316) Other: - Update to cohttp 4.0.0 (ocurrent/ocurrent#274, @talex5) - Move `Current_incr` to its own repository (ocurrent/ocurrent#284, @talex5)
This PR adds some simple JS and CSS to allow jumping to a specific line number in the logs, and also displays line numbers for all logs
A URL like

http://localhost:8080/job/2022-02-09/115753-docker-build-71c777#L11-L15would highlight lines 11 to 15 and scroll the page to line 11.