Skip to content

Remove four dead admin services that hardcode http://localhost:8080 - #154

Open
drtechie wants to merge 1 commit into
mainfrom
fix/admin-hardcoded-localhost
Open

Remove four dead admin services that hardcode http://localhost:8080#154
drtechie wants to merge 1 commit into
mainfrom
fix/admin-hardcoded-localhost

Conversation

@drtechie

@drtechie drtechie commented Jul 26, 2026

Copy link
Copy Markdown
Member

Four services in src/app/core/services/adminServices/ carry hardcoded base URLs that ignore the environment entirely:

service URL
AdminLanguage/language.service.ts http://localhost:8080/Language/iEMR/userLanguage/getData
AdminRole/role.service.ts http://localhost:8080//roleGet
AdminScreen/screen.service.ts http://localhost:8080//iEMR/UserScreen/getScreenData
AdminService/servicemaster.service.ts http://localhost:8080/iEMR/ServiceMaster/getServiceData

In any deployed build the browser is told to call localhost — the user's own machine, not the server. The doubled slashes are a further hint these were never exercised.

Why the fix is deletion rather than repointing at ADMIN_API_BASE

Two reasons:

1. The endpoints no longer exist. None of roleGet, roleSave, userLanguage/getData, UserScreen/getScreenData or ServiceMaster/getServiceData is present in Admin-API or Common-API. Repointing the base URL would turn a connection failure into a 404.

2. The code is unreachable. All four classes are injected into zero constructors. Their only references are the import and provider registration in core.module.ts:

$ grep -rnE "private +\w+ *: *(LanguageService|RoleService|ScreenService|ServicemasterService)\b" src/
(no matches)

Worth noting for reviewers: the RoleService that is used widely across the app is services/state-serviceline-role.service — a different class, untouched by this PR.

So there is no behaviour change. Nothing could call these.

Result

5 files changed, 217 deletions, 1 insertion. Afterwards:

$ grep -rn "localhost:8080" src/
(no matches)

Verification

Built from this branch on PSMRI Jenkins with the real toolchain (NODE_20, Angular 16): SUCCESS. Inspected the compiled bundle actually served by the deployment afterwards — localhost references went from 8 to 0, and the Admin UI still loads and serves normally.

How this was found

Standing up AMRIT for a new partner. Auditing the served main.*.js for URLs that should not be in a partner build surfaced 8 localhost references, which led back to these four files. They are identical on release-3.4.0, release-3.6.1 and main, so every deployment currently ships them.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor
    • Removed legacy administrative service integrations for language, roles, screens, and service master data.
    • These retired capabilities are no longer available through the application’s core services.

LanguageService, RoleService, ScreenService and ServicemasterService each carry
hardcoded base URLs:

    http://localhost:8080/Language/iEMR/userLanguage/getData
    http://localhost:8080//roleGet
    http://localhost:8080//iEMR/UserScreen/getScreenData
    http://localhost:8080/iEMR/ServiceMaster/getServiceData

They ignore the environment entirely, so in any deployed build the browser is told
to call localhost — which is the user's own machine, not the server. The doubled
slashes are a further hint that these were never exercised.

Repointing them at ADMIN_API_BASE would not help: none of those five endpoints
exists in Admin-API or Common-API, so the result would be a 404 instead of a
connection failure.

They are also unreachable code. All four classes are injected into ZERO
constructors; the only references are the import and provider registration in
core.module.ts. (Note the RoleService that IS widely used across the app is
services/state-serviceline-role.service — a different class, untouched here.)

So this deletes the four files and their registrations rather than fixing URLs
that point at endpoints which no longer exist. No behaviour change: nothing could
call them.

After this change `grep -rn 'localhost:8080' src/` returns nothing.

Found while standing up AMRIT for a new partner: inspecting the compiled bundle
served from the deployment showed 8 references to localhost, which is what led
back to these four files. Present identically on release-3.4.0, release-3.6.1 and
main, so every deployment ships them.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@drtechie
drtechie requested a review from snehar-nd July 26, 2026 15:14
@coderabbitai

coderabbitai Bot commented Jul 26, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fadb78c7-e492-499e-bb4e-b5ea0b0a4ccc

📥 Commits

Reviewing files that changed from the base of the PR and between c4ed338 and aa8bc57.

📒 Files selected for processing (5)
  • src/app/core/core.module.ts
  • src/app/core/services/adminServices/AdminLanguage/language.service.ts
  • src/app/core/services/adminServices/AdminRole/role.service.ts
  • src/app/core/services/adminServices/AdminScreen/screen.service.ts
  • src/app/core/services/adminServices/AdminService/servicemaster.service.ts
💤 Files with no reviewable changes (4)
  • src/app/core/services/adminServices/AdminScreen/screen.service.ts
  • src/app/core/services/adminServices/AdminService/servicemaster.service.ts
  • src/app/core/services/adminServices/AdminRole/role.service.ts
  • src/app/core/services/adminServices/AdminLanguage/language.service.ts

📝 Walkthrough

Walkthrough

The change removes four admin services and their registrations from CoreModule, including both module provider arrays and the LanguageService implementation with its HTTP methods.

Changes

Admin service removal

Layer / File(s) Summary
Remove admin services and providers
src/app/core/core.module.ts, src/app/core/services/adminServices/*
CoreModule no longer imports or registers LanguageService, RoleService, ScreenService, or ServicemasterService; the corresponding service implementations are removed.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 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 clearly matches the main change: deleting four unused admin services that hardcode localhost URLs.
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

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: dependency version conflict. Check your lock file or package.json.


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.

@sonarqubecloud

Copy link
Copy Markdown

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