-
Notifications
You must be signed in to change notification settings - Fork 13.9k
[FLINK-38699][ui] Sort jobs by default #27464
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
| this.isLoading = false; | ||
| this.listOfJob = data.filter(item => item.completed === this.completed); | ||
|
|
||
| // Apply default sorting based on completed 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.
can the this.listOfJob have completed and uncompleted jobs in if so how does the following if handle this?
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.listOfJob won't contain both completed and uncompleted jobs at the same time because we use separate JobListComponent instances for each state, marked by this.completed. And this.listOfJob is filtered to include only those JobsItem whose status matches this.completed.
| <tr> | ||
| <th [nzSortFn]="sortJobNameFn" nzWidth="40%">Job Name</th> | ||
| <th [nzSortFn]="sortStartTimeFn">Start Time</th> | ||
| <th [nzSortFn]="sortStartTimeFn" [nzSortOrder]="completed ? null : 'descend'"> |
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 makes sense. A couple of thoughs :
- if we are going to default jobs to a sort order ,then does it maker sense to additionally ask the server for a sorted list of completed and uncompleted jobs? So it comes back in the expected default order.
- does this have a big performance impact for a large number of jobs - if there is one this would be a good test to add. I assume we do not paginate.
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.
Thanks @davidradl, these are really inspiring. I'd like to explain why I've opted to handle sorting on the frontend for now:
- Existing frontend capability: The UI already supports user-driven sorting (e.g., clicking column headers to toggle sort order). Adding a default sort order is a natural and lightweight extension of that logic. It also gives us the flexibility to apply different default sorting strategies for completed vs. running jobs without needing separate backend endpoints or complex query parameters.
- Performance considerations: Based on production observations, it’s quite rare for users to have more than a few hundred jobs at once. At that scale, client-side sorting is still performant and acceptable. If we do encounter scenarios with significantly larger job volumes that cause noticeable slowdowns, we can revisit the approach and consider optimizations (e.g., server-side sorting, pagination, or lazy loading). For now, I think we can keep things simple. What do you think?
What is the purpose of the change
This pull request updates the UI homepage to sort jobs by default: completed jobs are ordered by end time (newest first), and running jobs by start time (also newest first).
Brief change log
Verifying this change
This change can be verified as follows:
Does this pull request potentially affect one of the following parts:
@Public(Evolving): (no)Documentation