新增多个核心功能模块(后端 Rust 命令 + 前端 Panel 全部接线完成): - 服务器注册表:servers.rs + ServerManagerPanel、ProjectServerPanel(项目关联服务器) - SSH Config 自动同步:ssh_config.rs - 服务器软件管理:server_software.rs + ServerSoftwareBlock - 宿主机应用管理:host_apps.rs + HostAppsPanel - 服务配置管理:service_config.rs + ServiceConfigBlock - 项目部署信息:deploy_info.rs + DeployInfoPanel - API密钥管理:api_keys.rs + ApiKeysPanel - 云产品管理:cloud_products.rs + CloudProductsPanel(含 Docker应用、云数据库实例子模块) - 源码库:source_library.rs + SourceLibraryPage(分类管理 + 项目详情) 导航栏新增「源码库」入口;蓝图 manifest 同步补录 7 个新模块
92 lines
3.2 KiB
Markdown
92 lines
3.2 KiB
Markdown
# 云产品管理
|
||
|
||
在看板新增「云产品」标签页,集中管理用户在阿里云、腾讯云等平台购买的云资源信息,支持完整 CRUD。
|
||
|
||
## 背景
|
||
|
||
用户购买了阿里云和腾讯云的多种云产品(ECS/CVM、RDS、OSS/COS、CDN、域名等),目前信息散落在各处,需要一个统一的管理入口,与服务器注册表、API 管理并列,形成完整的云资源管理体系。
|
||
|
||
---
|
||
|
||
## 数据模型
|
||
|
||
单表 `cloud_products`,JSON 扩展字段 `config_data` 存放类型专属属性:
|
||
|
||
```sql
|
||
cloud_products (
|
||
id TEXT PRIMARY KEY,
|
||
vendor TEXT NOT NULL DEFAULT 'aliyun', -- aliyun | tencent | custom
|
||
product_type TEXT NOT NULL DEFAULT 'ecs', -- ecs/cvm/rds/tdsql/oss/cos/cdn/domain/redis/clb/custom
|
||
name TEXT NOT NULL,
|
||
region TEXT,
|
||
instance_id TEXT,
|
||
endpoint TEXT,
|
||
expire_at TEXT, -- ISO8601,到期时间
|
||
status TEXT NOT NULL DEFAULT 'active', -- active | expired | stopped
|
||
config_data TEXT NOT NULL DEFAULT '{}',
|
||
notes TEXT,
|
||
sort_order INTEGER DEFAULT 0,
|
||
created_at TEXT DEFAULT (datetime('now')),
|
||
updated_at TEXT DEFAULT (datetime('now'))
|
||
)
|
||
```
|
||
|
||
---
|
||
|
||
## 任务卡
|
||
|
||
### ✅ DB 迁移:cloud_products 表
|
||
- status: done
|
||
- complexity: S
|
||
- files: src-tauri/src/db.rs
|
||
- acceptance: 应用启动后 cloud_products 表存在,migrate_idempotent 测试通过
|
||
|
||
---
|
||
|
||
### ✅ Rust CRUD:cloud_products.rs
|
||
- status: done
|
||
- complexity: S
|
||
- depends: cloud-products(DB 迁移完成)
|
||
- files: src-tauri/src/commands/cloud_products.rs
|
||
- acceptance: 包含 CloudProduct struct + SaveCloudProductInput + list/create/update/delete 函数 + 4 条 tauri::command,错误返回 Result<_, String>
|
||
|
||
---
|
||
|
||
### ✅ 接线:mod.rs + lib.rs + commands.ts
|
||
- status: done
|
||
- complexity: S
|
||
- depends: cloud-products(Rust CRUD 完成)
|
||
- files: src-tauri/src/commands/mod.rs, src-tauri/src/lib.rs, src/lib/commands.ts
|
||
- acceptance: Rust 编译通过,commands.ts 正确导出 CloudProduct 接口和 4 个 invoke 函数
|
||
|
||
---
|
||
|
||
### ✅ 前端 Panel:CloudProductsPanel.tsx
|
||
- status: done
|
||
- complexity: M
|
||
- depends: cloud-products(接线完成)
|
||
- files: src/components/dashboard/CloudProductsPanel.tsx
|
||
- acceptance: 按厂商(阿里云/腾讯云/自定义)分组展示卡片,支持完整增删改,到期 ≤ 7 天红色高亮,模态表单 vendor 联动 product_type 可选项
|
||
|
||
---
|
||
|
||
### ✅ Dashboard 接入:云产品标签页
|
||
- status: done
|
||
- complexity: S
|
||
- depends: cloud-products(Panel 完成)
|
||
- files: src/components/dashboard/Dashboard.tsx
|
||
- acceptance: 看板子标签栏出现「云产品」,切换后渲染 CloudProductsPanel
|
||
|
||
---
|
||
|
||
## 复盘笔记
|
||
|
||
【复盘】前端 Panel:CloudProductsPanel.tsx
|
||
任务类型: 前端组件
|
||
复杂度: M
|
||
实际轮数: 1轮(预估 1 轮)
|
||
是否返工: 否
|
||
返工原因: 无
|
||
有效策略: 参照 ApiKeysPanel 分层结构(Modal + Card + VendorSection + Panel),vendor 联动 product_type 用 Record<string, options[]> 查表,到期高亮用简单 Date diff 计算无需额外状态
|
||
遗留风险: config_data JSON 扩展字段当前 UI 不暴露,未来如需类型专属配置需新增表单字段
|