mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-21 13:32:49 +08:00
### What problem does this PR solve? Fix: Added read-only mode support and optimized navigation logic #9869 - Added the `isReadonly` property to the parseResult component to control the enabled state of editing and interactive features - Added the `navigateToDataFile` navigation method to navigate to the data file details page - Refactored the `navigateToDataflowResult` method to use an object parameter to support more flexible query parameter configuration - Unified the `var(--accent-primary)` CSS variable format to `rgb(var(--accent-primary))` to accommodate more styling scenarios - Extracted the parser initialization logic into a separate hook (`useParserInit`) ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import { NavigateToDataflowResultProps } from '@/pages/dataflow-result/interface';
|
||||
import { Routes } from '@/routes';
|
||||
import { useCallback } from 'react';
|
||||
import { useNavigate, useParams, useSearchParams } from 'umi';
|
||||
@ -23,6 +24,13 @@ export const useNavigatePage = () => {
|
||||
[navigate],
|
||||
);
|
||||
|
||||
const navigateToDataFile = useCallback(
|
||||
(id: string) => () => {
|
||||
navigate(`${Routes.DatasetBase}${Routes.DatasetBase}/${id}`);
|
||||
},
|
||||
[navigate],
|
||||
);
|
||||
|
||||
const navigateToHome = useCallback(() => {
|
||||
navigate(Routes.Root);
|
||||
}, [navigate]);
|
||||
@ -133,10 +141,16 @@ export const useNavigatePage = () => {
|
||||
);
|
||||
|
||||
const navigateToDataflowResult = useCallback(
|
||||
(id: string, knowledgeId: string, doc_id?: string) => () => {
|
||||
(props: NavigateToDataflowResultProps) => () => {
|
||||
let params: string[] = [];
|
||||
Object.keys(props).forEach((key) => {
|
||||
if (props[key]) {
|
||||
params.push(`${key}=${props[key]}`);
|
||||
}
|
||||
});
|
||||
navigate(
|
||||
// `${Routes.ParsedResult}/${id}?${QueryStringMap.KnowledgeId}=${knowledgeId}`,
|
||||
`${Routes.DataflowResult}?id=${id}&doc_id=${doc_id}&${QueryStringMap.KnowledgeId}=${knowledgeId}&type=dataflow`,
|
||||
`${Routes.DataflowResult}?${params.join('&')}`,
|
||||
);
|
||||
},
|
||||
[navigate],
|
||||
@ -163,5 +177,6 @@ export const useNavigatePage = () => {
|
||||
navigateToOldProfile,
|
||||
navigateToDataflowResult,
|
||||
navigateToDataflow,
|
||||
navigateToDataFile,
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user