Skip to content

Log view tail-end mode - #2620

Open
samuel-denton wants to merge 14 commits into
cylc:masterfrom
samuel-denton:cat-log-tail-mode
Open

Log view tail-end mode#2620
samuel-denton wants to merge 14 commits into
cylc:masterfrom
samuel-denton:cat-log-tail-mode

Conversation

@samuel-denton

@samuel-denton samuel-denton commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

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

  • I have read CONTRIBUTING.md and added my name as a Code Contributor.
  • Contains logically grouped changes (else tidy your branch by rebase).
  • Does not contain off-topic changes (use other PRs for other changes).
  • Applied any dependency changes to both setup.cfg (and conda-environment.yml if present).
  • Tests are included (or explain why tests are not needed).
  • Changelog entry included if this is a change that can affect users
  • Cylc-Doc pull request opened if required at cylc/cylc-doc/pull/XXXX.
  • If this is a bug fix, PR should be raised against the relevant ?.?.x branch.

Comment thread src/views/Log.vue Outdated
Comment thread src/views/Log.vue Outdated
Comment on lines +524 to +531
// 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()
})

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.
@samuel-denton

Copy link
Copy Markdown
Contributor Author

Improved the truncation message
image

@samuel-denton

samuel-denton commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

Discussion moved to Issue:
cylc/cylc-uiserver#802 (comment)

@samuel-denton

Copy link
Copy Markdown
Contributor Author

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.

@samuel-denton
samuel-denton marked this pull request as ready for review August 26, 2026 14:51
@samuel-denton

Copy link
Copy Markdown
Contributor Author

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.
Looking for feedback for/against each approach.

@samuel-denton

Copy link
Copy Markdown
Contributor Author

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.

@samuel-denton samuel-denton self-assigned this Aug 26, 2026
Comment thread src/views/Log.vue
Comment on lines +291 to +294
const LOG_TRUNCATION_MARKERS = {
start: truncationMarker('earlier lines omitted (file truncated)'),
end: truncationMarker('later lines omitted (file truncated)'),
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it would be good if the banner was moved to take the place of these messages. Does that make sense?

@MetRonnie MetRonnie changed the title cat-log Tail Mode Log view tail-end mode Aug 28, 2026

@MetRonnie MetRonnie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Works fairly slickly 👍 I just think we need to iron out a few things

Comment thread src/views/Log.vue
Comment on lines +291 to +294
const LOG_TRUNCATION_MARKERS = {
start: truncationMarker('earlier lines omitted (file truncated)'),
end: truncationMarker('later lines omitted (file truncated)'),
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it would be good if the banner was moved to take the place of these messages. Does that make sense?

Comment thread src/views/Log.vue Outdated
Comment on lines +731 to +733
icon: this.logMode
? mdiFormatVerticalAlignTop
: mdiFormatVerticalAlignBottom,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

@samuel-denton samuel-denton Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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:
image
image
Example 2:
image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ill have a play with combining an Icon with some text, if I can make it look decent I think thats the best option.

Comment thread src/views/UserProfile.vue
Comment thread changes.d/2620.feat.md Outdated
Comment thread src/views/Log.vue Outdated
Comment on lines +551 to +555
* 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)

@MetRonnie MetRonnie Aug 28, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Instead of a boolean, could you do something like this

Suggested change
* 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')

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can implement that if thats preferable?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Or rename it to something like headMode?

Suggested change
* 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)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah that's sensible, logMode was a hangover from the 3 way toggle.

samuel-denton and others added 2 commits August 28, 2026 15:00
Co-authored-by: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com>
@samuel-denton

samuel-denton commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

I think it would be good if the banner was moved to take the place of these messages.

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:
image
image

EDIT since I am away next week I will commit this change so it can be reviewed while away.

@MetRonnie MetRonnie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I've got a PR to allow easily testing this feature in the offline mode: samuel-denton#1

Comment on lines +45 to +51
><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>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is pretty nifty - however could it be moved outside of the pre element, seeing as it isn't actual log line content?

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.

3 participants