Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standalone App Mode #1015

Merged
merged 26 commits into from
Apr 1, 2024
Merged

Standalone App Mode #1015

merged 26 commits into from
Apr 1, 2024

Conversation

ckrew
Copy link
Contributor

@ckrew ckrew commented Mar 8, 2024

This PR allows a tethys portal to be configured to act as a single app instead of a host for multiple apps.

In order to enable this mode, users will need to update their portal_config.yml under TETHYS_PORTAL_CONFIG then MULTIPLE_APP_MODE. The value is a boolean. The default value for this is True and by changing it to False, the standalone app mode will be enabled. An optional setting is STANDALONE_APP. This can be used to determine which app will be the standalone app. If this is not provided, then the code will just use the first application in the DB.

standalone_app_config

The configured standalone application will become the home page for the tethys portal. The app library page is redirected to the standalone app as well. You can see the example below where I am accessing the application from the root instead of apps.

image

You can additionally see in the screenshot above, that the user menu is now available within the application itself. I have updated the headers in the app base html to show the user menu button if the Standalone App mode is turned on. A user can use that button to check portal/user settings just like before.

When a user now checks the other available tethys endpoints like the user profiles and admin settings, the headers are updated to reflect the Standalone App mode. As shown in the screenshot below, the "Tethys Portal" button on the left can still be updated to reflect a brand or company. The "Apps" button on the right will now display the app package name and redirect to the application.

image

ckrew added 11 commits March 6, 2024 16:30
home and app_library now redirected to the configured app
admin capabilities still working
need to figure out a way to get the admin dropdown menu in the stand alone app and clean up header buttons
adder user menu button to app base header when in standalone app mode
…dd the controller name since that can be controlled by the application itself

add some logic to the site commands, if a standalone app is given, then update site settings accordingly

fixed some old url patterns for non standalone_app_mode that had been messed up

updated header.html to not show App Library button if standalone app is enabled
update the apps library title instead
black formatted and linted
…instead

MULTIPLE_APP_MODE defaults to False so this new standalone app behavior would be the default
moved away from updating site settings to use context processor instead
black format and lint
@ckrew ckrew marked this pull request as ready for review March 12, 2024 15:51
@ckrew ckrew marked this pull request as draft March 12, 2024 17:54
ckrew added 3 commits March 12, 2024 15:27
fixed tests with the new MULTIPLE_APP_MODE default
Added an ObjectDoesNotExist exception for when no apps are installed
@coveralls
Copy link

coveralls commented Mar 14, 2024

Coverage Status

coverage: 100.0%. remained the same
when pulling 1825cc4 on ckrew:standalone_apps
into 3a895bc on tethysplatform:main.

@ckrew ckrew marked this pull request as ready for review March 18, 2024 20:14
@swainn swainn mentioned this pull request Mar 22, 2024
Copy link
Member

@sdc50 sdc50 left a comment

Choose a reason for hiding this comment

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

Just a few changes. Let's get rid of the obsolete test file. And then report if the user menu can be reasonably be moved into its own template.

@ckrew
Copy link
Contributor Author

ckrew commented Apr 1, 2024

@sdc50 and @swainn The two suggested changes have been implemented

Copy link
Member

@sdc50 sdc50 left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks @ckrew!

@sdc50 sdc50 requested a review from swainn April 1, 2024 22:02
@sdc50
Copy link
Member

sdc50 commented Apr 1, 2024

@swainn I think this is good to be merged if you approve now.

@swainn swainn merged commit c7db773 into tethysplatform:main Apr 1, 2024
9 of 10 checks passed
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