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

Customize Health Page Title #288

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ snovault
Change Log
----------

11.14.0
=======

* Allow customization of health page title


11.13.0
=======

Expand Down
939 changes: 567 additions & 372 deletions poetry.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "dcicsnovault"
version = "11.13.0"
version = "11.14.0"
description = "Storage support for 4DN Data Portals."
authors = ["4DN-DCIC Team <[email protected]>"]
license = "MIT"
Expand Down Expand Up @@ -84,6 +84,7 @@ xlrd = "^1.0.0"
"zope.interface" = ">=4.7.2,<6"
"zope.sqlalchemy" = "1.6"
jsonschema = {extras = ["format-nongpl"], version = "^4.19.0"}
uptime = "^3.0.1"

[tool.poetry.dev-dependencies]
boto3-stubs = ">=1.28.62" # no particular version required, but this speeds up search
Expand Down
5 changes: 5 additions & 0 deletions snovault/project/health.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class SnovaultProjectHealthValue:

@staticmethod
def get_app_namespace():
return 'ENCODED'
2 changes: 2 additions & 0 deletions snovault/project_defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from .project.loadxl import SnovaultProjectLoadxl
from .project.renderers import SnovaultProjectRenderers
from .project.schema_views import SnovaultProjectSchemaViews
from .project.health import SnovaultProjectHealthValue


@C4ProjectRegistry.register("dcicsnovault")
Expand All @@ -16,6 +17,7 @@ class SnovaultProject(SnovaultProjectAccessKey,
SnovaultProjectLoadxl,
SnovaultProjectRenderers,
SnovaultProjectSchemaViews,
SnovaultProjectHealthValue,
C4Project):
NAMES = {"NAME": "snovault", "PYPI_NAME": "dcicsnovault"}
ACCESSION_PREFIX = "SNO"
5 changes: 3 additions & 2 deletions snovault/root.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from .appdefs import APP_VERSION_REGISTRY_KEY, ITEM_INDEX_ORDER
from .schema_formats import is_accession
from .util import SettingsKey
from .project_app import app_project


def includeme(config):
Expand Down Expand Up @@ -124,8 +125,8 @@ class ExtendedHealthPageKey(HealthPageKey):
h.BEANSTALK_APP_VERSION: settings.get(s.EB_APP_VERSION),
h.BEANSTALK_ENV: env_name,
h.BLOB_BUCKET: settings.get(s.BLOB_BUCKET),
h.DATABASE: settings.get(s.SQLALCHEMY_URL).split('@')[1], # don't show user /password
h.DISPLAY_TITLE: "ENCODED Portal Status and Foursight Monitoring",
h.DATABASE: settings.get(s.SQLALCHEMY_URL, 'dummy@postgres').split('@')[1], # don't show user /password
h.DISPLAY_TITLE: f"{app_project().get_app_namespace()} Portal Status and Foursight Monitoring",
h.ELASTICSEARCH: settings.get(s.ELASTICSEARCH_SERVER),
h.FILE_UPLOAD_BUCKET: settings.get(s.FILE_UPLOAD_BUCKET),
h.FOURSIGHT: foursight_url,
Expand Down
2 changes: 2 additions & 0 deletions snovault/tests/root.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Deny,
Everyone,
)
from ..root import health_check
from ..schema_utils import format_checker
from ..calculated import calculated_property
from ..resources import Root
Expand All @@ -19,6 +20,7 @@


def includeme(config):
config.include(health_check)
config.scan(__name__)


Expand Down
12 changes: 12 additions & 0 deletions snovault/tests/test_health_path.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import pytest
from dcicutils.misc_utils import ignored


ignored(pytest)


def test_health_page_basic(testapp):
""" Tests that we can reach the health page and that the customization works """
health = testapp.get('/health').json
assert health['display_title'] == 'ENCODED Portal Status and Foursight Monitoring'
assert health['database'] == 'postgres'
1 change: 1 addition & 0 deletions snovault/tests/testappfixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from .. import main # Function main actually defined in __init__.py (should maybe be defined elsewhere)

_app_settings = {
'env.name': 'snovault',
'collection_datastore': 'database',
'item_datastore': 'database',
'load_test_only': True,
Expand Down
Loading