Работает создание коммитов и перенос в новый enviroment

This commit is contained in:
2026-01-23 13:57:44 +03:00
parent e9d3f3c827
commit 07ec2d9797
37 changed files with 3227 additions and 252 deletions

View File

@@ -43,29 +43,23 @@ specs/[###-feature]/
```
### Source Code (repository root)
<!--
ACTION REQUIRED: Replace the placeholder tree below with the concrete layout
for this feature. Delete unused options and expand the chosen structure with
real paths (e.g., apps/admin, packages/something). The delivered plan must
not include Option labels.
-->
```text
backend/
├── src/
│ ├── api/routes/git.py # Git integration endpoints
│ ├── models/git.py # Git-specific Pydantic/SQLAlchemy models
│ ├── plugins/git_plugin.py # PluginBase implementation
│ └── services/git_service.py # Core Git logic (GitPython wrapper)
│ ├── api/routes/git.py # Git integration endpoints
│ ├── models/git.py # Git-specific Pydantic/SQLAlchemy models (GitServerConfig, DashboardChange)
│ ├── plugins/git_plugin.py # PluginBase implementation (1 repo = 1 dashboard logic)
│ └── services/git_service.py # Core Git logic (GitPython wrapper)
└── tests/
└── plugins/test_git.py
frontend/
├── src/
│ ├── components/git/ # Git UI components (BranchSelector, CommitModal, ConflictResolver)
│ ├── routes/settings/git/ # Git configuration pages
│ └── services/gitService.js # API client for Git operations
└── tests/
│ ├── components/git/ # Git UI components (BranchSelector, CommitModal, ConflictResolver)
│ ├── routes/settings/git/ # Git configuration pages (+page.svelte)
│ └── services/gitService.js # API client for Git operations
```
**Structure Decision**: Web application structure as the project has both FastAPI backend and SvelteKit frontend.
@@ -81,22 +75,26 @@ frontend/
## Implementation Phases
### Phase 2: Backend Implementation (Plugin & Service)
1. **Git Service**: Implement `GitService` using `GitPython`. Focus on:
* Repo initialization and cloning.
1. **Data Models**: Implement `GitServerConfig`, `Branch`, `Commit`, `Environment`, and `DashboardChange` in `src/models/git.py`.
2. **Git Service**: Implement `GitService` using `GitPython`. Focus on:
* Repo initialization and cloning (1 repo per dashboard strategy).
* Branch management (list, create, checkout).
* Stage, commit, push, pull.
2. **Git Plugin**: Implement `GitPlugin(PluginBase)`.
* Integrate with `superset_tool` for exporting/importing dashboards.
* History retrieval and diff generation.
3. **Git Plugin**: Implement `GitPlugin(PluginBase)`.
* Integrate with `superset_tool` for exporting dashboards as unpacked YAML files (metadata, charts, datasets).
* Handle unpacking ZIP exports into the repo structure.
3. **API Routes**: Implement `/api/git/*` endpoints.
4. **API Routes**: Implement `/api/git/*` endpoints for config, sync, and history.
### Phase 3: Frontend Implementation
1. **Configuration UI**: Settings page for `GitServerConfig`.
1. **Configuration UI**: Settings page for `GitServerConfig` (Provider selection, PAT validation).
2. **Dashboard Integration**: Add Git controls to the Dashboard view.
* Branch selector.
* Commit/Push/Pull buttons.
3. **Conflict Resolution UI**: Implementation of "Keep Mine/Theirs" file picker.
* Branch selector (Create/Switch).
* Commit/Push/Pull buttons with status indicators.
* History viewer with search/filter.
3. **Conflict Resolution UI**: Implementation of "Keep Mine/Theirs" file picker for YAML content.
### Phase 4: Deployment Integration
1. **Environment Management**: CRUD for `DeploymentEnvironment`.
2. **Deployment Logic**: Trigger Superset Import API on target servers.
1. **Environment Management**: CRUD for `Environment` (Target Superset instances).
2. **Deployment Logic**: Implement deployment via Superset Import API (POST /api/v1/dashboard/import/).
* Handle zip packing from Git repo state before import.