fix(dashboards): lazy-load git status for visible rows
This commit is contained in:
@@ -199,7 +199,11 @@ async def get_dashboards(
|
|||||||
all_tasks = task_manager.get_all_tasks()
|
all_tasks = task_manager.get_all_tasks()
|
||||||
|
|
||||||
# Fetch dashboards with status using ResourceService
|
# Fetch dashboards with status using ResourceService
|
||||||
dashboards = await resource_service.get_dashboards_with_status(env, all_tasks)
|
dashboards = await resource_service.get_dashboards_with_status(
|
||||||
|
env,
|
||||||
|
all_tasks,
|
||||||
|
include_git_status=False,
|
||||||
|
)
|
||||||
|
|
||||||
# Apply search filter if provided
|
# Apply search filter if provided
|
||||||
if search:
|
if search:
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ class ResourceService:
|
|||||||
async def get_dashboards_with_status(
|
async def get_dashboards_with_status(
|
||||||
self,
|
self,
|
||||||
env: Any,
|
env: Any,
|
||||||
tasks: Optional[List[Task]] = None
|
tasks: Optional[List[Task]] = None,
|
||||||
|
include_git_status: bool = True,
|
||||||
) -> List[Dict[str, Any]]:
|
) -> List[Dict[str, Any]]:
|
||||||
with belief_scope("get_dashboards_with_status", f"env={env.id}"):
|
with belief_scope("get_dashboards_with_status", f"env={env.id}"):
|
||||||
client = SupersetClient(env)
|
client = SupersetClient(env)
|
||||||
@@ -57,9 +58,12 @@ class ResourceService:
|
|||||||
dashboard_dict = dashboard
|
dashboard_dict = dashboard
|
||||||
dashboard_id = dashboard_dict.get('id')
|
dashboard_id = dashboard_dict.get('id')
|
||||||
|
|
||||||
# Get Git status if repo exists
|
# Git status can be skipped for list endpoints and loaded lazily on UI side.
|
||||||
|
if include_git_status:
|
||||||
git_status = self._get_git_status_for_dashboard(dashboard_id)
|
git_status = self._get_git_status_for_dashboard(dashboard_id)
|
||||||
dashboard_dict['git_status'] = git_status
|
dashboard_dict['git_status'] = git_status
|
||||||
|
else:
|
||||||
|
dashboard_dict['git_status'] = None
|
||||||
|
|
||||||
# Show status of the latest LLM validation for this dashboard.
|
# Show status of the latest LLM validation for this dashboard.
|
||||||
last_task = self._get_last_llm_task_for_dashboard(
|
last_task = self._get_last_llm_task_for_dashboard(
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user