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

Add Custom Settings to Apps Endpoint of Portal API #1004

Merged
merged 15 commits into from
Jan 11, 2024
Merged

Conversation

swainn
Copy link
Member

@swainn swainn commented Jan 5, 2024

Adds the custom settings to the object that is returned when calling the apps endpoint of the Tethys Portal REST API. This makes the custom settings available to apps with the React frontend, which uses the REST API to get info about the app.

  • The custom settings are only added if the request user is authenticated. Otherwise, the endpoint returns only the basic metadata about the app.
  • This can include all types of Custom Settings: JSON, Secret, and Simple.
  • Which custom settings are included is controlled with an new field on the CustomSettingsBase model: include_in_api. The setting is included in the API response if include_in_api is True. Defaults to False.

Example of object returned with custom settings:

{
  "title": "tRIBS Model Builder",
  "description": "An application for building new tRIBS models for SRP studies.",
  "tags": "",
  "package": "tribs",
  "urlNamespace": "tribs",
  "color": "#115590",
  "icon": "/static/tribs/images/icon.gif",
  "exitUrl": "/apps/",
  "rootUrl": "/apps/tribs/home/home/",
  "settingsUrl": "/admin/tethys_apps/tethysapp/3/change/",
  "customSettings": {
    "cesium_api_key": {
      "type": "STRING",
      "value": "some-api-key"
    },
    "json_setting": {
      "type": "JSON",
      "value": {"foo": "bar"}
    },
    "secret_setting": {
      "type": "SECRET",
      "value": "some-secret"
    }
  }
}

Also in this PR:

  • Unpinned sphinx version - seems to be working again
  • Updated configuration for newer version of sphinx theme

@swainn swainn self-assigned this Jan 5, 2024
@coveralls
Copy link

coveralls commented Jan 5, 2024

Coverage Status

coverage: 100.0%. remained the same
when pulling 896c326 on api-custom-settings
into f5cfc0b on main.

@swainn swainn force-pushed the api-custom-settings branch from 6894544 to 3a46d7c Compare January 8, 2024 23:37
@swainn swainn marked this pull request as ready for review January 9, 2024 00:10
@swainn swainn requested review from sdc50 and shawncrawley January 9, 2024 00:10
Copy link
Contributor

@shawncrawley shawncrawley left a comment

Choose a reason for hiding this comment

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

Sorry it took a bit longer to get to this, but I've looked it over and approve!

@swainn swainn force-pushed the api-custom-settings branch from e5dde2d to 896c326 Compare January 11, 2024 18:44
@swainn swainn merged commit 9f5b60c into main Jan 11, 2024
10 checks passed
@sdc50 sdc50 mentioned this pull request Apr 2, 2024
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.

3 participants