Работает создание коммитов и перенос в новый enviroment
This commit is contained in:
@@ -1,56 +1,76 @@
|
||||
# Data Model: Git Integration Plugin
|
||||
|
||||
**Feature**: Git Integration for Dashboard Development
|
||||
**Date**: 2026-01-22
|
||||
|
||||
## Entities
|
||||
|
||||
### GitServerConfig
|
||||
- **id**: UUID (Primary Key)
|
||||
- **name**: String (Display name)
|
||||
- **provider**: Enum (GITHUB, GITLAB, GITEA)
|
||||
- **url**: String (e.g., https://github.com)
|
||||
- **pat**: String (Encrypted/Sensitive)
|
||||
- **default_repository**: String (e.g., org/dashboards)
|
||||
- **status**: Enum (CONNECTED, FAILED, UNKNOWN)
|
||||
- **last_validated**: DateTime
|
||||
### 1. GitServerConfig
|
||||
Configuration for connecting a dashboard to a Git repository.
|
||||
|
||||
### GitRepository
|
||||
- **id**: UUID (Primary Key)
|
||||
- **dashboard_id**: Integer (Link to Superset Dashboard ID)
|
||||
- **config_id**: UUID (FK to GitServerConfig)
|
||||
- **remote_url**: String
|
||||
- **local_path**: String (Relative to backend storage)
|
||||
- **current_branch**: String
|
||||
- **sync_status**: Enum (CLEAN, DIRTY, CONFLICT)
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `id` | UUID | Unique identifier |
|
||||
| `dashboard_uuid` | UUID | The Superset Dashboard UUID this config applies to |
|
||||
| `provider` | Enum | `GITHUB`, `GITLAB`, `GITEA`, `GENERIC` |
|
||||
| `server_url` | String | Base URL of the git server (e.g., `https://gitlab.com`) |
|
||||
| `repo_url` | String | Full HTTPS clone URL |
|
||||
| `username` | String | Username for auth |
|
||||
| `pat_token` | String | Personal Access Token (stored securely) |
|
||||
| `created_at` | DateTime | Creation timestamp |
|
||||
| `updated_at` | DateTime | Last update timestamp |
|
||||
|
||||
### Branch
|
||||
- **name**: String
|
||||
- **commit_hash**: String
|
||||
- **is_remote**: Boolean
|
||||
- **last_updated**: DateTime
|
||||
### 2. Environment
|
||||
Target environments for deployment.
|
||||
|
||||
### Commit
|
||||
- **hash**: String (Primary Key)
|
||||
- **author**: String
|
||||
- **email**: String
|
||||
- **timestamp**: DateTime
|
||||
- **message**: String
|
||||
- **files_changed**: List[String]
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `id` | UUID | Unique identifier |
|
||||
| `name` | String | Display name (e.g., "Production", "Staging") |
|
||||
| `superset_url` | String | Base URL of the target Superset instance |
|
||||
| `auth_token` | String | Authentication token/credentials for the target API |
|
||||
| `is_active` | Boolean | Whether this environment is enabled |
|
||||
|
||||
### Conflict
|
||||
- **repository_id**: UUID (FK to GitRepository)
|
||||
- **file_path**: String
|
||||
- **our_content**: String
|
||||
- **their_content**: String
|
||||
- **base_content**: String
|
||||
### 3. Branch (DTO)
|
||||
Data Transfer Object representing a Git branch.
|
||||
|
||||
### DeploymentEnvironment
|
||||
- **id**: UUID (Primary Key)
|
||||
- **name**: String (e.g., Production, Staging)
|
||||
- **superset_url**: String
|
||||
- **superset_token**: String (Sensitive)
|
||||
- **is_active**: Boolean
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `name` | String | Branch name (e.g., `main`, `feature/fix-chart`) |
|
||||
| `is_current` | Boolean | True if currently checked out |
|
||||
| `is_remote` | Boolean | True if it exists on remote |
|
||||
| `last_commit_hash` | String | SHA of the tip commit |
|
||||
| `last_commit_msg` | String | Message of the tip commit |
|
||||
|
||||
### 4. Commit (DTO)
|
||||
Data Transfer Object representing a Git commit.
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `hash` | String | Full SHA hash |
|
||||
| `short_hash` | String | First 7 chars of hash |
|
||||
| `author_name` | String | Author name |
|
||||
| `author_email` | String | Author email |
|
||||
| `date` | DateTime | Commit timestamp |
|
||||
| `message` | String | Commit message |
|
||||
| `files_changed` | List[String] | List of modified files |
|
||||
|
||||
### 5. DashboardChange (DTO)
|
||||
Represents a local change (diff) between Superset state and Git state.
|
||||
|
||||
| Field | Type | Description |
|
||||
|-------|------|-------------|
|
||||
| `file_path` | String | Relative path in repo |
|
||||
| `change_type` | Enum | `ADDED`, `MODIFIED`, `DELETED`, `RENAMED` |
|
||||
| `diff_content` | String | Unified diff string |
|
||||
|
||||
## Relationships
|
||||
- **GitServerConfig** (1) <-> (*) **GitRepository**
|
||||
- **GitRepository** (1) <-> (*) **Branch**
|
||||
- **Branch** (1) <-> (*) **Commit**
|
||||
- **GitRepository** (1) <-> (*) **DeploymentEnvironment** (Via deployment logs/config)
|
||||
|
||||
- **One-to-One**: `Dashboard` (Superset concept) <-> `GitServerConfig`.
|
||||
- **Many-to-Many**: `Dashboard` <-> `Environment` (Technically environments are global or scoped, but for MVP they can be global settings available to all dashboards).
|
||||
|
||||
## Validation Rules
|
||||
|
||||
- `repo_url`: Must be a valid HTTPS URL ending in `.git`.
|
||||
- `pat_token`: Must not be empty.
|
||||
- `branch.name`: Must follow git branch naming conventions (no spaces, special chars).
|
||||
Reference in New Issue
Block a user