-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
feat: add sorting to status pages #5766
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
- Add global/group sorting with status bar - Implement global search functionality - Adjust sort/search layout and positioning - Add certificate expiration label support - Apply language adaptation and background styling - Add canonical annotations
Sorry, a +1.1k rewrite of one component implementing different features is not reviewable. Looking at the screenshot:
|
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.
Copilot reviewed 3 out of 5 changed files in this pull request and generated no comments.
Files not reviewed (2)
- src/lang/en.json: Language not supported
- src/lang/zh-CN.json: Language not supported
Comments suppressed due to low confidence (1)
src/pages/StatusPage.vue:778
- The new monitor reordering logic would benefit from unit test coverage to ensure that monitors are ordered correctly under various heartbeat conditions.
if (!this.enableEditMode) {
5564fc2
to
436ac1b
Compare
Hi @CommanderStorm , Thanks for the feedback!
I'll split the PR into smaller, more focused changes. I'll also add some necessary comments to make the logic clearer.
I'll update the UI to better match the existing style—thanks for pointing that out.
Do you have any suggestions regarding the sorting feature? I’ll revise the implementation based on your suggestions and follow up with updated PRs soon. Thanks again! BR, |
Yes, please do that. That has the addtional advantage of simplifies the PR ^^
That sounds reasonable. Maybe |
Yes, that is approximately what I was thinking about. |
Hi @CommanderStorm , Thank you for your suggestions. Based on your advice, I have made the following adjustments. For the adjustments to the sortingRemoved the search functionality and global sorting. The group sorting options are now displayed through a dropdown button, as shown in the image below. I replaced the "Sort by" text on the button with an upward arrow and a downward arrow. When no sorting option is selected, both arrows are gray. When the sorting is in ascending order, the upward arrow turns green; otherwise, the downward arrow turns green. Allow switching between ascending and descending order by clicking the already selected sorting attribute again. Support for link-sharing of personal sortingImplemented the link-sharing feature. When others visit this link, they will see the same sorting effects. The current pull request is half the size of the original pull request, please check it when you have time. Thanks! |
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.
padding: 0.3rem 0.6rem; | ||
min-width: 40px; | ||
border-radius: 10px; | ||
background-color: white; |
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.
<Editable v-model="group.element.name" :contenteditable="editMode" tag="span" data-testid="group-name" /> | ||
</div> | ||
|
||
<div v-if="group.element && group.element.monitorList && group.element.monitorList.length > 1" class="sort-dropdown"> |
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 like your atttention to detail 👍🏻
Most would have missed the monitorList.length > 1
</button> | ||
<ul class="dropdown-menu dropdown-menu-end sort-menu" :aria-labelledby="'sortDropdown' + group.index"> | ||
<li> | ||
<a class="dropdown-item sort-item" href="#" @click.prevent="setSort(group.element, 'status')"> |
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.
consider using a <button
instead. Some accessibility tooling does interact poorly with <a href="#"
as far as was reported to us.
For extra credits:
Add an aria-label
or title
(also appears for regular users on hover) what clicking this button does.
* @param {object} group object | ||
* @returns {object|null} saved sorting settings | ||
*/ | ||
getSavedSortSettings(group) { |
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 am a bit torn on this.
I think localStorage
for this feature is not what I would like - I would like all state to be stored in the query exclusively.
Moving this to the query is also simpler from a code perspective..
Looking at the code below, you have a strong preference.
Is this something which you feel strongly about or would you be fine with using the query state instead?
|
||
/** | ||
* Get sort direction symbol | ||
* @param {object} group object | ||
* @returns {string} sort direction symbol | ||
*/ | ||
getSortDirectionSymbol(group) { | ||
return (group.sortDirection === "asc") ? "↑" : "↓"; | ||
}, |
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.
nit: not used in the code
/** | |
* Get sort direction symbol | |
* @param {object} group object | |
* @returns {string} sort direction symbol | |
*/ | |
getSortDirectionSymbol(group) { | |
return (group.sortDirection === "asc") ? "↑" : "↓"; | |
}, |
handlePopState() { | ||
this.loadSortSettingsFromURL(); |
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.
lets inline this. Much readable what popstate
does this way.
return; | ||
} | ||
|
||
const urlParams = new URLSearchParams(window.location.search); |
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 think the vue router already gives access to this.
Handling this manually seems like a lot of unnessesary work, especially in the reactivity department above.
I think the code would be much simpler if instead of hooking up events in the right places, we were to use a computed
to sort and let vue handle the reactivity.
<Editable v-model="group.element.name" :contenteditable="editMode" tag="span" data-testid="group-name" /> | ||
</div> | ||
|
||
<div v-if="group.element && group.element.monitorList && group.element.monitorList.length > 1" class="sort-dropdown"> |
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.
thinking about it, could you (if not, I am fine with this) move the code related to the PublicGroupListSortDropdown
(horrible name, feel free to choose a different one) to its own component?
Thanks for the review and detailed feedback! Just saw this I’ll go through the comments and update accordingly soon. |
This PR implements group and global sorting and searching features with corresponding UI improvements. Resolves #1936.
Features
Additional Notes
Closes #1936