Log view tail-end mode - #2620
Conversation
| // re-subscribe when the log view mode (TAIL/HEAD) is toggled | ||
| this.$watch(() => this.tailMode, (tailMode) => { | ||
| if (tailMode) { | ||
| // in TAIL mode jump to the end of the file and follow new lines | ||
| this.autoScroll = true | ||
| } | ||
| this.updateQuery() | ||
| }) |
There was a problem hiding this comment.
This switches on auto-scroll when toggling to tail mode. I like this as scrolling down is a pain, but not sure about overriding what might have been a user choice?
…er selector for MAX_LINES. Added logic to pop old lines of toggled, using cylc-flow messages to know where to pop.
…rm button / allowed the enter key.
|
Discussion moved to Issue: |
…o a user setting. Added back the truncation warning. Removed mixed mode.
Made TAIL the default.
|
Think I got that conflict right. I believe it was just the trailing commas PR from @MetRonnie so I have kept my changes and added in the commas. |
|
I think we agreed that the inline truncation warnings are sufficient and the banner can be removed. I haven't done that yet as I am not sure if I think truncation is obvious using just the inline warning. |
|
I think the MAX_LINES user setting is particularly in need of testing. It seems to work for me, but I expect there are scenarios I haven't thought of like views already being open etc. |
| const LOG_TRUNCATION_MARKERS = { | ||
| start: truncationMarker('earlier lines omitted (file truncated)'), | ||
| end: truncationMarker('later lines omitted (file truncated)'), | ||
| } |
There was a problem hiding this comment.
Various things we could do to improve this message, including printing the MAX_LINES value. Left simple until we decide on implementation between this and a banner.
There was a problem hiding this comment.
I think it would be good if the banner was moved to take the place of these messages. Does that make sense?
MetRonnie
left a comment
There was a problem hiding this comment.
Works fairly slickly 👍 I just think we need to iron out a few things
| const LOG_TRUNCATION_MARKERS = { | ||
| start: truncationMarker('earlier lines omitted (file truncated)'), | ||
| end: truncationMarker('later lines omitted (file truncated)'), | ||
| } |
There was a problem hiding this comment.
I think it would be good if the banner was moved to take the place of these messages. Does that make sense?
| icon: this.logMode | ||
| ? mdiFormatVerticalAlignTop | ||
| : mdiFormatVerticalAlignBottom, |
There was a problem hiding this comment.
I think people will confuse this icon for scroll jumping to the start/end. Difficult to think of a better one, but how about mdiInvoiceTextOutline where the jagged end is indicative of truncation? Unfortunately there is no upside-down variant of this icon, nor is it easy to flip the icon at the moment until #2472 is merged, but should be possible to use CSS to flip it in the <style> section.
There was a problem hiding this comment.
I think it would be good if the banner was moved to take the place of these messages. Does that make sense?
Yep that should be doable.
I think people will confuse this icon for scroll jumping to the start/end.
Agreed, I dont love those Icons so happy for alternative suggestions. The jagged edge one you suggest is quite good. Possibly worth getting a few opinions as Icons can be interpreted differently by different people.
The other option I thought about is just a stylised string that switches between Top / Bottom, maybe combined with an Icon?
@ChrisPaulBennett @oliver-sanders - Thoughts?
Example 1:
![]()
![]()
Example 2:
![]()
There was a problem hiding this comment.
As icons go, Ronnie's suggestion is probably about as good as we'll get.
This feature might not be all too obvious to users (we don't usually have to decide whether we view the top or bottom of a file), so it might be worth considering a text based toggle instead (e.g. head/tail or top/bottom).
Or a combination of text and icon?
There was a problem hiding this comment.
Ill have a play with combining an Icon with some text, if I can make it look decent I think thats the best option.
| * The log view mode | ||
| * true - HEAD (cat-log "tail" mode) shows the start of the file and follows it; | ||
| * false - TAIL (cat-log "tail-end" mode) shows the end. | ||
| */ | ||
| const logMode = useInitialOptions('logMode', { props, emit }, false) |
There was a problem hiding this comment.
Instead of a boolean, could you do something like this
| * The log view mode | |
| * true - HEAD (cat-log "tail" mode) shows the start of the file and follows it; | |
| * false - TAIL (cat-log "tail-end" mode) shows the end. | |
| */ | |
| const logMode = useInitialOptions('logMode', { props, emit }, false) | |
| * The cat-log mode | |
| * @type {import('vue').Ref<'tail'|'tail-end'>} | |
| */ | |
| const logMode = useInitialOptions('logMode', { props, emit }, 'tail-end') |
There was a problem hiding this comment.
I can implement that if thats preferable?
There was a problem hiding this comment.
Or rename it to something like headMode?
| * The log view mode | |
| * true - HEAD (cat-log "tail" mode) shows the start of the file and follows it; | |
| * false - TAIL (cat-log "tail-end" mode) shows the end. | |
| */ | |
| const logMode = useInitialOptions('logMode', { props, emit }, false) | |
| * Whether the log view is in HEAD mode: | |
| * HEAD (cat-log "tail" mode) shows the start of the file and follows it; | |
| * TAIL (cat-log "tail-end" mode) shows the end. | |
| */ | |
| const headMode = useInitialOptions('headMode', { props, emit }, false) |
There was a problem hiding this comment.
Yeah that's sensible, logMode was a hangover from the 3 way toggle.
Co-authored-by: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com>
Is this about what you where hoping for @MetRonnie? It's a bit rough at the moment, I plan to copy the styles of the vue banners but this was just to get it working: EDIT since I am away next week I will commit this change so it can be reviewed while away. |
Renamed logMode in existing test.
MetRonnie
left a comment
There was a problem hiding this comment.
I've got a PR to allow easily testing this feature in the offline mode: samuel-denton#1
| ><span | ||
| v-if="log?.truncation" | ||
| class="log-truncation-banner" | ||
| :data-cy="`log-truncation-${log.truncation}`" | ||
| >{{ log.message }}</span><span | ||
| v-else | ||
| >{{ log }}</span></template></pre> |
There was a problem hiding this comment.
This is pretty nifty - however could it be moved outside of the pre element, seeing as it isn't actual log line content?



Trio of PRs to add a new tail mode to cat-log and make use of it in the GUI
The three PR's will close
Changes will be documented in cylc-doc:
Added a toggle to switch between tail and head (tail_from_start) in the log view.
Added a toggle between popping old lines as new ones are added vs keeping them all. (removed the UI for this so it's just a dev toggle now)
Added a MAX_LINES selector to the user settings.
Check List
CONTRIBUTING.mdand added my name as a Code Contributor.setup.cfg(andconda-environment.ymlif present).?.?.xbranch.