style(web): translate the comments in the src/views directory into English

This commit is contained in:
zhaoying
2026-02-03 18:38:04 +08:00
parent a191e32f71
commit 9e195ea63b
155 changed files with 4169 additions and 586 deletions

View File

@@ -1,3 +1,14 @@
/*
* @Author: ZhaoYing
* @Date: 2026-02-03 17:49:09
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-02-03 17:49:09
*/
/**
* Space Modal Component
* Two-step modal for creating workspace with basic info and model configuration
*/
import { forwardRef, useImperativeHandle, useState } from 'react';
import { Form, Input, App, Steps, Button } from 'antd';
import { useTranslation } from 'react-i18next';
@@ -15,13 +26,18 @@ import neo4jIcon from '@/assets/images/space/neo4j.png'
const FormItem = Form.Item;
/**
* Component props
*/
interface SpaceModalProps {
refresh: () => void;
}
/** Storage types */
const types: StorageType[] = [
'rag',
'neo4j',
]
/** Type icons mapping */
const typeIcons: Record<StorageType, string> = {
rag: ragIcon,
neo4j: neo4jIcon
@@ -40,7 +56,7 @@ const SpaceModal = forwardRef<SpaceModalRef, SpaceModalProps>(({
const values = Form.useWatch([], form);
// 封装取消方法,添加关闭弹窗逻辑
/** Close modal and reset form */
const handleClose = () => {
setVisible(false);
form.resetFields();
@@ -48,10 +64,12 @@ const SpaceModal = forwardRef<SpaceModalRef, SpaceModalProps>(({
setEditVo(null)
setCurrentStep(0)
};
/** Go to previous step */
const handlePrevStep = () => {
setCurrentStep(prev => prev - 1)
}
/** Open modal with optional data */
const handleOpen = (space?: Space) => {
if (space) {
setEditVo(space || null)
@@ -64,7 +82,7 @@ const SpaceModal = forwardRef<SpaceModalRef, SpaceModalProps>(({
}
setVisible(true);
};
// 封装保存方法,添加提交逻辑
/** Save or proceed to next step */
const handleSave = () => {
form
.validateFields()
@@ -92,6 +110,7 @@ const SpaceModal = forwardRef<SpaceModalRef, SpaceModalProps>(({
console.log('err', err)
});
}
/** Update workspace */
const handleUpdate = (formData: SpaceModalData) => {
setLoading(true)
createWorkspace(formData)
@@ -106,7 +125,7 @@ const SpaceModal = forwardRef<SpaceModalRef, SpaceModalProps>(({
});
}
// 暴露给父组件的方法
/** Expose methods to parent component */
useImperativeHandle(ref, () => ({
handleOpen,
handleClose

View File

@@ -1,8 +1,20 @@
/*
* @Author: ZhaoYing
* @Date: 2026-02-03 17:48:59
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-02-03 17:48:59
*/
/**
* Space Management Page
* Displays workspace list with creation and navigation capabilities
*/
import React, { useEffect, useState, useRef } from 'react';
import { useNavigate } from 'react-router-dom';
import clsx from 'clsx';
import { useTranslation } from 'react-i18next';
import { List, Button } from 'antd';
import type { Space, SpaceModalRef } from './types';
import SpaceModal from './components/SpaceModal';
import RbCard from '@/components/RbCard/Card'
@@ -17,6 +29,7 @@ const SpaceManagement: React.FC = () => {
const [data, setData] = useState<Space[]>([]);
const spaceModalRef = useRef<SpaceModalRef>(null);
/** Load workspace list */
const loadMoreData = () => {
setLoading(true);
getWorkspaces()
@@ -37,10 +50,12 @@ const SpaceManagement: React.FC = () => {
loadMoreData();
}, []);
/** Open create space modal */
const handleCreate = () => {
spaceModalRef.current?.handleOpen();
}
/** Switch to selected workspace */
const handleJump = (id: string) => {
switchWorkspace(id)
.then(() => {

View File

@@ -1,6 +1,19 @@
// 应用数据类型
/*
* @Author: ZhaoYing
* @Date: 2026-02-03 17:48:51
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-02-03 17:48:51
*/
/**
* Application data type
*/
/** Storage type */
export type StorageType = 'rag' | 'neo4j';
/**
* Space data structure
*/
export interface Space {
id: string;
name: string;
@@ -12,7 +25,9 @@ export interface Space {
storage_type: StorageType | null;
}
// 创建表单数据类型
/**
* Create form data type
*/
export interface SpaceModalData {
name: string;
type: string;
@@ -24,7 +39,9 @@ export interface SpaceModalData {
storage_type: StorageType;
}
// 定义组件暴露的方法接口
/**
* Component exposed methods interface
*/
export interface SpaceModalRef {
handleOpen: (space?: Space) => void;
}