refactor: migrate units/index parent state to Angular#1080
Open
31Husain31 wants to merge 4 commits intodoubtfire-lms:9.xfrom
Open
refactor: migrate units/index parent state to Angular#108031Husain31 wants to merge 4 commits intodoubtfire-lms:9.xfrom
31Husain31 wants to merge 4 commits intodoubtfire-lms:9.xfrom
Conversation
Replace AngularJS units/index with Angular implementation by adapting UnitRootState. This provides unit and unitRole data to child states while maintaining compatibility with existing AngularJS children. Changes: - Rename unit-root-state to units/index - Update URL from /units2/:unitId to /units/:unitId - Split unit and unitRole into separate resolvers - Add loading state to template - Use default ui-view instead of named unitView - Remove old AngularJS files (index.coffee, index.tpl.html) - Update module dependencies in states.coffee - Fix TaskViewerState parent reference Part of inbox migration (PR 1 of 3)
Remove import reference to build/src/app/units/states/index/index.js which no longer exists after migration to Angular. This was causing the dev server to fail during build.
…mpatibility - Subscribe to unit$ and unitRole$ observables in ngOnInit - Store values as component properties for Angular template - Set values on for AngularJS child states to access - Use () to trigger AngularJS digest cycle - Add defensive checks for Angular availability - Clean up subscriptions in ngOnDestroy Fixes scope inheritance issue where AngularJS child states (units/tasks, units/edit, etc.) couldn't access unit data from the Angular parent component.
…mpatibility Use hybrid pattern with controller + template to bridge data: - Controller sets .unit and .unitRole for AngularJS children - Template passes observables to Angular component via property binding - Fixes blank page issue where child states couldn't access unit data Resolves feedback from JeffySam and mannat2634 regarding blank pages.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Parent Migration (PR 1 of 3): First PR in the 3-part inbox migration. Migrates the units/index parent state from AngularJS to Angular by adapting the existing UnitRootState. This parent provides unit and unitRole data to all child states (tasks, edit, students, etc.) while maintaining compatibility with existing AngularJS children.
What Changed:
Renamed state from 'unit-root-state' to 'units/index'
Changed URL from /units2/:unitId to /units/:unitId
Split data resolvers: unit$ and unitRole$ for cleaner separation
Added loading state UI matching old template behavior
Updated to use default ui-view instead of named unitView
Removed old AngularJS files (index.coffee, index.tpl.html)
Part of: T3 2025 - Investigate partial migration for tasks/inbox
Related PRs: PR 2/3 (units/tasks) and PR 3/3 (inbox) to follow
Migration Plan: INBOX_FULL_MIGRATION_PLAN.md
Type of change
Refactor (non-breaking change which improves code structure)
How Has This Been Tested?
Manual testing required for:
Unit loading at /units/:unitId route
Permission checks for different roles (Tutor, Convenor, Admin, Auditor)
Admin/Auditor special access logic
Loading state display
Child state compatibility (units/tasks, units/edit, etc.)
Redirect behavior on invalid unit or no access
Testing Checklist:
[ ] Tested in latest Chrome
[ ] Tested in latest Safari
[ ] Tested in latest Firefox
Checklist:
[x] My code follows the style guidelines of this project
[x] I have performed a self-review of my own code
[ ] I have commented my code in hard-to-understand areas (code is straightforward refactor)
[ ] I have made corresponding changes to the documentation (none required for internal refactor)
[x] My changes generate no new warnings
[x] I have requested a review from my team