feat: Dashboard数据关联修复 + 通知模板优化 + 工单创建页布局
1. Dashboard: stats新增queryStats查询统计, trend API真实工单趋势数据 2. Layout铃铛: 显示真实待审批工单数量 3. 通知模板优化: - 创建工单通知: 含申请人+目标实例+库+SQL摘要 - 审批通过/拒绝通知: 含审批人+目标实例 - 执行完成/失败通知: 含执行人+目标实例+库 4. 飞书卡片颜色: 创建=turquoise, 审批=blue, 成功=green, 失败=red 5. 钉钉消息: 添加状态emoji标签(🆕✅❌⚠️) 6. TicketCreatePage: 底部操作栏(SQL检测+提交审批) 7. ticket_executor: 移除aiomysql不支持的read_timeout/write_timeout Tests: 1057 passed, 17 pre-existing failures (notification 35/35 passed)
This commit is contained in:
1 parent
7109031f71
commit
880dbfefa4
9 files changed
+423
-209
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { Outlet, useLocation, useNavigate } from 'react-router-dom';
|
||||
import {
|
||||
LayoutDashboard, Database, Server, Zap, Leaf,
|
||||
@@ -20,6 +21,13 @@ export default function Layout() {
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
const currentPath = location.pathname.split('/')[1] || 'dashboard';
|
||||
const [pendingCount, setPendingCount] = useState(0);
|
||||
|
||||
useEffect(() => {
|
||||
import('@/api/request').then(m => m.default.get('/dashboard/stats'))
|
||||
.then((data: any) => setPendingCount(data?.ticket_pending ?? 0))
|
||||
.catch(() => {});
|
||||
}, [location.pathname]);
|
||||
|
||||
const getPageTitle = () => {
|
||||
const item = visibleMenuItems.find(m => m.id === currentPath);
|
||||
@@ -95,9 +103,14 @@ export default function Layout() {
|
||||
>
|
||||
{theme === 'dark' ? <Sun className="w-4 h-4" /> : <Moon className="w-4 h-4" />}
|
||||
</button>
|
||||
<button className="w-8 h-8 rounded-lg flex items-center justify-center text-[var(--dg-text-muted)] hover:bg-[var(--dg-bg-hover)] transition-colors relative">
|
||||
<button onClick={() => navigate('/tickets')}
|
||||
className="w-8 h-8 rounded-lg flex items-center justify-center text-[var(--dg-text-muted)] hover:bg-[var(--dg-bg-hover)] transition-colors relative">
|
||||
<Bell className="w-4 h-4" />
|
||||
<span className="absolute top-1 right-1 w-1.5 h-1.5 bg-red-500 rounded-full" />
|
||||
{pendingCount > 0 && (
|
||||
<span className="absolute -top-0.5 -right-0.5 min-w-[16px] h-4 px-1 bg-red-500 rounded-full text-[10px] text-white font-bold flex items-center justify-center">
|
||||
{pendingCount > 99 ? '99+' : pendingCount}
|
||||
</span>
|
||||
)}
|
||||
</button>
|
||||
<div className="w-px h-5 bg-[var(--dg-border)] mx-1" />
|
||||
<div className="flex items-center gap-2 pl-1">
|
||||
|
||||
Reference in new issue
Block a user