Skip to content

feat(supervisor): phase 7b — activity console shell, telephony iframes, supervisor entry route#9

Open
Madhav2402 wants to merge 2 commits into
feat/phase6-call-formsfrom
feat/phase7b-supervisor-shell
Open

feat(supervisor): phase 7b — activity console shell, telephony iframes, supervisor entry route#9
Madhav2402 wants to merge 2 commits into
feat/phase6-call-formsfrom
feat/phase7b-supervisor-shell

Conversation

@Madhav2402

@Madhav2402 Madhav2402 commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

📋 Description


✅ Type of Change

  • 🐞 Bug fix (non-breaking change which resolves an issue)
  • New feature (non-breaking change which adds functionality)
  • 🔥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 🛠 Refactor (change that is neither a fix nor a new feature)
  • ⚙️ Config change (configuration file or build script updates)
  • 📚 Documentation (updates to docs or readme)
  • 🧪 Tests (adding new or updating existing tests)
  • 🎨 UI/UX (changes that affect the user interface)
  • 🚀 Performance (improves performance)
  • 🧹 Chore (miscellaneous changes that don't modify src or test files)

What's in this PR

Supervisor console shell (app-modules/supervisor/supervisor-shell.component)

  • Old navbar faithfully ported: Activities (17 items incl. the Communication group), Reports (incl. the Call Reports group), Configurations, Back to Dashboard
  • Old Activity_Number page switch with the default landing = "Blacklist a Number" (old Activity_Number = 3 quirk, kept)
  • Page numbers normalized to STRINGS throughout: the old show("2")-string vs *ngSwitchCase="2"-number mix only worked because pre-v17 Angular's NgSwitch used loose equality — modern @switch is strict
  • Old Communication / Call Reports submenus render as labeled groups in the flat dropdown (same items, same actions — look-and-feel modernization)
  • Single PAGES map = one source of truth for menu labels and the per-slice placeholders
  • Old page numbers 4/6/8 (menu-less in the old app) stay reserved — reachable only programmatically, exactly like before

Telephony iframes (telephony-iframe.component)

  • One parameterized component replacing the old app's three identical iframe screens: adminui.php?agentStatus / ?campaignStatus / ?reportUI — URLs byte-identical, height 700px like the old embeds
  • Hidden SSO iframe: remote_login.php?username={user}&key=undefined — the old login's getLoginKey call was commented out, so loginKey was always undefined and the URL literally carried key=undefined; kept byte-faithful. (The old app also built a never-subscribed http.get to the same URL — dead code, not ported.)
  • New ConfigService.trustedTelephonyUrl() — the single bypassSecurityTrustResourceUrl site for the telephony origin (CTI bar, SSO, adminui embeds all go through it)

Inner-page role fork (old app-1097 structure kept — per mentor-side decision)

  • Same inner-page component serves both flows, forked by role exactly like the old app: CO → call wizard, Supervisor → activity console, any other role (Admin) → nothing (old 1097.component.html fork, verbatim semantics)
  • Supervisor init fires exactly the old app's four unconditional calls (call/getCallTypesV1, cti/getIVRSPathDetails, cti/getAgentState, cti/getAgentCallStats) — verified live, byte-identical traffic

Route + navigation

  • New route MultiRoleScreenComponent/InnerpageComponent (old path verbatim) → the shared inner page
  • Dashboard sidebar "Activity Area" button (Supervisor-only) enabled → navigates there

Faithfulness hardening (post code-review fixes, second commit)

  • CzentrixHttpService.agentPayload: a role with no agent id now posts {} exactly like the old app (whose {agent_id: undefined} was dropped by JSON serialization) instead of a novel {"agent_id":""} shape
  • Console gated to the Supervisor role only (an @else would have shown it to Admin — the old app rendered an empty area for Admin)
  • Iframe height restored to the old 700px

Declared deviation

  • The old supervisor entry route (InnerpageComponent) had no auth guard at all. This PR guards it with the plain login check (authGuard + role-selected check). Zero backend impact (the guard is a client-side sessionStorage read), and the old AuthGuard (token && isOnCall !== 'yes') would have passed a supervisor anyway — this only closes the unauthenticated-access gap.

Verification (live, logged in as the UAT 1097Supervisor)

  • Dashboard → Activity Area → console renders; default landing = Blacklist placeholder
  • All three menus in old order; page switching works; Back to Dashboard works
  • All three adminui.php iframe URLs byte-exact; SSO iframe URL byte-exact incl. the key=undefined quirk (CZentrix content itself needs the UAT VPN — same as the CTI bar)
  • Supervisor init traffic = exactly the old 4 calls, all 200; cti/getAgentState body identical ({"agent_id":2002})
  • Admin role check: no console, no wizard, no SSO iframe (faithful empty area)
  • ng build clean, tsc clean, GPL header check passing

ℹ️ Additional Information

The "Feedback Tracking" menu item opens the grievance screen — that's what the old app does (label vs destination mismatch); ported faithfully and being flagged separately for a decision on the label.

Summary by CodeRabbit

  • New Features

    • Added a Supervisor Console with navigation menus, activity pages, reports, and configuration sections.
    • Enabled the dashboard’s Activity Area entry and added navigation to the supervisor experience.
    • Added telephony console views embedded within supported supervisor activities.
    • Added role-based rendering so supervisors can access the new console from the call area.
    • Added a dedicated Activity Area route with authentication and role protections.
  • Bug Fixes

    • Improved telephony requests when no agent is assigned by omitting the agent identifier instead of sending an empty value.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The Activity Area is now an enabled dashboard destination with a guarded route. Supervisor roles render a new navigation shell with telephony iframe views, while telephony URL trust is centralized in ConfigService.

Changes

Supervisor Activity Area

Layer / File(s) Summary
Centralized telephony URL handling
src/app/app-modules/core/services/config.service.ts, src/app/app-modules/auth/shell/shell.component.ts, src/app/app-modules/call/innerpage/innerpage.component.ts, src/app/app-modules/supervisor/telephony-iframe.component.ts, src/app/app-modules/core/services/cti.service.ts
ConfigService now creates trusted telephony URLs. Shell and iframe consumers use the helper, while missing CTI agent IDs serialize as omitted fields.
Supervisor shell and page switching
src/app/app-modules/supervisor/supervisor-shell.component.ts, src/app/app-modules/supervisor/supervisor-shell.component.html
Adds supervisor page metadata, dropdown menus, active-page switching, supported telephony iframe views, fallback content, and a hidden SSO iframe.
Activity Area route and supervisor rendering
src/app/app.routes.ts, src/app/app-modules/call/innerpage/innerpage.component.ts, src/app/app-modules/call/innerpage/innerpage.component.html, src/app/app-modules/auth/dashboard/components/dashboard-sidebar.component.ts
Adds the guarded lazy route, renders the supervisor shell for Supervisor roles, and wires the dashboard Activity Area button to navigation.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant DashboardSidebarComponent
  participant AppRoutes
  participant InnerpageComponent
  participant SupervisorShellComponent
  participant TelephonyIframeComponent
  participant ConfigService

  DashboardSidebarComponent->>AppRoutes: Navigate to Activity Area
  AppRoutes->>InnerpageComponent: Activate guarded route
  InnerpageComponent->>SupervisorShellComponent: Render for Supervisor role
  SupervisorShellComponent->>TelephonyIframeComponent: Render selected telephony page
  TelephonyIframeComponent->>ConfigService: Build trusted telephony URL
  ConfigService-->>TelephonyIframeComponent: Return SafeResourceUrl
Loading

Possibly related PRs

Suggested reviewers: snehar-nd, drtechie

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is specific and accurately summarizes the main Supervisor activity console, iframe, and entry-route changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Madhav2402

Copy link
Copy Markdown
Contributor Author

@CodeRabbit full review

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/app/app-modules/supervisor/supervisor-shell.component.ts (1)

157-165: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

URL-encode the username parameter.

If a user's username contains special characters (like spaces, &, +, or #), it could break the query string structure of the SSO URL. Consider using encodeURIComponent to ensure it is passed safely to the backend.

♻️ Proposed fix
   protected readonly ssoUrl: SafeResourceUrl = this.config.trustedTelephonyUrl(
-    `remote_login.php?username=${this.sessionStore.user()?.userName ?? ''}&key=undefined`,
+    `remote_login.php?username=${encodeURIComponent(this.sessionStore.user()?.userName ?? '')}&key=undefined`,
   );
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/app/app-modules/supervisor/supervisor-shell.component.ts` around lines
157 - 165, Update the ssoUrl construction to apply encodeURIComponent to the
sessionStore.user()?.userName value before interpolating it into the username
query parameter, while preserving the existing empty fallback and key=undefined
behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/app/app-modules/supervisor/supervisor-shell.component.ts`:
- Around line 157-165: Update the ssoUrl construction to apply
encodeURIComponent to the sessionStore.user()?.userName value before
interpolating it into the username query parameter, while preserving the
existing empty fallback and key=undefined behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: efaaf451-1320-4675-9318-bb0b658d583c

📥 Commits

Reviewing files that changed from the base of the PR and between 8a72b0c and 4aeb7e4.

📒 Files selected for processing (10)
  • src/app/app-modules/auth/dashboard/components/dashboard-sidebar.component.ts
  • src/app/app-modules/auth/shell/shell.component.ts
  • src/app/app-modules/call/innerpage/innerpage.component.html
  • src/app/app-modules/call/innerpage/innerpage.component.ts
  • src/app/app-modules/core/services/config.service.ts
  • src/app/app-modules/core/services/cti.service.ts
  • src/app/app-modules/supervisor/supervisor-shell.component.html
  • src/app/app-modules/supervisor/supervisor-shell.component.ts
  • src/app/app-modules/supervisor/telephony-iframe.component.ts
  • src/app/app.routes.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant