feat: add slug-only dashboard profile filter and unify backend imports
This commit is contained in:
3
backend/src/services/notifications/__init__.py
Normal file
3
backend/src/services/notifications/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# [DEF:src.services.notifications:Package]
|
||||
# @PURPOSE: Notification service package root.
|
||||
# [/DEF:src.services.notifications:Package]
|
||||
@@ -145,6 +145,14 @@ class ProfileService:
|
||||
if "show_only_my_dashboards" in provided_fields:
|
||||
effective_show_only = bool(payload.show_only_my_dashboards)
|
||||
|
||||
effective_show_only_slug = (
|
||||
bool(preference.show_only_slug_dashboards)
|
||||
if preference.show_only_slug_dashboards is not None
|
||||
else True
|
||||
)
|
||||
if "show_only_slug_dashboards" in provided_fields:
|
||||
effective_show_only_slug = bool(payload.show_only_slug_dashboards)
|
||||
|
||||
effective_git_username = self._sanitize_text(preference.git_username)
|
||||
if "git_username" in provided_fields:
|
||||
effective_git_username = self._sanitize_text(payload.git_username)
|
||||
@@ -206,6 +214,7 @@ class ProfileService:
|
||||
effective_superset_username
|
||||
)
|
||||
preference.show_only_my_dashboards = effective_show_only
|
||||
preference.show_only_slug_dashboards = effective_show_only_slug
|
||||
|
||||
preference.git_username = effective_git_username
|
||||
preference.git_email = effective_git_email
|
||||
@@ -460,6 +469,11 @@ class ProfileService:
|
||||
preference.superset_username_normalized
|
||||
),
|
||||
show_only_my_dashboards=bool(preference.show_only_my_dashboards),
|
||||
show_only_slug_dashboards=(
|
||||
bool(preference.show_only_slug_dashboards)
|
||||
if preference.show_only_slug_dashboards is not None
|
||||
else True
|
||||
),
|
||||
git_username=self._sanitize_text(preference.git_username),
|
||||
git_email=self._sanitize_text(preference.git_email),
|
||||
has_git_personal_access_token=bool(encrypted_token),
|
||||
@@ -586,6 +600,7 @@ class ProfileService:
|
||||
superset_username=None,
|
||||
superset_username_normalized=None,
|
||||
show_only_my_dashboards=False,
|
||||
show_only_slug_dashboards=True,
|
||||
git_username=None,
|
||||
git_email=None,
|
||||
has_git_personal_access_token=False,
|
||||
@@ -709,4 +724,4 @@ class ProfileService:
|
||||
# [/DEF:_normalize_owner_tokens:Function]
|
||||
# [/DEF:ProfileService:Class]
|
||||
|
||||
# [/DEF:backend.src.services.profile_service:Module]
|
||||
# [/DEF:backend.src.services.profile_service:Module]
|
||||
|
||||
3
backend/src/services/reports/__init__.py
Normal file
3
backend/src/services/reports/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
# [DEF:src.services.reports:Package]
|
||||
# @PURPOSE: Report service package root.
|
||||
# [/DEF:src.services.reports:Package]
|
||||
@@ -46,10 +46,11 @@ class ResourceService:
|
||||
env: Any,
|
||||
tasks: Optional[List[Task]] = None,
|
||||
include_git_status: bool = True,
|
||||
require_slug: bool = False,
|
||||
) -> List[Dict[str, Any]]:
|
||||
with belief_scope("get_dashboards_with_status", f"env={env.id}"):
|
||||
client = SupersetClient(env)
|
||||
dashboards = client.get_dashboards_summary()
|
||||
dashboards = client.get_dashboards_summary(require_slug=require_slug)
|
||||
|
||||
# Enhance each dashboard with Git status and task status
|
||||
result = []
|
||||
@@ -96,6 +97,7 @@ class ResourceService:
|
||||
page_size: int = 10,
|
||||
search: Optional[str] = None,
|
||||
include_git_status: bool = True,
|
||||
require_slug: bool = False,
|
||||
) -> Dict[str, Any]:
|
||||
with belief_scope(
|
||||
"get_dashboards_page_with_status",
|
||||
@@ -106,6 +108,7 @@ class ResourceService:
|
||||
page=page,
|
||||
page_size=page_size,
|
||||
search=search,
|
||||
require_slug=require_slug,
|
||||
)
|
||||
|
||||
result = []
|
||||
|
||||
Reference in New Issue
Block a user