[Refactor:TAGrading] Events Infrastructure & StatusBanner#12941
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12941 +/- ##
=========================================
Coverage 21.36% 21.36%
Complexity 9990 9990
=========================================
Files 274 274
Lines 37300 37300
Branches 499 499
=========================================
Hits 7969 7969
Misses 28836 28836
Partials 495 495
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
…ation from inside the Vue component
JManion32
left a comment
There was a problem hiding this comment.
Nice work updating the description.
Functionality looks great, I only have requested changes (or I guess just removals) for the component tests. main.ts looks clean, and the new Vue component is using props and emits rather than relying on Submitty-specific behavior and functions.
A comment about the camelize and capitalize in main.ts:
We talked about this a little bit in our meeting today. Based on a quick search, this implementation with the camelize and capitalize is correct, since Vue expects event names to be kebab case and automatically maps them to camel case listeners. Looking at some older Vue components in the codebase, it looks like there is some inconsistency with event naming conventions that should probably be cleaned up in a separate PR.
|
Please look into the failing |
There was a problem hiding this comment.
While I can't comment much on the design of the code and I'm sure Justin will have more insights on that front, I can verify that the status banners do work as intended. The component test is passing as well. I'll do a more in depth functional test once this PR is finalized. Looking good so far.
JManion32
left a comment
There was a problem hiding this comment.
This looks good to me. I found one more component test that looks unnecessary. Other than that, great work!
williamjallen
left a comment
There was a problem hiding this comment.
A few more comments, and then this should be good to go.
williamjallen
left a comment
There was a problem hiding this comment.
Code looks good to me. I'd like to get a final approval from @JManion32 before merge though.
JManion32
left a comment
There was a problem hiding this comment.
Code and functionality looks good to me. With the new infrastructure for capturing emits, components no longer depend on Submitty-specific state and we can avoid another refactor. The component tests adequately cover the new component, and I am happy about the component_test_utils.js file we added, which should help streamline the creation of future test files.
Great work Ansh!
dagemcn
left a comment
There was a problem hiding this comment.
I retested this after the changes were made and the behavior is the same as main, working in both light mode and dark mode. I tested the behavior when resizing the screen and in a chromium based browser and in Firefox, all working as intended.
…2941) ### Why is this Change Important & Necessary? In this PR we set up the necessary infrastructure required for Vue migration. - Use props and emits in the Vue component. - The Vue component should not deal with external DOM directly - Just emit from the Vue component and our infrastructure will handle this in Component mounting in twig. - It uses an Events mapping in Twig file : ``` 'events': { 'color-change': '(event) => { document.body.style.background = event; }', 'position-change': '(event) => { handlePositionChange(event.panelId, event.panelPosition); }', } ``` **PLUS** In the ongoing migration of Submitty's UI from legacy Twig + jQuery to Vue.js, in this PR we migrate the `StatusBanner` to vue. ### What is the New Behavior? ErrorMessage.twig is replaced by StatusBanner.vue, a pure display component that receives message and color as props and emits color-change on mount so the parent can set the body background color. The component renders a colored banner in the TA grading panel header showing submission status (late, no submission, withdrawn, overridden, etc.). No behavioral change, the banner looks and works identically. https://github.com/user-attachments/assets/3c04f46a-32c4-4431-b744-cfe2e65200ec ### What steps should a reviewer take to reproduce or test the bug or new feature? 1. Navigate to a TA grading page where the student has a submission status condition (late, no submission, withdrawn, overridden grades, etc.) 2. Verify the colored banner appears in the grading panel header with the correct message and background color ### Automated Testing & Documentation - Added Cypress Component Testing. <img width="490" height="397" alt="image" src="https://github.com/user-attachments/assets/1d65c18d-6279-4a4c-8617-afb8a82cf8dc" /> ### Other information - Not a Breaking change - No Migrations needed. --------- Co-authored-by: Justin Manion <[email protected]>
* main: (78 commits) [Bugfix:TAGrading] Auto-open single file (#12625) [Feature:InstructorUI] Add sortable columns to manage students (#12957) [Dependency] Bump php-ds/php-ds from 1.7.0 to 2.0.1 in /site (#12827) [Refactor:TAGrading] Events Infrastructure & StatusBanner (#12941) [Dependency] Bump sqlalchemy from 2.0.48 to 2.0.51 in /.setup/pip (#12884) [Bugfix:Developer] trust hashicorp for vagrant install (#12968) [Feature:TAGrading] Backend for submission clustering (#12886) [Bugfix:InstructorUI] Missing Subsection in the Edit User form (#12955) [Bugfix:Submission] Warning Banners Accessibility Fix (#12956) [Bugfix:System] Preserve signup fields (#12939) [Bugfix:InstructorUI] Fix Csv Download of Subsections (#12954) [Bugfix:InstructorUI] Fix Manage Students Toggle Columns (#12953) [Feature:TAGrading] Persistent Auto-Open (#12931) [Bugfix:Submission] Dot File Upload (#12924) [Refactor:System] Declutter workers (#12815) [Bugfix:Developer] save/restore autograding_containers.json (#12952) [Bugfix:InstructorUI] Create Course Validation (#12949) [Testing:Notifications] Fix grade_inquiries.spec.js (#12950) [UI/UX:System] Add fullscreen button vue component (#12936) [Bugfix:TAGrading] Student Name Resize (#12946) ... # Conflicts: # .pylintrc
Why is this Change Important & Necessary?
In this PR we set up the necessary infrastructure required for Vue migration.
PLUS
In the ongoing migration of Submitty's UI from legacy Twig + jQuery to Vue.js, in this PR we migrate the
StatusBannerto vue.What is the New Behavior?
ErrorMessage.twig is replaced by StatusBanner.vue, a pure display component that receives message and color as props
and emits color-change on mount so the parent can set the body background color. The component renders a colored banner
in the TA grading panel header showing submission status (late, no submission, withdrawn, overridden, etc.). No
behavioral change, the banner looks and works identically.
statusBanner.mp4
What steps should a reviewer take to reproduce or test the bug or new feature?
overridden grades, etc.)
Automated Testing & Documentation
Other information