chore: replace all cn comments of fe to en version by volc api (#320)
This commit is contained in:
@@ -52,7 +52,7 @@ interface CreateTableModalExtraParams {
|
||||
creatorId?: string;
|
||||
}
|
||||
|
||||
// RenderGenerate属性类型定义
|
||||
// RenderGenerate property type definition
|
||||
export interface RenderGenerateProps {
|
||||
tableStructureRef: RefObject<DatabaseTableStructureRef>;
|
||||
onGenerateChange: (tableMemoryList: TableMemoryItem[]) => void;
|
||||
@@ -181,7 +181,7 @@ export function DatabaseCreateTableModal({
|
||||
setSaveBtnDisabled(true);
|
||||
return;
|
||||
}
|
||||
// 系统字段不计入字段数量限制
|
||||
// System fields do not count towards the number of fields limit
|
||||
if (list.filter(i => !i.isSystemField).length > MAX_COLUMNS) {
|
||||
setSaveBtnDisabled(true);
|
||||
return;
|
||||
@@ -204,8 +204,8 @@ export function DatabaseCreateTableModal({
|
||||
|
||||
const onSave: OnSave = async ({ response }) => {
|
||||
/**
|
||||
* 在 DatabaseTableStructure 这个组件中,提交已经区分了 edit 和 create 两种状态,
|
||||
* 并且存在一个onSave的回调,因此提交之后的逻辑全部收敛在这里
|
||||
* In DatabaseTableStructure component, commit already distinguishes between edit and create states,
|
||||
* And there is an onSave callback, so the logic after commit all converges here
|
||||
*/
|
||||
await onSubmit?.(response);
|
||||
};
|
||||
@@ -262,7 +262,7 @@ export function DatabaseCreateTableModal({
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
{/* 编辑弹窗出现 Banner 提示 */}
|
||||
{/* Banner prompt appears in the edit pop-up window */}
|
||||
{isModify ? (
|
||||
<DismissibleBanner
|
||||
type="warning"
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
VerifyType,
|
||||
} from '../../../types/database-field';
|
||||
|
||||
// 校验 Table Name 和 Field Name
|
||||
// Validation Table Name and Field Name
|
||||
const namingRegexMapper = [
|
||||
{
|
||||
type: 1,
|
||||
@@ -53,7 +53,7 @@ export const validateNaming = (str: string, errList: string[] = []) => {
|
||||
return list;
|
||||
};
|
||||
|
||||
// 校验 Table Fields
|
||||
// Validation Table Fields
|
||||
export const thMapper: MapperItem[] = [
|
||||
{
|
||||
label: I18n.t('db_add_table_field_name'),
|
||||
@@ -124,7 +124,7 @@ export const validateFields = (
|
||||
const msg = verifyItem.message;
|
||||
switch (verifyItem.type) {
|
||||
case VerifyType.Required: {
|
||||
// 报错出现时机:点击保存按钮时,出现提示。表中某一行填写了数据,但是未填写必填字段时,需要报错
|
||||
// When the error occurs: When clicking the Save button, a prompt appears. When a row in the table fills in the data, but the required fields are not filled in, an error needs to be reported.
|
||||
if (
|
||||
trigger === 'save' &&
|
||||
!value &&
|
||||
@@ -135,14 +135,14 @@ export const validateFields = (
|
||||
) {
|
||||
listItem.errorMapper[thKey].push(msg);
|
||||
}
|
||||
// 报错消失时机:必填输入框输入了内容后,报错立刻消失
|
||||
// Error reporting and disappearance timing: Required text box After entering the content, the error will disappear immediately
|
||||
if (trigger === 'change' && value) {
|
||||
listItem.errorMapper[thKey] = errTarget.filter(i => i !== msg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case VerifyType.Unique: {
|
||||
// 报错出现时机:点击保存按钮时,出现提示。
|
||||
// When the error occurs: When you click the Save button, a prompt appears.
|
||||
if (
|
||||
trigger === 'save' &&
|
||||
value &&
|
||||
@@ -150,7 +150,7 @@ export const validateFields = (
|
||||
) {
|
||||
listItem.errorMapper[thKey].push(msg);
|
||||
}
|
||||
// 报错消失时机:必填输入框输入了内容后,报错立刻消失
|
||||
// Error reporting and disappearance timing: Required text box After entering the content, the error will disappear immediately
|
||||
if (
|
||||
trigger === 'change' &&
|
||||
value &&
|
||||
@@ -161,7 +161,7 @@ export const validateFields = (
|
||||
break;
|
||||
}
|
||||
case VerifyType.Naming: {
|
||||
// 报错出现时机:命名格式有问题,失去焦点时,立刻校验格式
|
||||
// Error timing: There is a problem with the naming format. When you lose focus, check the format immediately
|
||||
if (
|
||||
trigger === 'save' ||
|
||||
trigger === 'blur' ||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
/* eslint-disable max-lines */
|
||||
import {
|
||||
useRef,
|
||||
@@ -89,19 +89,19 @@ export interface DatabaseTableStructureProps {
|
||||
loadingTips?: string;
|
||||
projectID?: string;
|
||||
/**
|
||||
* excel: 单用户模式|只读模式
|
||||
* normal: 单用户模式|只读模式
|
||||
* expert: 单用户模式|只读模式|多用户模式
|
||||
* undefined: 不支持读写模式
|
||||
* Excel: single user mode | read-only mode
|
||||
* Normal: Single user mode | Read-only mode
|
||||
* Expert: Single user mode | Read-only mode | Multi-user mode
|
||||
* Undefined: Read and write modes are not supported
|
||||
*/
|
||||
readAndWriteModeOptions?: ReadAndWriteModeOptions;
|
||||
/** databaseInfo中只显示 Mode 的UI */
|
||||
/** Only display Mode UI in DatabaseInfo */
|
||||
onlyShowDatabaseInfoRWMode?: boolean;
|
||||
enableAdd?: boolean;
|
||||
isReadonlyMode?: boolean;
|
||||
maxColumnNum?: number;
|
||||
/**
|
||||
* 是否展示基本信息(表名、介绍)
|
||||
* Whether to display basic information (table name, introduction)
|
||||
*/
|
||||
showDatabaseBaseInfo?: boolean;
|
||||
hiddenTableBorder?: boolean;
|
||||
@@ -138,7 +138,7 @@ export interface DatabaseTableStructureRef {
|
||||
export const DatabaseTableStructure = forwardRef<
|
||||
DatabaseTableStructureRef,
|
||||
DatabaseTableStructureProps
|
||||
// eslint-disable-next-line max-lines-per-function, @coze-arch/max-line-per-function, complexity -- 历史文件拷贝
|
||||
// eslint-disable-next-line max-lines-per-function, @coze-arch/max-line-per-function, complexity -- historical file copy
|
||||
>((props, ref) => {
|
||||
const {
|
||||
data: initialData,
|
||||
@@ -156,7 +156,7 @@ export const DatabaseTableStructure = forwardRef<
|
||||
enableAdd = true,
|
||||
loading = false,
|
||||
setContentCheckErrorMsg = noop,
|
||||
// TODO 把 AI generate 的 loading tip 放到 table 里面
|
||||
// TODO put AI generated loading tips into the table
|
||||
// loadingTips,
|
||||
createType,
|
||||
showDatabaseBaseInfo,
|
||||
@@ -177,7 +177,7 @@ export const DatabaseTableStructure = forwardRef<
|
||||
|
||||
const [isReadonly, { setTrue: enableReadonly, setFalse: disableReadonly }] =
|
||||
useBoolean(false);
|
||||
// 系统字段不计入字段数量限制
|
||||
// System fields do not count towards the number of fields limit
|
||||
const userFields = tableFieldsList.filter(i => !i.isSystemField);
|
||||
const isRowMaxLimit = userFields.length >= maxColumnNum;
|
||||
const isExceedRowMaxLimit = userFields.length > maxColumnNum;
|
||||
@@ -233,11 +233,11 @@ export const DatabaseTableStructure = forwardRef<
|
||||
};
|
||||
|
||||
const verifyAllBeforeSave = async (): Promise<boolean> => {
|
||||
// 触发 tableFields 校验
|
||||
// Trigger tableFields validation
|
||||
const validatedTableFieldsList = validateFields(tableFieldsList, 'save');
|
||||
setTableFieldsList(validatedTableFieldsList);
|
||||
|
||||
// 触发并校验 tableBasicInfo
|
||||
// Trigger and validate tableBasicInfo
|
||||
if (showDatabaseBaseInfo) {
|
||||
try {
|
||||
// @ts-expect-error -- linter-disable-autofix
|
||||
@@ -247,7 +247,7 @@ export const DatabaseTableStructure = forwardRef<
|
||||
}
|
||||
}
|
||||
|
||||
// 校验 tableFields
|
||||
// Validation tableFields
|
||||
if (
|
||||
validatedTableFieldsList.find(i =>
|
||||
Object.keys(i.errorMapper || {}).find(
|
||||
@@ -258,7 +258,7 @@ export const DatabaseTableStructure = forwardRef<
|
||||
return false;
|
||||
}
|
||||
|
||||
// 校验 tableFields 是否为空
|
||||
// Verify that tableFields is empty
|
||||
if (isEmptyList) {
|
||||
return false;
|
||||
}
|
||||
@@ -382,7 +382,7 @@ export const DatabaseTableStructure = forwardRef<
|
||||
return '';
|
||||
};
|
||||
|
||||
// 初始化 ref 属性
|
||||
// Initialize ref attribute
|
||||
useImperativeHandle<DatabaseTableStructureRef, DatabaseTableStructureRef>(
|
||||
ref,
|
||||
() => ({
|
||||
@@ -402,7 +402,7 @@ export const DatabaseTableStructure = forwardRef<
|
||||
[isReadonly, tableFieldsList, tableBasicInfoFormRef],
|
||||
);
|
||||
|
||||
// 校验是否 disable 下一步按钮
|
||||
// Verify that the Next button is disabled
|
||||
useComputingEnableGoToNextStep?.(tableFieldsList, isEmptyList);
|
||||
|
||||
const dataSource = enableAdd
|
||||
@@ -759,7 +759,7 @@ export const DatabaseTableStructure = forwardRef<
|
||||
}}
|
||||
wrapperClassName={s['table-structure-table-wrapper']}
|
||||
/>
|
||||
{/* 表格为空时,底部的错误提示 */}
|
||||
{/* Error message at the bottom when the table is empty */}
|
||||
{isEmptyList && !loading ? (
|
||||
<div className={s['table-empty-tips']}>
|
||||
{I18n.t('db_table_save_exception_nofield')}
|
||||
|
||||
@@ -54,7 +54,7 @@ export type SLInputProps = ComponentProps<typeof Input> & {
|
||||
ellipsisPopoverProps?: PopoverProps;
|
||||
onFocusPopoverProps?: PopoverProps;
|
||||
tooltipProps?: TooltipProps;
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention -- 历史逻辑
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention -- historical logic
|
||||
inputProps?: InputProps & { 'data-dtestid'?: string; 'data-testid'?: string };
|
||||
errorMsg?: string;
|
||||
errorMsgFloat?: boolean;
|
||||
@@ -205,7 +205,7 @@ export const SLInput: React.FC<SLInputProps> = props => {
|
||||
);
|
||||
};
|
||||
|
||||
// Semi 不导出被 withField 包装的组件的 props 类型(甚至是 any ´_>`)
|
||||
// Semi does not export the props type (or even any ´_>`) of the component wrapped with the withField.
|
||||
// https://github.com/DouyinFE/semi-design/blob/v2.69.2/packages/semi-ui/form/hoc/withField.tsx#L528
|
||||
export const FormSLInput: React.FunctionComponent<
|
||||
CommonFieldProps & Omit<SLInputProps, keyof CommonexcludeType>
|
||||
|
||||
@@ -103,7 +103,7 @@ export const DATABASE_CONTENT_CHECK_ERROR_CODE = 708024072;
|
||||
export const DATABASE_CONTENT_CHECK_ERROR_CODE_NEW = 708334072;
|
||||
|
||||
/**
|
||||
* 内置字段: uuid
|
||||
* Built-in field: uuid
|
||||
* bstudio_connector_uid
|
||||
*/
|
||||
export const USER_ID_FIELD: TableMemoryItem = {
|
||||
@@ -116,7 +116,7 @@ export const USER_ID_FIELD: TableMemoryItem = {
|
||||
};
|
||||
|
||||
/**
|
||||
* 内置字段: id
|
||||
* Built-in field: id
|
||||
*/
|
||||
export const ID_FIELD: TableMemoryItem = {
|
||||
name: 'id',
|
||||
@@ -128,7 +128,7 @@ export const ID_FIELD: TableMemoryItem = {
|
||||
};
|
||||
|
||||
/**
|
||||
* 内置字段: sys_platform
|
||||
* Built-in fields: sys_platform
|
||||
* bstudio_connector_id
|
||||
*/
|
||||
export const PLATFORM_FIELD: TableMemoryItem = {
|
||||
@@ -141,7 +141,7 @@ export const PLATFORM_FIELD: TableMemoryItem = {
|
||||
};
|
||||
|
||||
/**
|
||||
* 内置字段: connector_id
|
||||
* Built-in fields: connector_id
|
||||
* bstudio_create_time
|
||||
*/
|
||||
export const CREATE_TIME_FIELD: TableMemoryItem = {
|
||||
@@ -154,7 +154,7 @@ export const CREATE_TIME_FIELD: TableMemoryItem = {
|
||||
};
|
||||
|
||||
/**
|
||||
* 内置系统字段
|
||||
* Built-in system fields
|
||||
*/
|
||||
export const SYSTEM_FIELDS = [
|
||||
ID_FIELD,
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
import { type DatabaseInfo } from '@coze-studio/bot-detail-store';
|
||||
import {
|
||||
type AlterBotTableResponse,
|
||||
@@ -24,17 +24,17 @@ export type OnSave = (params: {
|
||||
response: InsertBotTableResponse | AlterBotTableResponse;
|
||||
}) => Promise<void>;
|
||||
|
||||
/* eslint-disable @typescript-eslint/naming-convention -- 历史文件拷贝 */
|
||||
/* eslint-disable @typescript-eslint/naming-convention -- history file copy */
|
||||
export enum CreateType {
|
||||
custom = 'custom',
|
||||
template = 'template',
|
||||
excel = 'excel',
|
||||
// 推荐建表
|
||||
// recommended table
|
||||
recommend = 'recommend',
|
||||
// 输入自然语言建表
|
||||
// Enter natural language to build a table
|
||||
naturalLanguage = 'naturalLanguage',
|
||||
}
|
||||
/* eslint-enable @typescript-eslint/naming-convention -- 历史文件拷贝 */
|
||||
/* eslint-enable @typescript-eslint/naming-convention -- history file copy */
|
||||
|
||||
export interface MapperItem {
|
||||
label: string;
|
||||
@@ -43,7 +43,7 @@ export interface MapperItem {
|
||||
type: VerifyType;
|
||||
message: string;
|
||||
}[];
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- 历史文件拷贝
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- historical file copy
|
||||
defaultValue: any;
|
||||
require: boolean;
|
||||
}
|
||||
|
||||
@@ -15,13 +15,13 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* 数据库详情页 tab
|
||||
* Database details page tab
|
||||
*/
|
||||
export enum DatabaseTabs {
|
||||
/** 表结构 */
|
||||
/** table structure */
|
||||
Structure = 'structure',
|
||||
/** 测试数据 */
|
||||
/** test data */
|
||||
Draft = 'draft',
|
||||
/** 线上数据 */
|
||||
/** online data */
|
||||
Online = 'online',
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user