2.8 KiB
2.8 KiB
Research: Migration Dashboard Grid
1. Superset API Capabilities
Objective: Verify how to fetch dashboard metadata (title, last modified, status).
-
Findings:
- The
SupersetClient.get_dashboardsmethod insuperset_tool/client.pyalready exists. - It fetches the following columns by default:
["slug", "id", "changed_on_utc", "dashboard_title", "published"]. - This covers all requirements:
- Name ->
dashboard_title - Last Modified ->
changed_on_utc - Status ->
published
- Name ->
- Pagination is handled internally by
_fetch_all_pages, so the client fetches all dashboards.
- The
-
Decision: Use the existing
SupersetClient.get_dashboardsmethod. No changes needed to the core client.
2. Frontend Grid Implementation
Objective: Choose a strategy for the grid component (filtering, sorting, pagination).
-
Options:
- Server-side pagination: Fetch page by page. Good for huge datasets (>10k).
- Client-side pagination: Fetch all, filter/sort/paginate in browser. Good for typical datasets (<1k) and simplifies "Select All" logic.
-
Findings:
- Spec explicitly requests "Client-side (Fetch all, filter locally)".
- Spec requires "Select All" to select all filtered results, which is trivial with client-side state but complex with server-side pagination (requires tracking exclusion list or query parameters).
- Existing
MappingTable.svelteis too simple (no sorting/pagination).
-
Decision:
- Implement a new
DashboardGrid.sveltecomponent. - State Management:
dashboards: Array of all fetched dashboards.filterText: String for name filtering.sortColumn: 'title' | 'changed_on' | 'published'.sortDirection: 'asc' | 'desc'.currentPage: Integer.pageSize: Integer (default 20).selectedIds: Set/Array of selected dashboard IDs.
- Logic:
filteredDashboards: Derived store/value based ondashboards+filterText.sortedDashboards: Derived fromfilteredDashboards+sortparams.paginatedDashboards: Slice ofsortedDashboardsfor current page.- "Select All": Adds all IDs from
sortedDashboards(not justpaginatedDashboards) toselectedIds.
- Implement a new
3. API Contract
Objective: Define the endpoint to serve dashboard data.
-
Current State: Need to check if an endpoint exists that returns this data.
-
Requirement:
GET /api/migration/dashboards(or similar). -
Response Structure:
[ { "id": 123, "title": "Sales Dashboard", "changed_on": "2023-10-27T10:00:00Z", "published": true }, ... ] -
Decision: Create or update a route in
backend/src/api/routes/migration.py(ormappings.pyif more appropriate, butmigrationseems better for source selection).