Skip to content

Commit

Permalink
update legacy definitions (#1456)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkonie committed Jan 7, 2025
1 parent 977e2ab commit 8b778e5
Show file tree
Hide file tree
Showing 6 changed files with 312 additions and 297 deletions.
35 changes: 18 additions & 17 deletions adminalerts/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Projectroles dependency
from projectroles.models import SODAR_CONSTANTS
from projectroles.plugins import SiteAppPluginPoint
from projectroles.plugins import SiteAppPluginPoint, PluginAppSettingDef

from adminalerts.models import AdminAlert
from adminalerts.urls import urlpatterns
Expand All @@ -15,6 +15,21 @@
APP_SETTING_SCOPE_USER = SODAR_CONSTANTS['APP_SETTING_SCOPE_USER']
APP_SETTING_TYPE_BOOLEAN = SODAR_CONSTANTS['APP_SETTING_TYPE_BOOLEAN']

# Local constants
ADMINALERTS_APP_SETTINGS = [
PluginAppSettingDef(
name='notify_email_alert',
scope=APP_SETTING_SCOPE_USER,
type=APP_SETTING_TYPE_BOOLEAN,
default=True,
label='Receive email for admin alerts',
description=(
'Receive email for important administrator alerts regarding e.g. '
'site downtime.'
),
)
]


class SiteAppPlugin(SiteAppPluginPoint):
"""Projectroles plugin for registering the app"""
Expand All @@ -28,22 +43,8 @@ class SiteAppPlugin(SiteAppPluginPoint):
#: UI URLs
urls = urlpatterns

# TODO: Refactor as PluginAppSettingDef objects
#: App settings definition
app_settings = {
'notify_email_alert': {
'scope': APP_SETTING_SCOPE_USER,
'type': APP_SETTING_TYPE_BOOLEAN,
'default': True,
'label': 'Receive email for admin alerts',
'description': (
'Receive email for important administrator alerts regarding '
'e.g. site downtime.'
),
'user_modifiable': True,
'global': False,
}
}
#: App setting definitions
app_settings = ADMINALERTS_APP_SETTINGS

#: Iconify icon
icon = 'mdi:alert'
Expand Down
Loading

0 comments on commit 8b778e5

Please sign in to comment.