-
-
Notifications
You must be signed in to change notification settings - Fork 592
feat: add configureable default for collapsing statuses #1344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
web/app/src/views/Home.vue
Outdated
<Button | ||
variant="ghost" | ||
size="icon" | ||
@click="toggleDefaultCollapse" |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 :)
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
8a4e45f
to
82bc070
Compare
"": { | ||
"name": "gatus", | ||
"version": "4.0.0", | ||
"dependencies": { |
There was a problem hiding this comment.
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? 🧐
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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? 🤷♂️
There was a problem hiding this comment.
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
watch(() => combinedGroups.value, () => { | ||
if (!localStorage.getItem('gatus:uncollapsed-groups')) { | ||
initializeCollapsedGroups() |
There was a problem hiding this comment.
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
// 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 | ||
} |
There was a problem hiding this comment.
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.
Summary
Fixes #1255. I think this should be all to achieve this setting, if not, please tell!
Checklist
README.md
, if applicable.