25755 Show logs around specific line#53
Conversation
coorasse
left a comment
There was a problem hiding this comment.
I have some points in this PR that are important, please have a look, maybe we can check them together as well. I want especially to ensure performance.
| %(<pre data-byte-offset="#{byte_offset}">#{parsed}</pre>) | ||
| else | ||
| %(<pre>#{parsed}</pre>) | ||
| end |
There was a problem hiding this comment.
I am a bit worried about performance here. This seems like a lot of work server-side, but maybe we have to. I don't know if it would be possible to delegate this client side.
There was a problem hiding this comment.
I tried to move it to client side now, is this what you meant?
| @cursor_position = [byte_offset - 10000, 0].max | ||
| @end_position = byte_offset + 10000 | ||
| @filter = nil | ||
| @mode = "explore" |
There was a problem hiding this comment.
ah! We have a new mode...that's why it got mixed in the channel with the "live" mode. Can we handle it via "search" mode in the logs_channel instead? Feels more appropriate, no?
There was a problem hiding this comment.
I have now introduced a new search type instead so that we stay on search mode but we have either filer or byte_offset. Let me know what you think 😄
| this.#updateWebsocketStatus('disconnected'); | ||
|
|
||
| // Set up event delegation for expand button clicks | ||
| this.logLinesTarget.addEventListener('click', e => this.#handleExpandClick(e)); |
There was a problem hiding this comment.
this should be done via stimulus as data-action attribute
| byte_offset = nil | ||
| content = line | ||
|
|
||
| if line.match?(/^\d+:/) |
There was a problem hiding this comment.
but this should always be true if we are using ripgrep, right? So instead of checking the line format on each line, we can know this already and avoid a if for each line
There was a problem hiding this comment.
Nice idea, i check ripgrep_enabled? now
69249e5 to
353ecc4
Compare
Introduce byte-offset navigation: track byte offsets while reading logs, include them in ripgrep output and parse them in grep, and add an explore mode that displays logs around a specific offset with an input field and expand button on search results. Always allow switching to live mode visually, build the pre element client-side, and adjust tests to the new ripgrep output format.
305d4ce to
83e2aed
Compare
TICKET-25755
Add byte offset navigation to explore logs around search results