feat(knowledge): add parse type enum and refactor configuration components
refactor(configuration): replace buildMode with parseType in all config components
This commit is contained in:
@@ -1,15 +1,17 @@
|
||||
import React from 'react';
|
||||
import { Box, Grid, Paper, Typography, IconButton, TextField, Tabs, Tab } from '@mui/material';
|
||||
import { Box, Grid, Paper, Typography, IconButton, TextField, Tabs, Tab, Fab } from '@mui/material';
|
||||
import { DataGrid, type GridColDef } from '@mui/x-data-grid';
|
||||
import FilterListIcon from '@mui/icons-material/FilterList';
|
||||
import SearchIcon from '@mui/icons-material/Search';
|
||||
import {
|
||||
ArrowBack as ArrowBackIcon,
|
||||
Search as SearchIcon,
|
||||
} from '@mui/icons-material';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { useKnowledgeOverview } from '@/hooks/knowledge-hooks';
|
||||
import type { IDocumentLog, IFileLogItem } from '@/interfaces/database/knowledge';
|
||||
import { useNavigate, useParams } from 'react-router-dom';
|
||||
import { useKnowledgeOverview, useKnowledgeDetail } from '@/hooks/knowledge-hooks';
|
||||
import logger from '@/utils/logger';
|
||||
import i18n, { LanguageAbbreviation } from '@/locales';
|
||||
import { enUS, zhCN } from '@mui/x-data-grid/locales';
|
||||
import KnowledgeBreadcrumbs from './components/KnowledgeBreadcrumbs';
|
||||
|
||||
|
||||
const PROCESSING_TYPES = {
|
||||
@@ -34,7 +36,6 @@ function KnowledgeLogsPage() {
|
||||
return currentLanguage === LanguageAbbreviation.Zh ? zhCN : enUS;
|
||||
};
|
||||
|
||||
|
||||
// 路由参数与数据Hook
|
||||
const { id: kbId = '' } = useParams();
|
||||
const {
|
||||
@@ -52,6 +53,9 @@ function KnowledgeLogsPage() {
|
||||
setKeywords,
|
||||
} = useKnowledgeOverview(kbId);
|
||||
|
||||
// 获取知识库详情以用于面包屑显示名称
|
||||
const { knowledge } = useKnowledgeDetail(kbId);
|
||||
|
||||
// 同步分页模型到Hook
|
||||
React.useEffect(() => {
|
||||
setPaginationModel({ page: Math.max(currentPage - 1, 0), pageSize });
|
||||
@@ -94,8 +98,29 @@ function KnowledgeLogsPage() {
|
||||
(datasetLogs?.total || 0)),
|
||||
[activeTab, fileLogs, datasetLogs]);
|
||||
|
||||
const navigate = useNavigate();
|
||||
const handleNavigateBack = () => {
|
||||
navigate(`/knowledge/${kbId}`);
|
||||
};
|
||||
|
||||
return (
|
||||
<Box sx={{ p: 3 }}>
|
||||
{/* 面包屑导航 */}
|
||||
<KnowledgeBreadcrumbs
|
||||
kbItems={[
|
||||
{
|
||||
label: t('knowledgeSettings.knowledgeBase'),
|
||||
path: '/knowledge'
|
||||
},
|
||||
{
|
||||
label: knowledge?.name || t('knowledgeSettings.knowledgeBaseDetail'),
|
||||
path: `/knowledge/${kbId}`
|
||||
},
|
||||
{
|
||||
label: t('knowledgeSettings.fileLogs')
|
||||
}
|
||||
]}
|
||||
/>
|
||||
{/* 顶部统计卡片占位 */}
|
||||
<Grid container spacing={2} sx={{ mb: 2 }}>
|
||||
<Grid size={{ xs: 12, md: 4 }}>
|
||||
@@ -124,8 +149,8 @@ function KnowledgeLogsPage() {
|
||||
{/* Tabs & Filter/Search */}
|
||||
<Box display="flex" alignItems="center" gap={2} sx={{ mb: 2 }}>
|
||||
<Tabs value={activeTab} onChange={(_, v) => setActiveTab(v)}>
|
||||
<Tab value="file" label={t('knowledgeDetails.file')} />
|
||||
<Tab value="dataset" label={t('knowledgeDetails.dataset')} />
|
||||
<Tab value="fileLogs" label={t('knowledgeDetails.file')} />
|
||||
<Tab value="datasetLogs" label={t('knowledgeDetails.dataset')} />
|
||||
</Tabs>
|
||||
{/* <IconButton aria-label="filter"><FilterListIcon /></IconButton> */}
|
||||
<Box display="flex" alignItems="center" gap={1} sx={{ ml: 'auto' }}>
|
||||
@@ -155,6 +180,20 @@ function KnowledgeLogsPage() {
|
||||
localeText={getDataGridLocale().components.MuiDataGrid.defaultProps.localeText}
|
||||
/>
|
||||
</Paper>
|
||||
|
||||
{/* 返回按钮 */}
|
||||
<Fab
|
||||
color="primary"
|
||||
aria-label={t('knowledgeSettings.backToKnowledgeDetail')}
|
||||
onClick={handleNavigateBack}
|
||||
sx={{
|
||||
position: 'fixed',
|
||||
bottom: 128,
|
||||
right: 64,
|
||||
}}
|
||||
>
|
||||
<ArrowBackIcon />
|
||||
</Fab>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user