Skip to content

Conversation

rickklaasboer
Copy link

@rickklaasboer rickklaasboer commented Oct 17, 2025

Summary

Fixes #1255. I think this should be all to achieve this setting, if not, please tell!

Checklist

  • Tested and/or added tests to validate that the changes work as intended, if applicable.
  • Updated documentation in README.md, if applicable.

@github-actions github-actions bot added the feature New feature or request label Oct 17, 2025
<Button
variant="ghost"
size="icon"
@click="toggleDefaultCollapse"
Copy link
Owner

Choose a reason for hiding this comment

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

This is just for groups, right? Meaning it only applies if the user sorts by group.

Isn't this button kind of useless? I think I would rather have this as a configuration just in the configuration, and not allow people to toggle it in the UI

Copy link
Author

Choose a reason for hiding this comment

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

Fair! Didn't think about that one, since I've always got it set to groups. Will remove the button :)

Copy link
Owner

Choose a reason for hiding this comment

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

It was a good initiative though, I appreciate you taking the time to attempt an implementation that doesn't break consistency!

config/ui/ui.go Outdated
DarkMode *bool `yaml:"dark-mode,omitempty"` // DarkMode is a flag to enable dark mode by default
DefaultSortBy string `yaml:"default-sort-by,omitempty"` // DefaultSortBy is the default sort option ('name', 'group', 'health')
DefaultFilterBy string `yaml:"default-filter-by,omitempty"` // DefaultFilterBy is the default filter option ('none', 'failing', 'unstable')
DefaultCollapse *bool `yaml:"default-collapse,omitempty"` // DefaultCollapse is a flag to enable/disable collapsing of groups by default
Copy link
Owner

Choose a reason for hiding this comment

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

Since this only applies to groups, I think DefaultGroupCollapsed would make more sense

"": {
"name": "gatus",
"version": "4.0.0",
"dependencies": {
Copy link
Owner

Choose a reason for hiding this comment

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

What's going on there? 🧐

Copy link
Author

Choose a reason for hiding this comment

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

Mhm, don't know actually. Maybe I installed dependencies wrong?

Copy link
Owner

Choose a reason for hiding this comment

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

I'm not sure 🧐 did you make any changes to the package.json locally?

Copy link
Author

Choose a reason for hiding this comment

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

Nope, no changes on my end. I could just reset the changes to HEAD and recommit? 🤷‍♂️

Copy link
Owner

Choose a reason for hiding this comment

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

Yes please. I'll look into whether I'm due for updating the frontend deps separately from this PR

@rickklaasboer rickklaasboer requested a review from TwiN October 20, 2025 06:56
@rickklaasboer rickklaasboer requested a review from TwiN October 21, 2025 07:06
watch(() => combinedGroups.value, () => {
if (!localStorage.getItem('gatus:uncollapsed-groups')) {
initializeCollapsedGroups()
Copy link
Owner

Choose a reason for hiding this comment

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

Was this (initializeCollapsedGroups) not called before? Or am I missing something?
Looks like initializeCollapsedGroups was previously dead code

Comment on lines -506 to 542
// Get saved uncollapsed groups from localStorage
try {
const saved = localStorage.getItem('gatus:uncollapsed-groups')
if (saved) {
uncollapsedGroups.value = new Set(JSON.parse(saved))
return
}
// If no saved state, uncollapsedGroups stays empty (all collapsed by default)
} catch (e) {
console.warn('Failed to parse saved uncollapsed groups:', e)
localStorage.removeItem('gatus:uncollapsed-groups')
// On error, uncollapsedGroups stays empty (all collapsed by default)
}
if (!collapseByDefault.value) {
const groups = Object.keys(combinedGroups.value || {})
uncollapsedGroups.value = new Set(groups) // expanded by default
} else {
uncollapsedGroups.value = new Set() // collapsed by default
}
Copy link
Owner

Choose a reason for hiding this comment

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

Can you add some comments here? I see you removed all comments, it's a little hard to follow what the code is doing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Option: Expand newly collapsed-by-default groups

2 participants