Commit Graph

203 Commits

Author SHA1 Message Date
Hungerdream dae1bfae90 feat(frontend): polish cluster usage bars, task times and sidebar default
- cluster list: rebuild CPU usage bars with progressbar semantics, NaN/out-of-range clamping and three-tier tone colors for cluster and node tables
- task center: show task creation time next to runner with full timestamp on hover and invalid-date fallbacks
- sidebar: collapse portal group by default
2026-07-30 18:14:32 +08:00
Hungerdream b39f8c313d feat(frontend): replace mock panels with live data sources
- dashboard: load container summary, machine overview, mysql service ledger, active delivery tasks and recent task logs in parallel via Promise.allSettled so one failed source does not block the page
- tenants: back panels with real container summary and mapped Wayne namespaces per business line
- subsystem detail: render real subsystem data instead of mock profile
- components.d.ts: auto-generated ElTag registration
2026-07-30 18:14:19 +08:00
Hungerdream 90434ee39b feat(frontend): unify authenticated requests with 401 session handling
- add utils/session.ts: on 401 clear auth state and redirect to SSO or /login with return path; singleton promise prevents duplicate redirects; typed AuthenticationRequiredError for callers
- add api/authRequest.ts: shared generic authRequest with token injection, response parsing and 401 hook
- migrate businessLine/containerService/delivery/machine/subsystemAuth/taskLog api modules to the shared helper, removing six duplicated implementations; keep getToken only for EventSource query-param auth
- Catalog: silence session-expiry error in instance-name precheck; prefer mysql delivery target by exact template name (matches backend DELIVERY_MYSQL_TEMPLATE_NAME default)
2026-07-30 18:14:09 +08:00
Emdream 67a10aa52d Merge pull request #130 from ztkkOip/feat/base-service-delivery
fix(delivery): 修改mysql部署上下游相关代码
2026-07-30 16:14:24 +08:00
mac 1aa984c7e5 feat(delivery): sync mysql service ledger and credentials 2026-07-30 16:09:13 +08:00
ztkkOip f41abfd609 Merge pull request #129 from Hungerdream/feat/mysql-single-root-account
feat: 调整 MySQL 交付账号 (#108, #97)
2026-07-30 15:45:50 +08:00
Hungerdream 8b1ed20145 feat(frontend): drive delivery steps by backend stage events
- Map precheck/install/configure/healthcheck/register stage events to
  workbench step states instead of guess-based progression, and prefer
  callback-enabled AWX templates so stage events actually flow
- Replay task events silently on workbench restore to rebuild step
  states without duplicating logs; only reset seen events for new tasks
- Unify instance name generation with a random 6-char suffix (replacing
  the hardcoded -billing-02) and cap the business-line segment so the
  63-char DNS label limit never truncates the suffix
2026-07-30 15:02:52 +08:00
Hungerdream 07a661f7d1 fix(delivery): accept root@% credential for CloudDM registration
PR #128 looks up the root credential with account_host = 'localhost',
which never matches under the single root@% account model. Widen the
lookup to account_host IN ('%', 'localhost'), consistent with the
compatibility strategy in deploymentCredentialVars.
2026-07-29 18:40:23 +08:00
Hungerdream b3eb10a81d fix(ansible): reload systemd daemon before restarting delivery instance
Ensure updated mysql-delivery@.service unit definitions are picked up
by running daemon-reload before the instance restart in both delivery
playbooks.
2026-07-29 18:39:37 +08:00
Hungerdream 2de6a1f498 feat(frontend): adapt delivery form to single root account and credential_available
- Remove mysql_admin_password from CreateMySQLDeliveryPayload;
  the delivery form submits a single root password only
- Wire the task's credential_available boolean into the Catalog
  workbench: sync on create/poll/restore, and hide the one-time
  credential entry once it has been claimed
- Preview mock credential account_host changed from localhost to %
2026-07-29 18:39:37 +08:00
Hungerdream ef6508938c feat(delivery): switch to a single root@% admin account model
- CreateTask now accepts only mysql_root_password; drop
  mysql_admin_password and the paired root/admin validation,
  keeping the >=16-char length and alphanumeric-only checks
- deploymentCredentialVars extracts mysql_root_password only,
  remaining compatible with legacy root@localhost records
- Both delivery playbooks drop xinfra_admin provisioning and
  the mysql_admin_password assertion, creating 'root'@'%'
  as the remote admin account instead
2026-07-29 18:39:37 +08:00
Gmarker689 ad1ec79563 Merge pull request #128 from Gmaker689/feat/clouddm-auto-register
Feat/clouddm auto register
2026-07-29 18:28:35 +08:00
Gmarker689 0aac99c359 feat: register MySQL instances in CloudDM 2026-07-29 18:24:36 +08:00
Gmarker689 33449b60b2 Merge branch '1024XEngineer:main' into main 2026-07-29 18:02:01 +08:00
Emdream 221d6a6707 Merge pull request #127 from ztkkOip/feat/base-service-delivery
fix(delivery): 完善一些部署和机器管理
2026-07-29 16:54:47 +08:00
mac 35875218c9 feat(delivery): refine base service integrations 2026-07-29 16:47:41 +08:00
Wonder 2ca08f9360 Merge pull request #126 from 2311719626/fix/logs
fix(server): 修复 task log 模块多个问题及数据竞争
2026-07-29 14:48:35 +08:00
wonder 0027704169 fix(server): 修复 TestSubscribeTask_ConcurrentSafety 数据竞争问题
- 修复多个 goroutine 并发 append 同一 slice 导致的 DATA RACE
- 使用预分配 slice + 索引赋值替代并发 append
- 通过 go test -race 验证
2026-07-29 14:47:31 +08:00
Wonder 179d80604c Merge pull request #125 from 2311719626/fix/logs
fix(server): 修复 task log 模块多个问题并添加单元测试
2026-07-29 14:38:55 +08:00
wonder 11a92c429f test(server): 添加 task log 模块单元测试
- 添加 handler 层 16 个纯函数单元测试(状态映射、ID 解析、排序、格式化等)
- 添加 service 层 11 个 pub/sub 与缓存单元测试(订阅、取消、并发安全、TTL 过期等)
- 共 27 个测试用例,覆盖 task log 核心逻辑

背景:task log 模块经历了大量修改但缺乏测试覆盖,需要确保日志模块可用

关联 commit:61eeb0c, dbb930d
2026-07-29 14:13:53 +08:00
Gmarker689 f4a0a75ca1 Merge pull request #124 from Gmaker689/ci/github-actions
Ci/GitHub actions
2026-07-29 14:08:08 +08:00
wonder dbb930d0cb fix(frontend): 优化 task log 前端交互体验
- 简化虚拟滚动实现,移除 @tanstack/vue-virtual 依赖
- 添加分页组件,支持翻页查看历史任务
- 添加 SSE 指数退避重试机制(最多 3 次)
- 更新 API 接口支持分页参数
- 添加重试状态指示器

背景:前端存在虚拟滚动与 SSE 不兼容、缺少分页、连接断开无重试等问题

关联 commit:fix/logs 分支
2026-07-29 14:01:12 +08:00
wonder 61eeb0c8ac fix(server): 修复 task log 接口多个问题
- 修复 Wayne 任务状态映射,将数字状态统一为字符串状态
- 添加分页支持,支持 page/page_size 参数
- 添加 AWXJobStdout 内存缓存,减少重复 API 调用
- 修复 SubscribeTask 内存泄漏,自动清理 closed channel
- 统一 Stream 端点,AWX 使用 pub/sub,Wayne 使用轮询

背景:task log 接口存在多个潜在问题,包括状态判断错误导致无限轮询、
缺少分页、重复 API 调用性能问题、内存泄漏风险等

关联 commit:fix/logs 分支
2026-07-29 14:00:40 +08:00
Gmarker689 1f71efd8e0 Merge branch '1024XEngineer:main' into main 2026-07-29 13:56:58 +08:00
ztkkOip 699d4b6526 Merge pull request #123 from Hungerdream/feat/mysql-delivery-hardening
feat: MySQL 交付实例名唯一性与凭证领取加固 (#108, #97)
2026-07-29 13:55:09 +08:00
Gmarker689 82b0ad90ed Merge pull request #2 from Gmaker689/ci/github-actions
Ci/GitHub actions
2026-07-29 13:51:17 +08:00
Hungerdream 5715379a26 refactor(ui): embed delivery records into the service ledger
Replace the separate delivery records tab with a per-service dropdown column in the ledger table that opens the existing detail dialog with one-time credential claim. Sync now refreshes ledger, container services and delivery records together; errors surface via message toast. components.d.ts regenerated (dropdown components in, tabs out).
2026-07-29 13:50:29 +08:00
Hungerdream 244f6adfb8 feat(ui): harden MySQL delivery workbench session and credential flow
- Persist workbench state (form, view, task progress) per user/service in sessionStorage; restore on reload re-fetches the task and resumes polling, never persisting the root password itself
- Gate the result tab behind resultReady so an unfinished task cannot show a stale result view
- Add random instance name generation and an async precheck that detects name conflicts against active tasks and delivered instances, mirroring the backend occupancy rules
- Guarantee all four character classes in generated root passwords
- Fetch credentials via the one-time reveal endpoint instead of caching plaintext passwords in localStorage; sanitize legacy history entries and clear the form password once the task is created
2026-07-29 13:50:18 +08:00
Hungerdream ecad474785 feat(delivery): enforce instance name uniqueness at task creation
Wrap task creation in a transaction that locks the business line row (SELECT ... FOR UPDATE) so concurrent requests cannot both pass the availability check. A name is considered occupied by in-flight or retained tasks (pending through registering, finished, register_failed, canceling, rollback_pending/rolling_back/rollback_failed) and by active deployment results; it becomes reusable only after rollback or explicit cleanup releases it.
2026-07-29 13:50:03 +08:00
Gmarker689 68325aca42 ci: run checks only after main updates 2026-07-29 13:45:32 +08:00
Gmarker689 5e25d92d77 ci: add GitHub Actions test workflow 2026-07-29 11:53:27 +08:00
qudder eaba4d237a Merge pull request #122 from Hungerdream/feat/mysql-delivery-form-enhancements
feat: MySQL 交付工作台重构与交付记录管理 (#108)
2026-07-29 09:24:41 +08:00
Hungerdream 08e9466bad feat(ui): add delivery records tab to service management
Management.vue gains a second tab listing MySQL delivery tasks from the backend (search, status filter, detail dialog, one-time credential reveal with copy/download). components.d.ts regenerated for the new Element Plus components.

Also add narrow-viewport (<=760px) style tweaks to AppHeader/AppMain/DefaultLayout; these are partial small-screen optimizations, not a full mobile adaptation.
2026-07-28 19:15:29 +08:00
Hungerdream f01398cc67 feat(ui): rework MySQL delivery workbench form and flow
Rebuild the MySQL standardized delivery form in Catalog.vue: sectioned layout (scope/resources/db config/advanced params), client-generated root password with regenerate/copy, storage slider, install/data path hints, inline field validation, delivery history and task polling.

Align CreateMySQLDeliveryPayload with the backend MySQLDeliveryInput contract (cpu_milli/memory_mi/storage_gi required, legacy fields optional, drop nonexistent param_template) and send mysql_root_password/mysql_admin_password as a pair so the credential shown to the user is the one actually deployed.
2026-07-28 19:15:14 +08:00
Hungerdream c139ed6d2f fix(ui): remove duplicate function implementations in TaskCenter
scrollToBottom and handleScroll were defined twice (verbatim), causing TS2393 duplicate implementation errors now surfaced by vue-tsc 2.x.
2026-07-28 19:14:59 +08:00
Hungerdream e30f547891 fix(ansible): harden mysql data_disk path validation
Reject bare '/', path traversal ('..') and duplicated slashes ('//') in mysql_data_disk assertions to avoid deploying into unsafe directories.
2026-07-28 19:14:50 +08:00
ztkkOip 6ce8ab74d5 Merge pull request #118 from ztkkOip/feat/base-service-delivery
Fix(base delivery)新增一些基础服务部署的功能
2026-07-28 18:03:23 +08:00
ztkkOip f28bc99401 Merge branch 'main' into feat/base-service-delivery 2026-07-28 18:03:04 +08:00
mac 93981b9aad feat: update delivery and resource frontends 2026-07-28 17:56:58 +08:00
mac f7be87c7d9 feat: wire delivery result and infra data backends 2026-07-28 17:56:00 +08:00
Wonder 408aa3af0d Merge pull request #120 from 2311719626/feat/task-logs-virtual-scroll
feat(task-logs): 优化任务中心日志前端展示 & fix(auth): 移除安全漏洞
2026-07-28 17:47:36 +08:00
Wonder c0ec5758c6 Merge branch 'main' into feat/task-logs-virtual-scroll 2026-07-28 17:47:26 +08:00
Wonder 552c1a18ac Merge pull request #119 from 2311719626/feat/task-logs-sse
feat(task-logs): 实现任务日志 SSE 实时推送
2026-07-28 17:45:16 +08:00
wonder 2fb9c3ccfd fix(auth): remove access_token query parameter from AuthMiddleware
移除认证中间件中 access_token 查询参数的回退逻辑,防止令牌通过 URL 暴露

- 仅支持 Authorization: Bearer 请求头认证
- 防止令牌被反向代理日志、浏览器历史、监控系统等捕获
- 前端已使用安全的头部认证方式
2026-07-28 17:30:46 +08:00
wonder 221d7dcc95 feat(task-logs): 优化任务中心日志前端展示
- 引入 @tanstack/vue-virtual 实现虚拟滚动,仅渲染可见区域日志行
- 添加自动滚动开关,用户可手动控制是否自动滚动
- 实现用户滚动检测,向上滚动时暂停自动滚动,滚到底部时恢复
- 优化日志面板头部布局,添加自动滚动开关 UI
2026-07-28 17:23:03 +08:00
wonder 053fd7027c feat(task-logs): 优化任务中心日志前端展示
- 引入 @tanstack/vue-virtual 实现虚拟滚动,仅渲染可见区域日志行
- 添加自动滚动开关,用户可手动控制是否自动滚动
- 实现用户滚动检测,向上滚动时暂停自动滚动,滚到底部时恢复
- 优化日志面板头部布局,添加自动滚动开关 UI

关联 PR: #119
2026-07-28 17:18:51 +08:00
wonder 8904330632 feat(task-logs): 实现任务日志 SSE 实时推送
实现任务日志 SSE 实时推送功能,解决前端无法流式输出日志的问题

变更内容:
- 后端:新增 /task-logs/stream SSE 端点,支持实时日志推送
- 后端:实现 2 秒轮询间隔检测新日志,支持心跳机制
- 后端:支持通过 query 参数 access_token 传递 JWT 认证
- 前端:新增 createTaskLogStream 函数封装 EventSource
- 前端:修改 TaskCenter.vue 集成 SSE,支持实时更新和自动滚动
- 前端:添加流式连接状态指示器

关联 commit:
- 实现后端 SSE Stream 方法
- 注册 SSE 路由
- 实现前端 SSE 客户端
- 集成 SSE 到任务中心页面
2026-07-28 17:06:44 +08:00
mac 897670b721 Merge remote-tracking branch 'upstream/main' into feat/base-service-delivery
# Conflicts:
#	ansible/mysql-deploy.yml
#	frontend/src/api/delivery.ts
#	frontend/src/views/service/Catalog.vue
#	server/.env.example
#	server/internal/config/config.go
#	server/internal/handler/task_log.go
#	server/internal/service/delivery.go
2026-07-28 15:08:37 +08:00
mac 8e09c30d21 feat: wire mysql delivery to awx callbacks 2026-07-28 14:45:17 +08:00
ztkkOip 7d6efeb3dd Merge pull request #117 from Hungerdream/feat/mysql-delivery-rollback
feat: MySQL 交付失败自动回滚 (#97)
2026-07-28 14:39:54 +08:00