Skip to content

Show GeoIP warning on homepage when GeoLite database is missing#5220

Open
bram-atmire wants to merge 1 commit intoDSpace:mainfrom
bram-atmire:feat/5219-geoip-warning
Open

Show GeoIP warning on homepage when GeoLite database is missing#5220
bram-atmire wants to merge 1 commit intoDSpace:mainfrom
bram-atmire:feat/5219-geoip-warning

Conversation

@bram-atmire
Copy link
Copy Markdown
Member

References

Fixes #5219
Related to DSpace/DSpace#12043

Description

Display a dismissible warning banner on the homepage for administrators when the GeoLite database is not installed.

Instructions for Reviewers

List of changes in this PR:

  • New GeoIpWarningComponent in src/app/home-page/geoip-warning/ — standalone component that checks admin status via AuthorizationDataService and GeoIP health via HealthService
  • Warning is shown only when the user is an administrator AND the geoIp health component reports UP_WITH_ISSUES
  • Uses the existing AlertComponent with AlertType.Warning and dismissible=true
  • Once dismissed, the warning stays hidden for the browser session using sessionStorage (does not affect other alerts)
  • Uses isPlatformBrowser to guard sessionStorage access for SSR compatibility
  • Added GeoIpWarningComponent to imports of both the base and custom theme HomePageComponent
  • Added home.geoip-warning i18n key to en.json5

How to test:

  1. Ensure the GeoLite database is not configured (comment out usage-statistics.dbfile in usage-statistics.cfg)
  2. Start the backend and frontend
  3. Log in as an administrator
  4. Verify the warning banner appears at the top of the homepage
  5. Click the X button to dismiss — the warning disappears
  6. Navigate away and return to the homepage — the warning remains hidden
  7. Open a new browser session (close tab, open new one) — the warning reappears
  8. Log in as a non-admin user — verify no warning is shown

Checklist

  • My PR is created against the main branch of code (unless it is a backport or is fixing an issue specific to an older branch).
  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & integration tests). Exceptions may be made if previously agreed upon.
  • My PR passes Checkstyle validation based on the Code Style Guide.
  • My PR includes Javadoc for all new (or modified) public methods and classes. It also includes Javadoc for large or complex private methods.
  • My PR passes all tests and includes new/updated Unit or Integration Tests based on the Code Testing Guide.
  • My PR includes details on how to test it. I've provided clear instructions to reviewers on how to successfully test this fix or feature.
  • If my PR includes new libraries/dependencies (in any pom.xml), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.
  • If my PR modifies REST API endpoints, I've opened a separate REST Contract PR related to this change.
  • If my PR includes new configurations, I've provided basic technical documentation in the PR itself.
  • If my PR fixes an issue ticket, I've linked them together.

Display a dismissible warning banner on the homepage for administrators
when the GeoLite database is not installed (geoIp health status is
UP_WITH_ISSUES). Once dismissed, the warning stays hidden for the
browser session using sessionStorage.

Resolves DSpace#5219

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@MW3000
Copy link
Copy Markdown
Contributor

MW3000 commented Mar 4, 2026

Can we add a configuration for this feature, that might be turned on by default, but can be turned off easily?

We deliberately do not collect DSpace stats and it would be a nuisance to have to dismiss the alert each time we log in as an administrator.

@pnbecker
Copy link
Copy Markdown
Member

pnbecker commented Mar 4, 2026

@bram-atmire can we please make this configurable?

@github-actions
Copy link
Copy Markdown

Hi @bram-atmire,
Conflicts have been detected against the base branch.
Please resolve these conflicts as soon as you can. Thanks!

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

Projects

Status: 🙋 Needs Reviewers Assigned

Development

Successfully merging this pull request may close these issues.

SOLR Usage stats: prominent warning in the UI when the GeoLiteCityDB file is absent

4 participants