Skip to content

Commit

Permalink
Add HDN specific nav menus to admin console panel. (#2295)
Browse files Browse the repository at this point in the history
Fixes #2294
  • Loading branch information
Benjamin Moody committed Oct 1, 2024
2 parents 0bf86bf + 13090d1 commit fea6213
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 7 deletions.
16 changes: 15 additions & 1 deletion physionet-django/console/navbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ class NavSubmenu:
"""
A collection of links to be displayed as a submenu.
"""
def __init__(self, title, name, icon=None, items=[]):
def __init__(self, title, name, icon=None, items=[], enabled=True):
self.title = title
self.name = name
self.icon = icon
self.items = items
self.enabled = enabled


class NavMenu:
Expand Down Expand Up @@ -105,6 +106,9 @@ def get_menu_items(self, request):

for item in self.items:
if isinstance(item, NavSubmenu):
if not item.enabled:
continue

subitems = item.items
elif isinstance(item, NavLink):
subitems = [item]
Expand Down Expand Up @@ -218,4 +222,14 @@ def get_menu_items(self, request):
]),

NavLink(_('News'), 'news_console', 'newspaper'),

NavSubmenu(_('Power Users'), 'cloud_groups', 'book', [
NavLink(_('User Panel'), 'cloud_groups'),
NavLink(_('Group Management'), 'cloud_groups_management'),
NavLink(_('Group Creation'), 'create_cloud_group'),
], enabled=settings.ENABLE_CLOUD_RESEARCH_ENVIRONMENTS),

NavSubmenu(_('Monitoring'), 'datasets_monitoring', 'chart-line', [
NavLink(_('Dataset Total Usage Time'), 'get_datasets_monitoring_data'),
], enabled=settings.ENABLE_CLOUD_RESEARCH_ENVIRONMENTS),
])
6 changes: 3 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ zxcvbn = "^4.4.28"
certifi = "^2024.7.4"
setuptools = "70.0.0"
django-js-asset = "2.0.0"
hdn-research-environment = "2.3.8"
hdn-research-environment = "3.2.1"
django-oauth-toolkit = "^2.2.0"
django-cors-headers = "^3.14.0"
urllib3 = "^1.26.19"
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,8 @@ grpcio==1.53.2 ; python_version >= "3.9" and python_version < "4.0" \
--hash=sha256:f3761f9a6817e32898eaa5aecd0b0ad69d0c68ab45ea7bf206e8dc4548f025f0 \
--hash=sha256:f7e66d8b31ef2bada7029275debbe12c97397ec7ac70a659837a7b8a6a9dc916 \
--hash=sha256:f9f7c0dd17f24e1774cc3a8df738246772994e853c28b28ed6ba7711ccf0abb4
hdn-research-environment==2.3.8 ; python_version >= "3.9" and python_version < "4.0" \
--hash=sha256:371b33950e3c1598b650edefd42fa19a3532d2ca815dd42f495f0460c57df97f
hdn-research-environment==3.2.1 ; python_version >= "3.9" and python_version < "4.0" \
--hash=sha256:6aeb6489d02093df9e863164d6d25a345c1d553789c1a7e0699304fda001ddd5
html2text==2018.1.9 ; python_version >= "3.9" and python_version < "4.0" \
--hash=sha256:490db40fe5b2cd79c461cf56be4d39eb8ca68191ae41ba3ba79f6cb05b7dd662 \
--hash=sha256:627514fb30e7566b37be6900df26c2c78a030cc9e6211bda604d8181233bcdd4
Expand Down

0 comments on commit fea6213

Please sign in to comment.