58 lines
1.6 KiB
Markdown
58 lines
1.6 KiB
Markdown
# API Contracts: Migration Dashboard Grid
|
|
|
|
## Endpoints
|
|
|
|
### 1. List Dashboards
|
|
**Method**: `GET`
|
|
**Path**: `/api/environments/{env_id}/dashboards`
|
|
**Purpose**: Fetch all dashboards from the specified environment for the grid.
|
|
|
|
**Request Parameters**:
|
|
- `env_id` (path): The ID of the environment to fetch from.
|
|
|
|
**Response**:
|
|
- **200 OK**:
|
|
```json
|
|
[
|
|
{
|
|
"id": 123,
|
|
"title": "Sales Dashboard",
|
|
"last_modified": "2023-10-27T10:00:00Z",
|
|
"status": "published"
|
|
},
|
|
{
|
|
"id": 124,
|
|
"title": "Draft Metrics",
|
|
"last_modified": "2023-10-26T15:30:00Z",
|
|
"status": "draft"
|
|
}
|
|
]
|
|
```
|
|
- **404 Not Found**: Environment not found.
|
|
- **500 Internal Server Error**: Superset API error.
|
|
|
|
## Components (Frontend)
|
|
|
|
### DashboardGrid
|
|
**Props**:
|
|
- `dashboards`: `DashboardMetadata[]` - List of dashboards to display.
|
|
- `selectedIds`: `number[]` - IDs of currently selected dashboards.
|
|
|
|
**Events**:
|
|
- `selectionChanged`: Emitted when selection changes. Payload: `number[]` (new list of selected IDs).
|
|
|
|
**State**:
|
|
- `filterText`: string - Current filter text.
|
|
- `currentPage`: number - Current page index (0-based).
|
|
- `pageSize`: number - Items per page (default 20).
|
|
- `sortColumn`: string - 'title' | 'last_modified' | 'status'.
|
|
- `sortDirection`: 'asc' | 'desc'.
|
|
|
|
## Superset Client Extension
|
|
|
|
### `get_dashboards_summary`
|
|
**Signature**: `def get_dashboards_summary(self) -> List[Dict]`
|
|
**Purpose**: Fetches dashboard metadata optimized for the grid.
|
|
**Implementation Detail**:
|
|
- Calls `GET /api/v1/dashboard/` with query params `q=(columns:!(id,dashboard_title,changed_on_utc,published))`.
|
|
- Maps response fields to `DashboardMetadata` schema. |