fix(ui): 审计修复 — 路径规范化/SkillInfo类型/分页offset/初始加载/显示统一
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
- workspace.rs: canonicalize() 解析 '..' 和符号链接 - Workspace.tsx: 组件挂载时调用 loadDirStats + 统一 KB 显示 - configStore: SkillInfo 接口补充 category 字段 + 空数组回退注释 - securityStore: localStorage 审计日志添加 offset 分页支持
This commit is contained in:
@@ -81,6 +81,7 @@ export interface SkillInfo {
|
||||
capabilities?: string[];
|
||||
tags?: string[];
|
||||
mode?: string;
|
||||
category?: string;
|
||||
triggers?: Array<{ type: string; pattern?: string }>;
|
||||
actions?: Array<{ type: string; params?: Record<string, unknown> }>;
|
||||
enabled?: boolean;
|
||||
@@ -455,6 +456,8 @@ export const useConfigStore = create<ConfigStateSlice & ConfigActionsSlice>((set
|
||||
if (client) {
|
||||
try {
|
||||
const result = await client.listSkills();
|
||||
// Empty array from client may indicate connected-but-load-failure;
|
||||
// fall through to direct Tauri invoke as recovery path
|
||||
if (result?.skills && result.skills.length > 0) {
|
||||
set({ skillsCatalog: result.skills });
|
||||
if (result.extraDirs) {
|
||||
|
||||
@@ -309,10 +309,11 @@ export const useSecurityStore = create<SecurityStore>((set, get) => ({
|
||||
}));
|
||||
}
|
||||
|
||||
// Sort by timestamp descending and apply limit
|
||||
// Sort by timestamp descending and apply pagination
|
||||
allLogs.sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime());
|
||||
const limited = opts?.limit ? allLogs.slice(0, opts.limit) : allLogs;
|
||||
set({ auditLogs: limited, auditLogsLoading: false });
|
||||
const offset = opts?.offset ?? 0;
|
||||
const paginated = opts?.limit ? allLogs.slice(offset, offset + opts.limit) : allLogs.slice(offset);
|
||||
set({ auditLogs: paginated, auditLogsLoading: false });
|
||||
} catch {
|
||||
set({ auditLogsLoading: false });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user