Skip to content

Conversation

@ckrew
Copy link
Contributor

@ckrew ckrew commented Nov 20, 2025

Description

This merge request addresses an issue when react apps are in single app mode. Currently there is no way for the user to log in, log out, or view the admin pages. This PR adds these elements to the react app header, in the same styling as the log in and user menu in a normal tethys environment

Changes Made to Code

  • package.json: updated to add more dependencies for the dev server
  • Header.js: added some conditional statements for header buttons. In multiple app mode, put an "Exit App" button. In single app mode, if a user is not signed in, add a "Log In" button. In single app mode, if a user is signed in, add a dropdown to access locations like user profile, admin settings, and log out
  • UserHeaderMenu.js: The user dropdown button to access locations like user profile, admin settings, and log out
  • react env template: added a TETHYS_SINGLE_APP_MODE env to track when in single app mode
  • tethys_portal/views/api.py: Updated how the APIs handle when in an open portal. If the portal is in open portal mode, then don't throw any Unauthorized (401) errors. Also added a gravatar url to the get_whoami api so that the react app can use it in the user header menu.

Quality Checks

  • At least one new test has been written for new code
  • New code has 100% test coverage
  • Code has been formatted with Black
  • Code has been linted with flake8
  • Docstrings for new methods have been added
  • The documentation has been updated appropriately

added a user header menu
added env for react app to track if single_app_mode is on
added gravatar url to whoami
only return a 401 status for get_session, get_whoami, and get_csrf if the user is not authenticated and the portal is not in open portal mode
@coveralls
Copy link

coveralls commented Nov 20, 2025

Coverage Status

coverage: 100.0%. remained the same
when pulling 1bd1526 on reactapp_standalone_logout_and_user_menu
into 582989c on main.

@swainn swainn merged commit 077f7e4 into main Nov 24, 2025
29 checks passed
@swainn swainn deleted the reactapp_standalone_logout_and_user_menu branch November 24, 2025 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants