67 lines
2.8 KiB
Markdown
67 lines
2.8 KiB
Markdown
# Research: Migration Dashboard Grid
|
|
|
|
## 1. Superset API Capabilities
|
|
|
|
**Objective**: Verify how to fetch dashboard metadata (title, last modified, status).
|
|
|
|
- **Findings**:
|
|
- The `SupersetClient.get_dashboards` method in `superset_tool/client.py` already 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`
|
|
- Pagination is handled internally by `_fetch_all_pages`, so the client fetches *all* dashboards.
|
|
|
|
- **Decision**: Use the existing `SupersetClient.get_dashboards` method. No changes needed to the core client.
|
|
|
|
## 2. Frontend Grid Implementation
|
|
|
|
**Objective**: Choose a strategy for the grid component (filtering, sorting, pagination).
|
|
|
|
- **Options**:
|
|
1. **Server-side pagination**: Fetch page by page. Good for huge datasets (>10k).
|
|
2. **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.svelte` is too simple (no sorting/pagination).
|
|
|
|
- **Decision**:
|
|
- Implement a new `DashboardGrid.svelte` component.
|
|
- **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 on `dashboards` + `filterText`.
|
|
- `sortedDashboards`: Derived from `filteredDashboards` + `sort` params.
|
|
- `paginatedDashboards`: Slice of `sortedDashboards` for current page.
|
|
- "Select All": Adds all IDs from `sortedDashboards` (not just `paginatedDashboards`) to `selectedIds`.
|
|
|
|
## 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**:
|
|
```json
|
|
[
|
|
{
|
|
"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` (or `mappings.py` if more appropriate, but `migration` seems better for source selection).
|