-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[#12329] Refactoring of sortable tables - Sessions table #12501
[#12329] Refactoring of sortable tables - Sessions table #12501
Conversation
…xun/refactor-sessions-table
…xun/refactor-sessions-table
src/e2e/java/teammates/e2e/cases/InstructorFeedbackSessionsPageE2ETest.java
Show resolved
Hide resolved
Hi @Zxun2, Sorry for the delay! Will get to this PR within these couple of days |
Hi @Zxun2, can I check the rationale for changing the default sort behaviour for the Instructor Home Page to session name ascending? I would have thought sorting by session end date descending would be more useful (e.g. for courses with many sessions, I want to see sessions that are ongoing / coming up over sessions where the end date has passed) Also noted for the instructor sessions page, the default behaviour was changed from descending to ascending - think this is fine! Overall, everything looks great (: Currently working through the code itself - will update in a bit Edit: I also noticed some changes to Edit 2: Have looked through the rest of the code, looks good! Will go through 1 more time over the weekend to double check |
Hey @weiquu, thanks for the review! I can't recall the exact rationale, but it was along the lines of, if it was
so i settled on sorting by
I changed the edit: CI needs a re-run :) |
Thanks @Zxun2 for the change and the info! Just one small issue to fix (: (Taking this opportunity to ping @jasonqiu212 @domlimm @cedricongjh @EuniceSim142 - if a couple of you could review this PR soon that would be great) |
…Zxun2/teammates into zongxun/refactor-sessions-table
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.
LGTM! Thanks for the changes and the great work (:
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.
Outstanding work @Zxun2! Thanks for the huge refactor :) Just 2 small questions
.../app/components/question-types/question-statistics/rubric-question-statistics.component.html
Outdated
Show resolved
Hide resolved
src/web/app/components/sortable-table/sortable-table.component.ts
Outdated
Show resolved
Hide resolved
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.
LGTM, thanks @Zxun2!
Part of #12329
Outline of Solution
Note: This refactoring works are only on the
sessions-table
component which affectsInstructor Home
andInstructor Sessions
. It should be easy enough to integratesessions-table
later on to other sessions-related tables (e.g.recycle-bin-table
).Previously, the data on the table component relies on the information provided by
x-tableRowModels
-- meaning that angular will "capture" and "trigger" a UI change in the DOM should there be any changes tox-tableRowModels
. The usage of thesortable-table
component meant thatrowData
is now responsible for "triggering" this UI change, which results in an indirect dependency tox-tableRowModels
because there is a need to syncx-tableRowModels
when a change inrowData
is detected, and vice versa. This dependency is likely to be justified, as this is a scalable way to ensure that thesortable-table
component is as versatile as possible. However, more caution is needed when developing as the syncing of two states is very bug prone. E2E testing is very beneficial here.Sortable Tables
The existing component is very well defined. However, there is currently no way to customize the stylings of the table, so I added that capability. Generally, there are two supported stylings (as i have observed):
I have also modified
ColumnData
to add two new attributes,alignment
andheaderClass
.alignment
denotes the text-position in the cell and supports the conventional,'start' | 'center' | 'end'
.headerClass
is useful for any additional stylings.and the
componentData
ofSortableTableCellData
is now a function that accepts an index, indicating it's row's position in thesortable-table
.Additionally, the component now emits a
sortEvent
(wheneversortRows
is called), which is required to synchronize the state ofrowsData
andx-tableRowModels
.Sessions Table
The entire sessions table is now completely replaced with the
sortable-table
component. To support the current stylings ofsessions-table
, I created the following components:cell-with-tooltip
cell-with-group-buttons
cell-with-response-rate
These are the two functions responsible for creating the rows and columns:
Screenshots
It looks exactly like it currently does...