refactor(frontend): api/components/pages 目录架构统一对齐菜单域 + 日志中心修复

1. 目录架构统一(API = components = 菜单域,一域一目录 + barrel)
   - log/ 提为独立顶层域(日志中心在菜单中与监控中心平级,不再塞在 monitor/)
   - task/ 拆分原 automation.ts → cron-job / script / remote-exec
   - aiops/ 合并 ai.ts + agentCli.ts → assistant + agent-cli
   - agent/ approval/ audit/ 提升为域目录
   - auth 拆分:authApi(认证自服务) + system/user.ts(userApi+ldapApi 管理端)
   - components/automation → components/task,菜单"自动化运维"→"作业任务"
   - pages/ 按域分子目录(approval/audit/monitor),删孤儿 AuditPage.tsx
   - 所有 API 符号名不变,组件经 @/api 聚合引用,运行时行为零变化

2. Loki 查询无返回修复:aiops 容器 DNS 解析外网域名失败
   (宿主机 systemd-resolved 转发链路异常),docker-compose 显式配 dns 上游

3. ES 查询框布局:工具栏单行挤 7 控件(ES 多 150px 索引框),拆两行——
   查询输入独占一行(+查询按钮),次级控件换行 flex-wrap

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
attackerandClaude committed 2026-06-28 06:06:48 +00:00
1 parent da01cbb119
commit c0ee8e4ddd
74 files changed
+229 -216

No files matched your search

@@ -14,7 +14,7 @@ import {
} from 'lucide-react';
import { useToast } from '@/hooks/use-toast';
import { useConfirm } from '@/components/ui/confirm-dialog';
import { userApi } from '@/api';
import { authApi } from '@/api';
import { getPublicApiBase } from '@/utils/request';
import { getSessionApiAccessKey, setSessionApiAccessKey } from '@/utils/storage';
import { cn } from '@/lib/utils';
@@ -93,7 +93,7 @@ export function ApiAccessKeySection() {
try {
const cached = getSessionApiAccessKey();
if (cached) setPlainToken(cached);
const meta = await userApi.getApiAccessKey().catch(() => ({ has_token: false }));
const meta = await authApi.getApiAccessKey().catch(() => ({ has_token: false }));
setKeyMeta(meta);
} finally {
setLoading(false);
@@ -130,7 +130,7 @@ export function ApiAccessKeySection() {
if (formMode === 'edit') {
setActionLoading(true);
try {
const res = await userApi.updateApiAccessKey({
const res = await authApi.updateApiAccessKey({
description: formDescription,
expires_at: formExpiresAt,
});
@@ -156,7 +156,7 @@ export function ApiAccessKeySection() {
setActionLoading(true);
try {
const res = await userApi.regenerateApiAccessKey({
const res = await authApi.regenerateApiAccessKey({
description: formDescription,
expires_at: formExpiresAt,
});
@@ -195,7 +195,7 @@ export function ApiAccessKeySection() {
if (!ok) return;
setActionLoading(true);
try {
await userApi.revokeApiAccessKey();
await authApi.revokeApiAccessKey();
setPlainToken('');
setSessionApiAccessKey('');
setKeyMeta({ has_token: false });
+3 -3
View File
@@ -7,7 +7,7 @@ import { Label } from '@/components/ui/label';
import { Badge } from '@/components/ui/badge';
import { User, Shield, Loader2 } from 'lucide-react';
import { useToast } from '@/hooks/use-toast';
import { userApi } from '@/api';
import { authApi } from '@/api';
import { useUserStore } from '@/store';
import { ApiAccessKeySection } from './ApiAccessKeySection';
@@ -25,7 +25,7 @@ export default function ProfilePage() {
const load = useCallback(async () => {
setLoading(true);
try {
const p = await userApi.getProfile();
const p = await authApi.getProfile();
setProfile(p);
} finally {
setLoading(false);
@@ -41,7 +41,7 @@ export default function ProfilePage() {
if (!oldPwd || newPwd.length < 6) return;
setPwdSaving(true);
try {
await userApi.changePassword({ old_password: oldPwd, new_password: newPwd });
await authApi.changePassword({ old_password: oldPwd, new_password: newPwd });
toast({ title: '密码已修改' });
setOldPwd('');
setNewPwd('');