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()
|
||||
|
||||
# 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
|
||||
if search:
|
||||
|
||||
@@ -44,7 +44,8 @@ class ResourceService:
|
||||
async def get_dashboards_with_status(
|
||||
self,
|
||||
env: Any,
|
||||
tasks: Optional[List[Task]] = None
|
||||
tasks: Optional[List[Task]] = None,
|
||||
include_git_status: bool = True,
|
||||
) -> List[Dict[str, Any]]:
|
||||
with belief_scope("get_dashboards_with_status", f"env={env.id}"):
|
||||
client = SupersetClient(env)
|
||||
@@ -57,9 +58,12 @@ class ResourceService:
|
||||
dashboard_dict = dashboard
|
||||
dashboard_id = dashboard_dict.get('id')
|
||||
|
||||
# Get Git status if repo exists
|
||||
git_status = self._get_git_status_for_dashboard(dashboard_id)
|
||||
dashboard_dict['git_status'] = git_status
|
||||
# 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)
|
||||
dashboard_dict['git_status'] = git_status
|
||||
else:
|
||||
dashboard_dict['git_status'] = None
|
||||
|
||||
# Show status of the latest LLM validation for this dashboard.
|
||||
last_task = self._get_last_llm_task_for_dashboard(
|
||||
|
||||
Reference in New Issue
Block a user