diff --git a/craco.config.js b/craco.config.js index d2b5a867..934c0ba7 100644 --- a/craco.config.js +++ b/craco.config.js @@ -101,7 +101,7 @@ module.exports = { const res = {}; for (let i = 0; i < 10; i++) { res[`/v${i}`] = { - target: 'http://192.168.22.81:10000', + target: 'http://10.186.62.87:10000/', secure: false, changeOrigin: true, ws: true, diff --git a/src/api/SqlManage/index.enum.ts b/src/api/SqlManage/index.enum.ts index ef06a0c3..2b5879af 100644 --- a/src/api/SqlManage/index.enum.ts +++ b/src/api/SqlManage/index.enum.ts @@ -21,5 +21,7 @@ export enum GetSqlManageListFilterStatusEnum { 'solved' = 'solved', - 'ignored' = 'ignored' + 'ignored' = 'ignored', + + 'manual_audited' = 'manual_audited' } diff --git a/src/api/common.enum.ts b/src/api/common.enum.ts index d82f67f8..4330833a 100644 --- a/src/api/common.enum.ts +++ b/src/api/common.enum.ts @@ -85,7 +85,9 @@ export enum AuditTaskResV1StatusEnum { export enum BatchUpdateSqlManageReqStatusEnum { 'solved' = 'solved', - 'ignored' = 'ignored' + 'ignored' = 'ignored', + + 'manual_audited' = 'manual_audited' } export enum CreateAuditWhitelistReqV1MatchTypeEnum { @@ -207,7 +209,9 @@ export enum SqlManageStatusEnum { 'solved' = 'solved', - 'ignored' = 'ignored' + 'ignored' = 'ignored', + + 'manual_audited' = 'manual_audited' } export enum TestFeishuConfigurationReqV1AccountTypeEnum { diff --git a/src/locale/zh-CN/common.ts b/src/locale/zh-CN/common.ts index 1ad821bb..189fe4a6 100644 --- a/src/locale/zh-CN/common.ts +++ b/src/locale/zh-CN/common.ts @@ -109,6 +109,7 @@ export default { onlyLetterAndNumber: '只能包含字母、数字、中划线和下划线', onlyNumber: '只能包含数字', portRange: '端口号范围为{{min}}-{{max}}', + allowedCharacters: '只能包含字母、数字、中文、中划线和下划线', }, }, diff --git a/src/locale/zh-CN/sqlManagement.ts b/src/locale/zh-CN/sqlManagement.ts index 8a333211..ef98d418 100644 --- a/src/locale/zh-CN/sqlManagement.ts +++ b/src/locale/zh-CN/sqlManagement.ts @@ -23,6 +23,7 @@ export default { unhandled: '未处理', solved: '已解决', ignored: '已忽略', + manualAudited: '已人工审核', }, filterForm: { @@ -30,7 +31,7 @@ export default { fuzzySearchPlaceholder: '请输入SQL指纹或负责人名称', instanceName: '数据源', source: '来源', - highAuditLevel: '最高审核等级', + auditLevel: '最低审核等级', status: '状态', relatedToMe: '与我相关', time: '时间范围', @@ -69,6 +70,7 @@ export default { label: '变更当前SQL状态', solve: '解决', ignore: '忽略', + manualAudit: '人工审核', }, }, }; diff --git a/src/page/SQLManagement/SQLPanel/FilterForm.tsx b/src/page/SQLManagement/SQLPanel/FilterForm.tsx index 7f056bee..cdf44597 100644 --- a/src/page/SQLManagement/SQLPanel/FilterForm.tsx +++ b/src/page/SQLManagement/SQLPanel/FilterForm.tsx @@ -24,6 +24,7 @@ import { useEffect } from 'react'; import moment from 'moment'; import useStaticStatus from './hooks/useStaticStatus'; import { getInstanceTipListV1FunctionalModuleEnum } from '../../../api/instance/index.enum'; +import { GetSqlManageListFilterStatusEnum } from '../../../api/SqlManage/index.enum'; const FilterForm: React.FC = ({ form, @@ -42,11 +43,15 @@ const FilterForm: React.FC = ({ return current && current > moment().endOf('day'); }; useEffect(() => { + form.setFieldValue( + 'filter_status', + GetSqlManageListFilterStatusEnum.unhandled + ); updateInstanceList({ project_name: projectName, functional_module: getInstanceTipListV1FunctionalModuleEnum.sql_manage, }); - }, [projectName, updateInstanceList]); + }, [form, projectName, updateInstanceList]); return ( form={form} onFinish={submit}> @@ -91,12 +96,12 @@ const FilterForm: React.FC = ({ = ({ tags, @@ -109,7 +109,10 @@ const CustomTags: React.FC = ({ layout="inline" style={{ padding: '4px 0 8px 12px' }} > - + { }; }; +export const tagNameRuleValidator = (): FormValidatorRule => { + return (_, value) => { + const reg = /^[\u4e00-\u9fa5_a-zA-Z0-9_-]*$/; + if (!reg.test(value)) { + return Promise.reject(t('common.form.rule.allowedCharacters')); + } + return Promise.resolve(); + }; +}; + export const whiteSpaceSql = (): Rule[] => { return [ { diff --git a/src/utils/test/FormRule.test.ts b/src/utils/test/FormRule.test.ts index 324d4fae..a70cd80d 100644 --- a/src/utils/test/FormRule.test.ts +++ b/src/utils/test/FormRule.test.ts @@ -1,6 +1,7 @@ import { nameRuleValidator, phoneRuleValidator, + tagNameRuleValidator, validatorPort, } from '../FormRule'; @@ -119,4 +120,65 @@ describe('utils/FormRule', () => { } expect(message).toBe(''); }); + + test('should check tag name', async () => { + const check = tagNameRuleValidator(); + let message = ''; + + try { + await check({} as any, '1123456789', () => {}); + } catch (error: any) { + message = error; + } + expect(message).toBe(''); + + try { + await check({} as any, '范德萨', () => {}); + } catch (error: any) { + message = error; + } + expect(message).toBe(''); + + try { + await check({} as any, 'test', () => {}); + } catch (error: any) { + message = error; + } + expect(message).toBe(''); + + try { + await check({} as any, '_', () => {}); + } catch (error: any) { + message = error; + } + expect(message).toBe(''); + + try { + await check({} as any, '-', () => {}); + } catch (error: any) { + message = error; + } + expect(message).toBe(''); + + try { + await check({} as any, '1ha哈_-', () => {}); + } catch (error: any) { + message = error; + } + expect(message).toBe(''); + + try { + await check({} as any, '哈1ha-_-', () => {}); + } catch (error: any) { + message = error; + } + expect(message).toBe(''); + + try { + await check({} as any, '1ha哈_-#', () => {}); + } catch (error: any) { + message = error; + } + expect(message).toBe('common.form.rule.allowedCharacters'); + }); });