Phase 7: Upgrade AdminPortal from Angular 4 to Angular 18 - #52
Open
devin-ai-integration[bot] wants to merge 2 commits into
Open
devin-ai-integration[bot] wants to merge 2 commits into
devin-ai-integration[bot] wants to merge 2 commits into
Conversation
Re-scaffold as a fresh Angular 18 standalone CLI project and port the components/services over: - Standalone bootstrap (bootstrapApplication + app.config.ts), provideRouter, provideHttpClient with XSRF config; drop NgModule/app.module.ts - Migrate @angular/http (HttpModule/Http) to @angular/common/http HttpClient; responses are typed and used directly (drop the JSON.parse(_body) hack) - RxJS 5 -> RxJS 7 pipeable operators (map/catchError/of) - Convert AuthGuard to a functional CanActivateFn (auth.guard.ts) - Introduce typed models (User/Transaction/Appointment) for strict templates - Move data fetching from constructors into ngOnInit - Centralize backend base URL in environments (apiBaseUrl) - Replace Protractor e2e with Playwright (smoke test) and add typed specs; unit tests migrated to Angular 18 TestBed with HttpTestingController - CI: Node 20, unit tests are now a hard gate (ChromeHeadlessCI), plus a Playwright e2e job; drop auth0-js (unused) npm audit: 148 vulns (34 critical) -> 54 (0 critical). Remaining prod-highs are Angular 18 framework advisories fixed only in 19+/21 (breaking bump, follow-up). Verified: ng build, 14 unit tests pass headless, Playwright smoke test passes. Co-Authored-By: Gael Kekatos <gael.kekatos@cognition.ai>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
The previous lockfile was produced by an npm install that npm ci rejected (chokidar/readdirp tree inconsistency), failing CI on 'npm ci'. Regenerated a consistent lockfile; verified npm ci passes under both npm 10 and 11. Co-Authored-By: Gael Kekatos <gael.kekatos@cognition.ai>
Author
E2E test results — Angular 18 SPA against live Spring Boot 3.3 backendRan All 7 UI tests passed.
Key evidence — user listing + admin actions working via HttpClientUser list from Disable user via POST (mary Enabled → false, action → "Enable"): Appointment confirmed (false → true, Confirm link removed): Findings to address (not blockers for this PR)
|
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.
Summary
Modernize the
AdminPortalSPA from Angular 4 → Angular 18 (stacked on the Phase 5/6 PR #51). Given 14 major versions of drift, this re-scaffolds a fresh Angular 18 standalone CLI project and ports the components/services over (the alternative the plan allowed), rather than an unreliable 14-hopng update. Behavior and routes are preserved; the legacy@angular/http+ RxJS 5 patterns are gone.Framework / structure
bootstrapApplication(AppComponent, appConfig);app.config.tsprovidesprovideRouter(routes)+provideHttpClient(withXsrfConfiguration({cookieName:'XSRF-TOKEN', headerName:'X-XSRF-TOKEN'})).AppModule/app.routing.tsremoved; every component isstandalone: truewith explicitimports.HTTP:
@angular/http→@angular/common/httpThe old
_bodystring-parsing hack is deleted; services return typedObservable<User[] | Transaction[] | Appointment[]>(newmodels.ts). Backend base URL centralized inenvironments/environment*.ts(apiBaseUrl). Security-relevant Phase 4 behavior kept: credentials in encoded POST body (not URL), usernames as path variables, enable/disable via POST.RxJS 5 → 7 & guard
rxjs/add/operator/*imports → pipeablemap/catchError/of.AuthGuard implements CanActivateclass → functionalauthGuard: CanActivateFnusinginject()(auth.guard.ts), same server-session check against/api/user/all.ngOnInit.Testing (now a hard CI gate)
TestBed+HttpTestingController(assert URLs/verbs/body — e.g. encoded login body, path-variable transaction URLs). 14 specs pass underChromeHeadlessCI.e2e/smoke.spec.tsboots the app and asserts/redirects to/loginand renders the form.playwright.config.tsserves the build viawebServer.ng testno longercontinue-on-error(blocking); newe2ejob runs Playwright.auth0-js(was never imported).Security posture
npm audit: 148 vulns (34 critical) → 54 (0 critical). The remaining 8 production highs are Angular-18 framework advisories fixed only in Angular 19+/21 (a breaking bump) — tracked as a follow-up; the rest are dev-only build tooling.Follow-up / coordination
provideHttpClient(withXsrfConfiguration(...))matches Spring's cookie/header names, but Angular only attaches the token to same-origin requests. The/api/**calls work because Phase 6 exempts that namespace; the/indexform login remains the known cross-origin CSRF gap to resolve when frontend/backend origins are unified.Verified locally:
ng build, 14 unit tests headless, Playwright smoke test — all green.Link to Devin session: https://app.devin.ai/sessions/82be2e41fda54343a20a9b73e01c0631
Requested by: @gaelkekatos-jpg
Devin Review