Работает создание коммитов и перенос в новый enviroment
This commit is contained in:
@@ -1,58 +1,93 @@
|
||||
# API Contracts: Git Integration Plugin
|
||||
|
||||
## Git Configuration
|
||||
**Feature**: Git Integration for Dashboard Development
|
||||
**Date**: 2026-01-22
|
||||
|
||||
### `GET /api/git/config`
|
||||
List all Git server configurations.
|
||||
## Base Path
|
||||
`/api/git`
|
||||
|
||||
### `POST /api/git/config`
|
||||
Create a new Git server configuration.
|
||||
- **Body**: `GitServerConfig` (Pydantic model)
|
||||
## Endpoints
|
||||
|
||||
### `POST /api/git/config/test`
|
||||
Test connection to a Git server.
|
||||
- **Body**: `GitServerConfig`
|
||||
- **Response**: `{"status": "success" | "error", "message": String}`
|
||||
### 1. Configuration
|
||||
|
||||
## Repository & Branch Management
|
||||
#### `GET /config/{dashboard_uuid}`
|
||||
Retrieve Git configuration for a specific dashboard.
|
||||
- **Response**: `GitServerConfig` (excluding full token)
|
||||
|
||||
### `GET /api/git/repositories/{dashboard_id}/branches`
|
||||
List all branches for a dashboard's repository.
|
||||
#### `POST /config`
|
||||
Save or update Git configuration.
|
||||
- **Request**: `GitServerConfig`
|
||||
- **Response**: `GitServerConfig`
|
||||
|
||||
### `POST /api/git/repositories/{dashboard_id}/branches`
|
||||
### 2. Repository Operations
|
||||
|
||||
#### `POST /init/{dashboard_uuid}`
|
||||
Initialize/Clone the repository for the dashboard.
|
||||
- **Request**: Empty (uses stored config)
|
||||
- **Response**: `{ "status": "success", "message": "Repository cloned" }`
|
||||
|
||||
#### `GET /status/{dashboard_uuid}`
|
||||
Get current status (changes between Superset export and local git HEAD).
|
||||
- **Response**:
|
||||
```json
|
||||
{
|
||||
"branch": "main",
|
||||
"changes": [
|
||||
{ "file_path": "charts/sales.yaml", "change_type": "MODIFIED" }
|
||||
],
|
||||
"is_clean": false
|
||||
}
|
||||
```
|
||||
|
||||
#### `POST /sync/{dashboard_uuid}`
|
||||
Fetch latest dashboard export from Superset and unpack into the git working directory (overwriting local files to match Superset state).
|
||||
- **Response**: `{ "status": "success", "changes_detected": true }`
|
||||
|
||||
### 3. Branch Management
|
||||
|
||||
#### `GET /branches/{dashboard_uuid}`
|
||||
List all local and remote branches.
|
||||
- **Response**: `List[Branch]`
|
||||
|
||||
#### `POST /branches/{dashboard_uuid}`
|
||||
Create a new branch.
|
||||
- **Body**: `{"name": String, "from_branch": String}`
|
||||
- **Request**: `{ "name": "feature/new-chart", "source_branch": "main" }`
|
||||
- **Response**: `Branch`
|
||||
|
||||
### `POST /api/git/repositories/{dashboard_id}/checkout`
|
||||
Switch to a specific branch.
|
||||
- **Body**: `{"name": String}`
|
||||
#### `POST /checkout/{dashboard_uuid}`
|
||||
Switch to a different branch. **Warning**: This updates the Superset Dashboard content to match the branch state!
|
||||
- **Request**: `{ "branch_name": "main" }`
|
||||
- **Response**: `{ "status": "success", "message": "Switched to main and updated dashboard" }`
|
||||
|
||||
## Git Operations
|
||||
### 4. Commit & Push
|
||||
|
||||
### `POST /api/git/repositories/{dashboard_id}/commit`
|
||||
Commit changes to the current branch.
|
||||
- **Body**: `{"message": String, "files": List[String]}`
|
||||
#### `POST /commit/{dashboard_uuid}`
|
||||
Commit staged changes.
|
||||
- **Request**: `{ "message": "Updated sales chart", "files": ["charts/sales.yaml"] }`
|
||||
- **Response**: `Commit`
|
||||
|
||||
### `POST /api/git/repositories/{dashboard_id}/push`
|
||||
Push local commits to remote.
|
||||
#### `POST /push/{dashboard_uuid}`
|
||||
Push commits to remote.
|
||||
- **Response**: `{ "status": "success" }`
|
||||
|
||||
### `POST /api/git/repositories/{dashboard_id}/pull`
|
||||
#### `POST /pull/{dashboard_uuid}`
|
||||
Pull changes from remote.
|
||||
- **Response**: `{ "status": "success", "updates": [...] }`
|
||||
|
||||
## Conflict Resolution
|
||||
### 5. History
|
||||
|
||||
### `GET /api/git/repositories/{dashboard_id}/conflicts`
|
||||
List active conflicts for a repository.
|
||||
#### `GET /history/{dashboard_uuid}`
|
||||
Get commit log.
|
||||
- **Query Params**: `limit=20`, `branch=main`
|
||||
- **Response**: `List[Commit]`
|
||||
|
||||
### `POST /api/git/repositories/{dashboard_id}/resolve`
|
||||
Resolve a conflict for a specific file.
|
||||
- **Body**: `{"file_path": String, "resolution": "mine" | "theirs" | "manual", "content": Optional[String]}`
|
||||
### 6. Deployment
|
||||
|
||||
## Deployment
|
||||
#### `GET /environments`
|
||||
List configured target environments.
|
||||
- **Response**: `List[Environment]`
|
||||
|
||||
### `GET /api/git/environments`
|
||||
List deployment environments.
|
||||
|
||||
### `POST /api/git/repositories/{dashboard_id}/deploy`
|
||||
Deploy dashboard from current branch to target environment.
|
||||
- **Body**: `{"environment_id": UUID}`
|
||||
#### `POST /deploy/{dashboard_uuid}`
|
||||
Deploy current branch state to a target environment.
|
||||
- **Request**: `{ "environment_id": "uuid", "commit_hash": "optional-hash" }`
|
||||
- **Response**: `{ "status": "success", "job_id": "..." }`
|
||||
Reference in New Issue
Block a user