mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? feat: translate graph list #918 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
58 lines
1.6 KiB
TypeScript
58 lines
1.6 KiB
TypeScript
import { PlusOutlined } from '@ant-design/icons';
|
|
import { Button, Empty, Flex, Spin } from 'antd';
|
|
import CreateFlowModal from './create-flow-modal';
|
|
import FlowCard from './flow-card';
|
|
import { useFetchDataOnMount, useSaveFlow } from './hooks';
|
|
|
|
import { useTranslate } from '@/hooks/commonHooks';
|
|
import styles from './index.less';
|
|
|
|
const FlowList = () => {
|
|
const {
|
|
showFlowSettingModal,
|
|
hideFlowSettingModal,
|
|
flowSettingVisible,
|
|
flowSettingLoading,
|
|
onFlowOk,
|
|
} = useSaveFlow();
|
|
const { t } = useTranslate('flow');
|
|
|
|
const { list, loading } = useFetchDataOnMount();
|
|
|
|
return (
|
|
<Flex className={styles.flowListWrapper} vertical flex={1} gap={'large'}>
|
|
<Flex justify={'end'}>
|
|
<Button
|
|
type="primary"
|
|
icon={<PlusOutlined />}
|
|
onClick={showFlowSettingModal}
|
|
>
|
|
{t('create')}
|
|
</Button>
|
|
</Flex>
|
|
<Spin spinning={loading}>
|
|
<Flex gap={'large'} wrap="wrap" className={styles.flowCardContainer}>
|
|
{list.length > 0 ? (
|
|
list.map((item) => {
|
|
return <FlowCard item={item} key={item.id}></FlowCard>;
|
|
})
|
|
) : (
|
|
<Empty className={styles.knowledgeEmpty}></Empty>
|
|
)}
|
|
</Flex>
|
|
</Spin>
|
|
{flowSettingVisible && (
|
|
<CreateFlowModal
|
|
visible={flowSettingVisible}
|
|
onOk={onFlowOk}
|
|
loading={flowSettingLoading}
|
|
hideModal={hideFlowSettingModal}
|
|
initialName=""
|
|
></CreateFlowModal>
|
|
)}
|
|
</Flex>
|
|
);
|
|
};
|
|
|
|
export default FlowList;
|