diff --git a/packages/base/src/page/DataExportManagement/Common/BasicInfoWrapper/__snapshots__/index.test.tsx.snap b/packages/base/src/page/DataExportManagement/Common/BasicInfoWrapper/__snapshots__/index.test.tsx.snap index a942c1ecf..50d68f148 100644 --- a/packages/base/src/page/DataExportManagement/Common/BasicInfoWrapper/__snapshots__/index.test.tsx.snap +++ b/packages/base/src/page/DataExportManagement/Common/BasicInfoWrapper/__snapshots__/index.test.tsx.snap @@ -3,7 +3,7 @@ exports[`test base/DataExport/Common/BasicInfoWrapper should match snapshot 1`] = `
diff --git a/packages/base/src/page/DataExportManagement/Create/__tests__/__snapshots__/index.test.tsx.snap b/packages/base/src/page/DataExportManagement/Create/__tests__/__snapshots__/index.test.tsx.snap index 60ffe5c15..8b59b749f 100644 --- a/packages/base/src/page/DataExportManagement/Create/__tests__/__snapshots__/index.test.tsx.snap +++ b/packages/base/src/page/DataExportManagement/Create/__tests__/__snapshots__/index.test.tsx.snap @@ -129,7 +129,7 @@ exports[`first should match snapshot when pageState is equal CREATE_TASK 1`] = `
= ({ slot }) => { {slot} diff --git a/packages/base/src/page/DataExportManagement/Create/components/CreateTask/BaseInfoForm/__tests__/__snapshots__/BaseInfoFormItem.test.tsx.snap b/packages/base/src/page/DataExportManagement/Create/components/CreateTask/BaseInfoForm/__tests__/__snapshots__/BaseInfoFormItem.test.tsx.snap index da9b8db79..1bade907a 100644 --- a/packages/base/src/page/DataExportManagement/Create/components/CreateTask/BaseInfoForm/__tests__/__snapshots__/BaseInfoFormItem.test.tsx.snap +++ b/packages/base/src/page/DataExportManagement/Create/components/CreateTask/BaseInfoForm/__tests__/__snapshots__/BaseInfoFormItem.test.tsx.snap @@ -46,7 +46,7 @@ exports[`test base/DataExport/Create/BaseInfoForm/BaseInfoFormItem should match slot
= ({ animation={animation} className={classnames('lazy-load-wrapper', className, { 'lazy-load-wrapper-hidden': status === 'hidden', - 'lazy-load-wrapper-show': status === 'show' + 'lazy-load-wrapper-show': status === 'show', + 'lazy-load-wrapper-animation': animation !== false })} > {children} diff --git a/packages/shared/lib/components/LazyLoadComponent/index.type.ts b/packages/shared/lib/components/LazyLoadComponent/index.type.ts index 7552ed71d..9ed74c80c 100644 --- a/packages/shared/lib/components/LazyLoadComponent/index.type.ts +++ b/packages/shared/lib/components/LazyLoadComponent/index.type.ts @@ -2,7 +2,7 @@ import { ReactNode } from 'react'; export type LazyLoadComponentProps = { open?: boolean; - animation?: string; + animation?: string | false; forceRender?: boolean; destroyOnClose?: boolean; diff --git a/packages/shared/lib/components/LazyLoadComponent/style.ts b/packages/shared/lib/components/LazyLoadComponent/style.ts index 7b0979ac0..1a2cad75a 100644 --- a/packages/shared/lib/components/LazyLoadComponent/style.ts +++ b/packages/shared/lib/components/LazyLoadComponent/style.ts @@ -1,7 +1,7 @@ import { styled } from '@mui/material'; export const LazyLoadComponentStyleWrapper = styled('div')<{ - animation?: string; + animation?: string | false; }>` @keyframes slide-right { from { @@ -14,7 +14,9 @@ export const LazyLoadComponentStyleWrapper = styled('div')<{ } } - animation: ${({ animation }) => animation ?? ' slide-right 300ms'}; + &.lazy-load-wrapper-animation { + animation: ${({ animation }) => animation || ' slide-right 300ms'}; + } &.lazy-load-wrapper-hidden { display: none; diff --git a/packages/shared/lib/utils/FormRule.ts b/packages/shared/lib/utils/FormRule.ts index 84bf00360..208eeac04 100644 --- a/packages/shared/lib/utils/FormRule.ts +++ b/packages/shared/lib/utils/FormRule.ts @@ -78,18 +78,20 @@ export const roleNameRuleValidator = (): FormValidatorRule => { }; }; -export const whiteSpaceSql = (): Rule[] => { +export const whiteSpaceSql = (enableRule = true): Rule[] => { return [ { - validator: whiteSpaceSqlValidator() + validator: whiteSpaceSqlValidator(enableRule) } ]; }; -export const whiteSpaceSqlValidator = (): FormValidatorRule => { +export const whiteSpaceSqlValidator = ( + enableRule = true +): FormValidatorRule => { return (_, values) => { const placeholder = '/* input your sql */'; - if (values === placeholder) { + if (values === placeholder && enableRule) { return Promise.reject( i18n.t('common.form.placeholder.input', { name: i18n.t('common.sqlStatements') diff --git a/packages/shared/lib/utils/__tests__/FormRule.test.ts b/packages/shared/lib/utils/__tests__/FormRule.test.ts index 5422f244f..63cff590e 100644 --- a/packages/shared/lib/utils/__tests__/FormRule.test.ts +++ b/packages/shared/lib/utils/__tests__/FormRule.test.ts @@ -75,6 +75,17 @@ describe('utils/FormRule', () => { expect(message).toBe('请输入SQL语句'); }); + it('should not check white space sql when enableRule is false', async () => { + const check = whiteSpaceSqlValidator(false); + let message = ''; + try { + await check?.({} as any, '/* input your sql */', () => {}); + } catch (error: any) { + message = error; + } + expect(message).toBe(''); + }); + it('should check prot is between min and max', async () => { const cases = [ { diff --git a/packages/sqle/src/page/SqlExecWorkflow/Common/BackToList/__snapshots__/index.test.tsx.snap b/packages/sqle/src/page/SqlExecWorkflow/Common/BackToList/__snapshots__/index.test.tsx.snap new file mode 100644 index 000000000..a2388d350 --- /dev/null +++ b/packages/sqle/src/page/SqlExecWorkflow/Common/BackToList/__snapshots__/index.test.tsx.snap @@ -0,0 +1,241 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`test BackToList render snapshot when isAuditing is falsy 1`] = ` +{ + "asFragment": [Function], + "baseElement": + + , + "container": , + "debug": [Function], + "findAllByAltText": [Function], + "findAllByDisplayValue": [Function], + "findAllByLabelText": [Function], + "findAllByPlaceholderText": [Function], + "findAllByRole": [Function], + "findAllByTestId": [Function], + "findAllByText": [Function], + "findAllByTitle": [Function], + "findByAltText": [Function], + "findByDisplayValue": [Function], + "findByLabelText": [Function], + "findByPlaceholderText": [Function], + "findByRole": [Function], + "findByTestId": [Function], + "findByText": [Function], + "findByTitle": [Function], + "getAllByAltText": [Function], + "getAllByDisplayValue": [Function], + "getAllByLabelText": [Function], + "getAllByPlaceholderText": [Function], + "getAllByRole": [Function], + "getAllByTestId": [Function], + "getAllByText": [Function], + "getAllByTitle": [Function], + "getByAltText": [Function], + "getByDisplayValue": [Function], + "getByLabelText": [Function], + "getByPlaceholderText": [Function], + "getByRole": [Function], + "getByTestId": [Function], + "getByText": [Function], + "getByTitle": [Function], + "queryAllByAltText": [Function], + "queryAllByDisplayValue": [Function], + "queryAllByLabelText": [Function], + "queryAllByPlaceholderText": [Function], + "queryAllByRole": [Function], + "queryAllByTestId": [Function], + "queryAllByText": [Function], + "queryAllByTitle": [Function], + "queryByAltText": [Function], + "queryByDisplayValue": [Function], + "queryByLabelText": [Function], + "queryByPlaceholderText": [Function], + "queryByRole": [Function], + "queryByTestId": [Function], + "queryByText": [Function], + "queryByTitle": [Function], + "rerender": [Function], + "unmount": [Function], +} +`; + +exports[`test BackToList render snapshot when isAuditing is truthy 1`] = ` +{ + "asFragment": [Function], + "baseElement": + + , + "container": , + "debug": [Function], + "findAllByAltText": [Function], + "findAllByDisplayValue": [Function], + "findAllByLabelText": [Function], + "findAllByPlaceholderText": [Function], + "findAllByRole": [Function], + "findAllByTestId": [Function], + "findAllByText": [Function], + "findAllByTitle": [Function], + "findByAltText": [Function], + "findByDisplayValue": [Function], + "findByLabelText": [Function], + "findByPlaceholderText": [Function], + "findByRole": [Function], + "findByTestId": [Function], + "findByText": [Function], + "findByTitle": [Function], + "getAllByAltText": [Function], + "getAllByDisplayValue": [Function], + "getAllByLabelText": [Function], + "getAllByPlaceholderText": [Function], + "getAllByRole": [Function], + "getAllByTestId": [Function], + "getAllByText": [Function], + "getAllByTitle": [Function], + "getByAltText": [Function], + "getByDisplayValue": [Function], + "getByLabelText": [Function], + "getByPlaceholderText": [Function], + "getByRole": [Function], + "getByTestId": [Function], + "getByText": [Function], + "getByTitle": [Function], + "queryAllByAltText": [Function], + "queryAllByDisplayValue": [Function], + "queryAllByLabelText": [Function], + "queryAllByPlaceholderText": [Function], + "queryAllByRole": [Function], + "queryAllByTestId": [Function], + "queryAllByText": [Function], + "queryAllByTitle": [Function], + "queryByAltText": [Function], + "queryByDisplayValue": [Function], + "queryByLabelText": [Function], + "queryByPlaceholderText": [Function], + "queryByRole": [Function], + "queryByTestId": [Function], + "queryByText": [Function], + "queryByTitle": [Function], + "rerender": [Function], + "unmount": [Function], +} +`; diff --git a/packages/sqle/src/page/SqlExecWorkflow/Common/BackToList/index.test.tsx b/packages/sqle/src/page/SqlExecWorkflow/Common/BackToList/index.test.tsx new file mode 100644 index 000000000..297e883dd --- /dev/null +++ b/packages/sqle/src/page/SqlExecWorkflow/Common/BackToList/index.test.tsx @@ -0,0 +1,21 @@ +import { mockUseCurrentProject } from '@actiontech/shared/lib/testUtil/mockHook/mockUseCurrentProject'; +import BackToList from '.'; +import { superRender } from '../../../../testUtils/customRender'; + +describe('test BackToList', () => { + beforeEach(() => { + mockUseCurrentProject(); + }); + + afterEach(() => { + jest.clearAllMocks(); + }); + + it('render snapshot when isAuditing is truthy', () => { + expect(superRender()).toMatchSnapshot(); + }); + + it('render snapshot when isAuditing is falsy', () => { + expect(superRender()).toMatchSnapshot(); + }); +}); diff --git a/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/__tests__/SqlExecModeSelector.test.tsx b/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/__tests__/SqlExecModeSelector.test.tsx new file mode 100644 index 000000000..6bbabb13f --- /dev/null +++ b/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/__tests__/SqlExecModeSelector.test.tsx @@ -0,0 +1,73 @@ +import { Form } from 'antd'; +import { superRender } from '../../../../../../testUtils/customRender'; +import task from '../../../../../../testUtils/mockApi/task'; +import SqlExecModeSelector from '../components/SqlExecModeSelector'; +import { act, fireEvent, renderHook, screen } from '@testing-library/react'; +import { AuditTaskResV1SqlSourceEnum } from '@actiontech/shared/lib/api/sqle/service/common.enum'; +import { SqlExecModeSelectorProps } from '../components/index.type'; + +describe('test SqlExecModeSelector', () => { + let getSqlFileOrderMethodSpy: jest.SpyInstance; + beforeEach(() => { + getSqlFileOrderMethodSpy = task.getSqlFileOrderMethod(); + jest.useFakeTimers(); + }); + afterEach(() => { + jest.useRealTimers(); + jest.clearAllMocks(); + jest.clearAllTimers(); + }); + + const customRender = (params?: Partial) => { + const { result } = renderHook(() => Form.useForm()); + return superRender( +
+ + + ); + }; + + it('should not render the execute mode selector when file mode execute SQL is not supported', () => { + customRender({ + currentSqlUploadType: AuditTaskResV1SqlSourceEnum.zip_file + }); + expect(screen.queryByText('选择上线模式')).not.toBeInTheDocument(); + }); + + it('should not render the execute mode selector when the upload type is form data', () => { + customRender({ + isSupportFileModeExecuteSql: true, + currentSqlUploadType: AuditTaskResV1SqlSourceEnum.form_data + }); + expect(screen.queryByText('选择上线模式')).not.toBeInTheDocument(); + }); + + it('should render the execute mode selector for SQL file upload with supported file mode execute SQL', () => { + customRender({ + isSupportFileModeExecuteSql: true, + currentSqlUploadType: AuditTaskResV1SqlSourceEnum.sql_file + }); + expect(screen.queryByText('选择上线模式')).toBeInTheDocument(); + + expect(getSqlFileOrderMethodSpy).not.toHaveBeenCalled(); + }); + + it('should trigger SQL file order method fetch on file mode click for zip upload type', async () => { + customRender({ + isSupportFileModeExecuteSql: true, + currentSqlUploadType: AuditTaskResV1SqlSourceEnum.zip_file + }); + expect(screen.queryByText('选择上线模式')).toBeInTheDocument(); + + fireEvent.click(screen.getByText('文件模式')); + + expect(getSqlFileOrderMethodSpy).toHaveBeenCalledTimes(1); + + await act(async () => jest.advanceTimersByTime(3000)); + }); +}); diff --git a/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/__tests__/SqlFormatterAndSubmitter.test.tsx b/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/__tests__/SqlFormatterAndSubmitter.test.tsx new file mode 100644 index 000000000..64fbe050a --- /dev/null +++ b/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/__tests__/SqlFormatterAndSubmitter.test.tsx @@ -0,0 +1,164 @@ +import { act, fireEvent, renderHook, screen } from '@testing-library/react'; +import { Form, Input } from 'antd'; +import SqlFormatterAndSubmitter from '../components/SqlFormatterAndSubmitter'; +import { SqlFormatterAndSubmitterProps } from '../components/index.type'; +import instance from '../../../../../../testUtils/mockApi/instance'; +import { AuditTaskResV1SqlSourceEnum } from '@actiontech/shared/lib/api/sqle/service/common.enum'; +import { superRender } from '../../../../../../testUtils/customRender'; +import { mockUseCurrentProject } from '@actiontech/shared/lib/testUtil/mockHook/mockUseCurrentProject'; +import { mockProjectInfo } from '@actiontech/shared/lib/testUtil/mockHook/data'; +import { formatterSQL } from '@actiontech/shared/lib/utils/FormatterSQL'; +import { SqlFiledInitialValue } from '../../../../../../data/common'; + +describe('test SqlFormatterAndSubmitter', () => { + let getInstanceSpy: jest.SpyInstance; + const auditActionSpy = jest.fn(); + beforeEach(() => { + getInstanceSpy = instance.getInstance(); + jest.useFakeTimers(); + mockUseCurrentProject(); + }); + afterEach(() => { + jest.useRealTimers(); + jest.clearAllMocks(); + jest.clearAllTimers(); + }); + + const customRender = (params: Partial) => { + const { result } = renderHook(() => Form.useForm()); + + return superRender( +
+ + + + + + ); + }; + + it('renders SqlFormatterAndSubmitter component', () => { + customRender({ + fieldPrefixPath: '1', + currentSqlUploadType: AuditTaskResV1SqlSourceEnum.zip_file + }); + expect(screen.getByText('审 核')).toBeInTheDocument(); + expect(screen.queryByText('SQL美化')).not.toBeInTheDocument(); + }); + + it('renders format button when currentSqlUploadType is form_data', () => { + customRender({ + fieldPrefixPath: '1', + currentSqlUploadType: AuditTaskResV1SqlSourceEnum.form_data + }); + expect(screen.getByText('SQL美化')).toBeInTheDocument(); + }); + + it('calls form.validateFields on submit button click', async () => { + customRender({ + fieldPrefixPath: '1' + }); + + fireEvent.click(screen.getByText('审 核')); + await act(async () => jest.advanceTimersByTime(0)); + expect(auditActionSpy).toHaveBeenCalledTimes(1); + }); + + it('formats SQL when format button is clicked and isSameSqlForAll equal true and instanceName is defined', async () => { + customRender({ isSameSqlForAll: true }); + + fireEvent.change(screen.getByLabelText('sql语句'), { + target: { value: 'select 1' } + }); + const formatButton = screen.getByText('SQL美化'); + fireEvent.click(formatButton); + + expect(getInstanceSpy).toHaveBeenCalledTimes(1); + expect(getInstanceSpy).toHaveBeenCalledWith({ + project_name: mockProjectInfo.projectName, + instance_name: 'mysql-1' + }); + + await act(async () => jest.advanceTimersByTime(3000)); + expect(screen.getByLabelText('sql语句')).toHaveValue( + formatterSQL('select 1', 'MySQL') + ); + }); + + it('formats SQL when format button is clicked and isSameSqlForAll equal true and instanceName is undefined', async () => { + customRender({ isSameSqlForAll: true, databaseInfo: [] }); + + fireEvent.change(screen.getByLabelText('sql语句'), { + target: { value: 'select 1' } + }); + const formatButton = screen.getByText('SQL美化'); + fireEvent.click(formatButton); + + expect(getInstanceSpy).toHaveBeenCalledTimes(0); + + expect(screen.getByLabelText('sql语句')).toHaveValue( + formatterSQL('select 1') + ); + }); + + it('formats SQL when format button is clicked and isSameSqlForAll equal false and instanceName is defined', async () => { + customRender({ + isSameSqlForAll: false, + fieldPrefixPath: '2', + databaseInfo: [ + { key: '1', instanceName: 'mysql-1', schemaName: 'test' }, + { key: '2', instanceName: 'mysql-2', schemaName: 'test' } + ] + }); + + fireEvent.change(screen.getByLabelText('sql语句'), { + target: { value: 'select 1' } + }); + const formatButton = screen.getByText('SQL美化'); + fireEvent.click(formatButton); + + expect(getInstanceSpy).toHaveBeenCalledTimes(1); + expect(getInstanceSpy).toHaveBeenCalledWith({ + project_name: mockProjectInfo.projectName, + instance_name: 'mysql-2' + }); + + await act(async () => jest.advanceTimersByTime(3000)); + expect(screen.getByLabelText('sql语句')).toHaveValue( + formatterSQL('select 1', 'MySQL') + ); + }); + + it('formats SQL when format button is clicked and form_data value is SqlFiledInitialValue', async () => { + customRender({ + isSameSqlForAll: false, + fieldPrefixPath: '2', + databaseInfo: [ + { key: '1', instanceName: 'mysql-1', schemaName: 'test' }, + { key: '2', instanceName: 'mysql-2', schemaName: 'test' } + ] + }); + + fireEvent.change(screen.getByLabelText('sql语句'), { + target: { value: SqlFiledInitialValue } + }); + const formatButton = screen.getByText('SQL美化'); + fireEvent.click(formatButton); + + expect(getInstanceSpy).toHaveBeenCalledTimes(0); + expect(screen.getByLabelText('sql语句')).toHaveValue(SqlFiledInitialValue); + }); +}); diff --git a/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/__tests__/SqlUploadContent.test.tsx b/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/__tests__/SqlUploadContent.test.tsx new file mode 100644 index 000000000..76ac9f69b --- /dev/null +++ b/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/__tests__/SqlUploadContent.test.tsx @@ -0,0 +1,40 @@ +import { renderHook } from '@testing-library/react'; +import { Form } from 'antd'; +import SqlUploadContent from '../components/SqlUploadContent'; +import { SqlUploadContentProps } from '../components/index.type'; +import { AuditTaskResV1SqlSourceEnum } from '@actiontech/shared/lib/api/sqle/service/common.enum'; + +describe('test SqlUploadContent', () => { + const customRender = (params: SqlUploadContentProps) => { + const { result } = renderHook(() => Form.useForm()); + + return ( +
+ + + ); + }; + + it('renders SQL upload content based on the current upload type', () => { + expect( + customRender({ + currentSqlUploadType: AuditTaskResV1SqlSourceEnum.form_data, + fieldPrefixPath: '1' + }) + ).toMatchSnapshot(); + + expect( + customRender({ + currentSqlUploadType: AuditTaskResV1SqlSourceEnum.zip_file, + fieldPrefixPath: '1' + }) + ).toMatchSnapshot(); + + expect( + customRender({ + currentSqlUploadType: AuditTaskResV1SqlSourceEnum.audit_plan, + fieldPrefixPath: '1' + }) + ).toMatchSnapshot(); + }); +}); diff --git a/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/__tests__/__snapshots__/SqlUploadContent.test.tsx.snap b/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/__tests__/__snapshots__/SqlUploadContent.test.tsx.snap new file mode 100644 index 000000000..e80c40396 --- /dev/null +++ b/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/__tests__/__snapshots__/SqlUploadContent.test.tsx.snap @@ -0,0 +1,109 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`test SqlUploadContent renders SQL upload content based on the current upload type 1`] = ` +
+ + +`; + +exports[`test SqlUploadContent renders SQL upload content based on the current upload type 2`] = ` +
+ + +`; + +exports[`test SqlUploadContent renders SQL upload content based on the current upload type 3`] = ` +
+ + +`; diff --git a/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/__tests__/__snapshots__/index.ce.test.tsx.snap b/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/__tests__/__snapshots__/index.ce.test.tsx.snap new file mode 100644 index 000000000..0931da6ae --- /dev/null +++ b/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/__tests__/__snapshots__/index.ce.test.tsx.snap @@ -0,0 +1,456 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`test SqlStatementFormItem renders SqlStatementFormItem component 1`] = ` +
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + 输入SQL语句 + + +
+
+
+
+ + + + + + + + + 上传SQL文件 + + +
+
+
+
+ + + + + + + + + 上传ZIP文件 + +
+ + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+ + +
+ + + + + +
+ 点击选择zip文件或将文件拖拽到此区域 +
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+ +
+`; diff --git a/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/__tests__/__snapshots__/index.test.tsx.snap b/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 000000000..9be6868f6 --- /dev/null +++ b/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,1101 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`test SqlStatementFormItem renders SqlStatementFormItem component 1`] = ` +
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + 输入SQL语句 + +
+ + + + + + + +
+
+
+
+
+ + + + + + + + + 上传SQL文件 + + +
+
+
+
+ + + + + + + + + 上传ZIP文件 + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+ +
+
+ + + +
+
+
+
+
+
+
+
+
+ +
+`; + +exports[`test SqlStatementFormItem renders SqlStatementFormItem component 2`] = ` +
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + 输入SQL语句 + + +
+
+
+
+ + + + + + + + + 上传SQL文件 + + +
+
+
+
+ + + + + + + + + 上传ZIP文件 + +
+ + + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+ + +
+ + + + + +
+ 点击选择zip文件或将文件拖拽到此区域 +
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + SQL模式 + +
+ + + + + + + +
+
+
+
+
+ + + + + + + + + 文件模式 + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+ +
+`; diff --git a/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/__tests__/index.ce.test.tsx b/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/__tests__/index.ce.test.tsx new file mode 100644 index 000000000..18cf9e87b --- /dev/null +++ b/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/__tests__/index.ce.test.tsx @@ -0,0 +1,51 @@ +/** + * @test_version ce + */ + +import { mockUseCurrentProject } from '@actiontech/shared/lib/testUtil/mockHook/mockUseCurrentProject'; +import { SqlStatementFormItemProps } from '../index.type'; +import { act, fireEvent, renderHook, screen } from '@testing-library/react'; +import { Form } from 'antd'; +import SqlStatementFormItem from '..'; +import { superRender } from '../../../../../../testUtils/customRender'; +import { getBySelector } from '@actiontech/shared/lib/testUtil/customQuery'; +import { SqlFiledInitialValue } from '../../../../../../data/common'; + +describe('test SqlStatementFormItem', () => { + beforeEach(() => { + mockUseCurrentProject(); + }); + + afterEach(() => { + jest.clearAllMocks(); + jest.clearAllTimers(); + }); + + const customRender = (params?: Partial) => { + const { result } = renderHook(() => Form.useForm()); + return superRender( +
+ + + ); + }; + + it('renders SqlStatementFormItem component', () => { + const { container } = customRender(); + + fireEvent.click(screen.getByText('上传ZIP文件')); + + expect(container).toMatchSnapshot(); + expect(screen.queryByText('选择上线模式')).not.toBeInTheDocument(); + }); +}); diff --git a/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/__tests__/index.test.tsx b/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/__tests__/index.test.tsx new file mode 100644 index 000000000..14c8b8b76 --- /dev/null +++ b/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/__tests__/index.test.tsx @@ -0,0 +1,70 @@ +import { mockUseCurrentProject } from '@actiontech/shared/lib/testUtil/mockHook/mockUseCurrentProject'; +import { SqlStatementFormItemProps } from '../index.type'; +import { act, fireEvent, renderHook, screen } from '@testing-library/react'; +import { Form } from 'antd'; +import SqlStatementFormItem from '..'; +import { superRender } from '../../../../../../testUtils/customRender'; +import { getBySelector } from '@actiontech/shared/lib/testUtil/customQuery'; +import { SqlFiledInitialValue } from '../../../../../../data/common'; + +describe('test SqlStatementFormItem', () => { + beforeEach(() => { + mockUseCurrentProject(); + }); + + afterEach(() => { + jest.clearAllMocks(); + jest.clearAllTimers(); + }); + + const customRender = (params?: Partial) => { + const { result } = renderHook(() => Form.useForm()); + return superRender( +
+ + + ); + }; + + it('renders SqlStatementFormItem component', () => { + const { container } = customRender(); + + expect(container).toMatchSnapshot(); + + fireEvent.click(screen.getByText('上传ZIP文件')); + + expect(container).toMatchSnapshot(); + expect(screen.queryByText('选择上线模式')).toBeInTheDocument(); + }); + + it('resets form fields on upload type change when clearSqlContentFormWhenChangeUploadType is true', async () => { + customRender({ + clearSqlContentFormWhenChangeUploadType: true, + fieldPrefixPath: 'prefix' + }); + + await act(async () => { + fireEvent.input(getBySelector('input.custom-monaco-editor'), { + target: { value: 'SELECT 1' } + }); + }); + + fireEvent.click(screen.getByText('上传SQL文件')); + + fireEvent.click(screen.getByText('输入SQL语句')); + + expect(getBySelector('input.custom-monaco-editor')).toHaveValue( + SqlFiledInitialValue + ); + }); +}); diff --git a/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/components/SqlExecModeSelector.tsx b/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/components/SqlExecModeSelector.tsx index 1c9d48ad7..ddf927e9d 100644 --- a/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/components/SqlExecModeSelector.tsx +++ b/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/components/SqlExecModeSelector.tsx @@ -19,14 +19,11 @@ import { ResponseCode } from '@actiontech/shared/lib/enum'; const SqlExecModeSelector: React.FC = ({ fieldPrefixPath, - isSupportFileModeExecuteSql + isSupportFileModeExecuteSql, + currentSqlUploadType }) => { const { t } = useTranslation(); const form = Form.useFormInstance(); - const currentSqlUploadType = Form.useWatch( - [fieldPrefixPath, 'currentUploadType'], - form - ) as AuditTaskResV1SqlSourceEnum; const currentExecuteMode = Form.useWatch( [fieldPrefixPath, 'exec_mode'], @@ -60,8 +57,10 @@ const SqlExecModeSelector: React.FC = ({ return ( = ({ isAuditing, auditAction, databaseInfo, - isSameSqlForAll + isSameSqlForAll, + currentSqlUploadType }) => { const { t } = useTranslation(); const { projectName } = useCurrentProject(); const form = Form.useFormInstance(); - const currentSqlUploadType = Form.useWatch( - [fieldPrefixPath, 'currentUploadType'], - form - ) as AuditTaskResV1SqlSourceEnum; const [ formatterLoading, @@ -54,8 +51,9 @@ const SqlFormatterAndSubmitter: React.FC = ({ }; const originSql = form.getFieldValue([fieldPrefixPath, 'form_data']); const instanceName = isSameSqlForAll - ? databaseInfo[0].instanceName + ? databaseInfo?.[0]?.instanceName : databaseInfo.find((v) => v.key === fieldPrefixPath)?.instanceName; + if (originSql && originSql !== SqlFiledInitialValue) { if (instanceName) { const dbType = (await getInstanceType(instanceName))?.db_type; diff --git a/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/components/SqlUploadContent.tsx b/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/components/SqlUploadContent.tsx index dde319a58..8c607aacd 100644 --- a/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/components/SqlUploadContent.tsx +++ b/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/components/SqlUploadContent.tsx @@ -1,7 +1,7 @@ import { Form } from 'antd'; import { SqlUploadContentProps } from './index.type'; import { SqlAuditInfoFormFields } from '../../../../Create/index.type'; -import { CustomDraggerUpload, EmptyBox } from '@actiontech/shared'; +import { CustomDraggerUpload, LazyLoadComponent } from '@actiontech/shared'; import { AuditTaskResV1SqlSourceEnum } from '@actiontech/shared/lib/api/sqle/service/common.enum'; import { FormItemNoLabel } from '@actiontech/shared/lib/components/FormCom'; import { getFileFromUploadChangeEvent } from '@actiontech/shared/lib/utils/Common'; @@ -15,14 +15,11 @@ import { import { NamePath } from 'antd/es/form/interface'; const SqlUploadContent: React.FC = ({ - fieldPrefixPath + fieldPrefixPath, + currentSqlUploadType }) => { const { t } = useTranslation(); const form = Form.useFormInstance(); - const currentSqlUploadType = Form.useWatch( - [fieldPrefixPath, 'currentUploadType'], - form - ) as AuditTaskResV1SqlSourceEnum; const generateFieldName = (name: string) => { return [fieldPrefixPath, name]; @@ -38,20 +35,24 @@ const SqlUploadContent: React.FC = ({ return ( <> - = ({ }} /> - - + = ({ title={t('execWorkflow.create.form.sqlInfo.sqlFileTips')} /> - - + = ({ title={t('execWorkflow.create.form.sqlInfo.zipFileTips')} /> - + ); }; diff --git a/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/components/index.type.ts b/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/components/index.type.ts index cac64a38e..c186d8ddf 100644 --- a/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/components/index.type.ts +++ b/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/components/index.type.ts @@ -1,16 +1,20 @@ +import { AuditTaskResV1SqlSourceEnum } from '@actiontech/shared/lib/api/sqle/service/common.enum'; import { SqlStatementFormItemProps } from '../index.type'; -export type SqlUploadContentProps = Pick< - SqlStatementFormItemProps, - 'fieldPrefixPath' ->; +export type SqlUploadContentProps = { + currentSqlUploadType: AuditTaskResV1SqlSourceEnum; +} & Pick; -export type SqlExecModeSelectorProps = Pick< +export type SqlExecModeSelectorProps = { + currentSqlUploadType: AuditTaskResV1SqlSourceEnum; +} & Pick< SqlStatementFormItemProps, 'fieldPrefixPath' | 'isSupportFileModeExecuteSql' >; -export type SqlFormatterAndSubmitterProps = Pick< +export type SqlFormatterAndSubmitterProps = { + currentSqlUploadType: AuditTaskResV1SqlSourceEnum; +} & Pick< SqlStatementFormItemProps, | 'fieldPrefixPath' | 'isAuditing' diff --git a/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/index.tsx b/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/index.tsx index 63dbdc4c5..ce8195f3f 100644 --- a/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/index.tsx +++ b/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/SqlStatementFormItem/index.tsx @@ -32,6 +32,11 @@ const SqlStatementFormItem: React.FC = ({ return [fieldPrefixPath, 'currentUploadType']; }, [fieldPrefixPath]); + const currentUploadType = Form.useWatch( + currentUploadTypeFieldName, + form + ) as AuditTaskResV1SqlSourceEnum; + const uploadTypeChangeHandle = () => { if (clearSqlContentFormWhenChangeUploadType) { form.resetFields([ @@ -66,14 +71,21 @@ const SqlStatementFormItem: React.FC = ({ /> - + + {/* #if [ee] */} + {/* #endif */} +
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + + + + + + + + 输入SQL语句 + +
+ + + + + + + +
+
+
+
+
+ + + + + + + + + 上传SQL文件 + + +
+
+
+
+ + + + + + + + + 上传ZIP文件 + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+ +
+
+ + + +
+
+
+
+
+
+
+
+
+ +
+`; diff --git a/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/__tests__/__snapshots__/index.test.tsx.snap b/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 000000000..2150977ab --- /dev/null +++ b/packages/sqle/src/page/SqlExecWorkflow/Common/SqlStatementFormController/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,1350 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`test SqlStatementFormController matches snapshot with different SQL mode and data sources 1`] = ` +
+
+
+
+ + +
+
+
+ + + + + 2023-12-18 + +
-
-
- - - -
-
-

- 审核SQL语句信息 -

-
-
-
- -
-
-
-
-
-
-
-
-
-
- - - - - - - - - - - - - - - -
+ workflow desc + -
+
-
+ +
+
+
+
+
-
- - sqle - +
+
+
- - - - - - - - - - + - - -
- +
+
-
-
-
- -
-
- -
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
- +
+
+
+ + + + + + + + + + + + + + + +
+ + +
+
+
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
- +
+
+
-
-
-
-
-
-
-
-
-
- - - - - - - - - 输入SQL语句 - -
- - - - - - + + 添加数据源 -
+
-
-
- - - - - - - - - 上传SQL文件 - - -
-
-
-
- - - - - - - - - 上传ZIP文件 - - +
@@ -5956,1795 +5484,1617 @@ exports[`sqle/SqlExecWorkflow/Create render create workflow when task sql is nul
-
-
-
-
+ +
+
- +
+ +
-
-
+
+
-
-
- -
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ + - - SQL美化 + + 输入SQL语句 - +
+ + + + + + + +
+
- - - + + + + + + + + 上传SQL文件 + + +
-
-
-
-
-
-
-
-
-
- - - -
- +
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+ +
+
+ + + +
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+ +
+ +`; + +exports[`sqle/SqlExecWorkflow/Create should handle form submission and audit action for different SQLs 3`] = ` + + + -
-   -
- - - - -
- - - - + 13 / 3000 + + + +
+
-
-
-
- -
- -
-
-
-
-
-
- - - - - - - - - - - - -
-
- -
-
-
-
-
-
- - - MySQL - -
-
-
-
-
- mysql-1(10.186.62.13:33061) -
-
-
-
- mysql-2(10.186.62.14:33062) -
-
-
-
- xin-test-database(10.186.62.15:33063) +
+
+
+
+
+
+ + + + + + + + + + + + + + + +
+ +
+
+
+
+
-
- mysql-5(139.196.241.182:33061) -
-
-
-
- - - PostgreSQL - -
-
-
-
-
- progres-1(10.186.62.16:5432) -
-
-
-
-
- -
-
-
-
-
-
-
- - - - - - - - - - - - -
-
-
-
-
-
-
- testSchema +
+
+
+
+
+ + sqle + +
+ + + + + + + + + + + + + + + +
+ + +
+
+
+
+
-
- dms -
-
- sqle +
+ +
-
-
- test123 -
-
-
-
- test -
-
-
-
-
-
-
-
-
- -`; - -exports[`sqle/SqlExecWorkflow/Create render create workflow when task sql is null 2`] = ` - - - - - 13 / 3000 - - + + + + + + 选择相同SQL
+
+ 当数据源类型相同时,才能使用相同SQL模式 +
+
+ +
+
+
+
+
- - - -
-
-

- 审核SQL语句信息 -

+
+ +
+
+
+
- -
-
+ xmlns="http://www.w3.org/2000/svg" + > + + + + + + 选择SQL语句上传方式 + + +
+ class="ant-form-item-control-input" + > +
+
-
-
+
+
-
-
- - - - - + + + + + 输入SQL语句 + +
+ + + - - - - - - +
+
+
+
+
+ + + - mysql-2(10.186.62.14:33062) - + + + + 上传SQL文件 + +
-
@@ -7753,8 +7103,7 @@ exports[`sqle/SqlExecWorkflow/Create render create workflow when task sql is nul
@@ -7779,124 +7128,108 @@ exports[`sqle/SqlExecWorkflow/Create render create workflow when task sql is nul >
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
- - sqle - + + 审 核 + + +
+
- - - - + + SQL美化 + + +
+
- - - - - - - - + + + - +
- -
@@ -7904,663 +7237,795 @@ exports[`sqle/SqlExecWorkflow/Create render create workflow when task sql is nul
-
- -
-
-
- -
-
-
-
- -
-
+ + +
+ -
-
-
+ + + + 返回工单列表 + + + +
+
+
+
+
-
+ + 提交工单 + + +
+
+
+
+
+
+ workflow_name_2 +
+
+ workflow desc +
+
+
+
+
+
+
+
+
+
- + 数据去重
-
+
+
+ +
+
+
+
+
+
+ 全部等级 +
+
+ 普通(Normal) +
+
+ 提示(Notice) +
+
+ 告警(Warning) +
+
+ 错误(Error) +
+
+
+
+
+ + 100 + % + + + 审核通过率 + +
+
+
+
+ + 100 + + + 审核结果评分 +
+
+
+ + dms + + + Schema + +
+
+
+
+
+
+
+
-
-
-
-
+ + + + + + + -
-
+ -
- - - - - - - - - 输入SQL语句 - -
- - - - - - - -
+ 序号 + + + 执行语句 + + + 审核结果 + + + 说明 + + + 操作 + + + + + + +
+  
-
-
+
- + + +
+   +
+ + +
+   +
+ + +
+   +
+ + + + + 1 + + +
+
+ + + SELECT + + + + 1 + + ; + +
+
- - - 上传SQL文件 - +
+
+ + +
-
-
+
- - +
- + + +
+
+
+ +
-
-
-
-
+ + + +
-
-
-
-
-
+ 共 1 条数据 + + +
  • +
  • -
    -
    -
    -
    + + + +
  • -
    -
    + 1 + +
  • +
  • + +
  • +
  • -
    - +
    -
    -
    + + + +
  • -
    -
    + +
    -
    - +
    +
    -
    +
    @@ -8598,887 +8063,664 @@ exports[`sqle/SqlExecWorkflow/Create render create workflow when task sql is nul
    -
    -
    - -
    -
    - -
    -
    -
    -
    -
    -
    - workflow_name_2 -
    -
    - workflow desc -
    + />
    -
    - -
    -
    -
    -
    -
    - 数据去重 -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    - 全部等级 -
    -
    - 普通(Normal) -
    -
    - 提示(Notice) -
    -
    - 告警(Warning) -
    -
    - 错误(Error) -
    -
    -
    -
    -
    + + + + + + + + + + + + + + + + + - - 100 - % - - - 审核通过率 - -
    -
    -
    -
    + + + + + - - 100 - - - 审核结果评分 - -
    -
    -
    -
    - + + + + + + - dms - - + + + + + + + + + - Schema - -
    -
    + + + + + + + + + + + + + + + + + + + + + + + + +
    -
    -
    +
    +
    +
    +
    +
    +
    + + + + + + + + + + + +
    @@ -9486,11 +8728,11 @@ exports[`sqle/SqlExecWorkflow/Create render create workflow when task sql is nul
    -
    -
    -
    -
    -
    - -
    - - - MySQL - -
    -
    -
    -
    -
    - mysql-1(10.186.62.13:33061) -
    -
    -
    -
    - mysql-2(10.186.62.14:33062) -
    -
    -
    -
    - xin-test-database(10.186.62.15:33063) -
    -
    -
    -
    - mysql-5(139.196.241.182:33061) -
    -
    -
    - -
    - - - PostgreSQL - -
    -
    -
    -
    -
    - progres-1(10.186.62.16:5432) -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - - - - -
    -
    -
    - -`; - -exports[`sqle/SqlExecWorkflow/Create render form for click audit btn for diff same sql 1`] = ` - - - + + + + 2023-12-18 + + +
    +
    + + + + - + + + + - 13 / 3000 - - - -
    -
    -
    -
    -
    - - - -
    -
    -

    - 审核SQL语句信息 -

    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - - - - - - - -
    + workflow desc + -
    +
    -
    +
    - - -
    - - -
    -
    -
    -
    -
    - - - - - - - - - - - - -
    -
    - -
    -
    -
    -
    -
    - -
    - - - MySQL - -
    -
    -
    -
    -
    - mysql-1(10.186.62.13:33061) -
    -
    -
    -
    - mysql-2(10.186.62.14:33062) -
    -
    -
    -
    - xin-test-database(10.186.62.15:33063) -
    -
    -
    -
    - mysql-5(139.196.241.182:33061) -
    -
    -
    - -
    - - - PostgreSQL - -
    -
    -
    -
    -
    - progres-1(10.186.62.16:5432) -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - - - - -
    -
    -
    -
    -
    -
    -
    - testSchema -
    -
    -
    -
    - dms -
    -
    -
    -
    - sqle -
    -
    -
    -
    - test123 -
    -
    -
    -
    - test -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -`; - -exports[`sqle/SqlExecWorkflow/Create render form for click audit btn for diff same sql 2`] = ` - - - - - 13 / 3000 - - - -
    -
    -
    - - - - - -
    -
    -

    - 审核SQL语句信息 -

    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - - - - - - - -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - sqle - -
    - - - - - - - - - - - - - - - -
    - - -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - 输入SQL语句 - -
    - - - - - - - -
    -
    -
    -
    -
    - - - - - - - - - 上传SQL文件 - - -
    -
    -
    -
    - - - - - - - - - 上传ZIP文件 - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - -
    -
    - -
    -
    -
    - -
    -
    - -
    -
    -
    -
    -
    -
    - workflow_name_2 -
    -
    - workflow desc -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    - 数据去重 -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    - 全部等级 -
    -
    - 普通(Normal) -
    -
    - 提示(Notice) -
    -
    - 告警(Warning) -
    -
    - 错误(Error) -
    -
    -
    -
    -
    - - 100 - % - - - 审核通过率 - -
    -
    -
    -
    - - 100 - - - 审核结果评分 - -
    -
    -
    -
    - - dms - - - Schema - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - 序号 - - 执行语句 - - 审核结果 - - 说明 - - 操作 -
    - 1 - -
    -
    - - - SELECT - - - - 1 - - ; - -
    -
    - - - -
    -
    -
    -
    -
    -
    - - - - - - - test message - -
    -
    -
    -
    -
    - test -
    - - - - - -
    - - -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
      -
    • - - 共 1 条数据 - -
    • -
    • - -
    • -
    • - - 1 - -
    • -
    • - -
    • -
    • - -
    • -
    -
    -
    -
    -
    -
    - - - -
    -
    -
    - - - - - - - - - - - - -
    -
    - -
    -
    -
    -
    -
    - -
    - - - MySQL - -
    -
    -
    -
    -
    - mysql-1(10.186.62.13:33061) -
    -
    -
    -
    - mysql-2(10.186.62.14:33062) -
    -
    -
    -
    - xin-test-database(10.186.62.15:33063) -
    -
    -
    -
    - mysql-5(139.196.241.182:33061) -
    -
    -
    - -
    - - - PostgreSQL - -
    -
    -
    -
    -
    - progres-1(10.186.62.16:5432) -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - - - - -
    -
    -
    -
    -
    -
    -
    - testSchema -
    -
    -
    -
    - dms -
    -
    -
    -
    - sqle -
    -
    -
    -
    - test123 -
    -
    -
    -
    - test -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -`; - -exports[`sqle/SqlExecWorkflow/Create render form for click audit btn for diff same sql 3`] = ` - - - - - 13 / 3000 - - - -
    -
    - - - - - - -
    -
    -

    - 审核SQL语句信息 -

    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - - - - - - - -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - sqle - -
    - - - - - - - - - - - - - - - -
    - - -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - 输入SQL语句 - -
    - - - - - - - -
    -
    -
    -
    -
    - - - - - - - - - 上传SQL文件 - - -
    -
    -
    -
    - - - - - - - - - 上传ZIP文件 - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - -
    -
    - -
    -
    -
    - -
    -
    - -
    -
    -
    -
    -
    -
    - workflow_name_2 -
    -
    - workflow desc -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    - 数据去重 -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    - 全部等级 -
    -
    - 普通(Normal) -
    -
    - 提示(Notice) -
    -
    - 告警(Warning) -
    -
    - 错误(Error) -
    -
    -
    -
    -
    - - 100 - % - - - 审核通过率 - -
    -
    -
    -
    - - 100 - - - 审核结果评分 - -
    -
    -
    -
    - - dms - - - Schema - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - 序号 - - 执行语句 - - 审核结果 - - 说明 - - 操作 -
    - 1 - -
    -
    - - - SELECT - - - - 1 - - ; - -
    -
    - - - -
    -
    -
    -
    -
    -
    - - - - - - - test message - -
    -
    -
    -
    -
    - test -
    - - - - - -
    - - -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
      -
    • - - 共 1 条数据 - -
    • -
    • - -
    • -
    • - - 1 - -
    • -
    • - -
    • -
    • - -
    • -
    -
    -
    -
    -
    -
    - - - -
    -
    -
    - - - - - - - - - - - - -
    -
    - -
    -
    -
    -
    -
    - -
    - - - MySQL - -
    -
    -
    -
    -
    - mysql-1(10.186.62.13:33061) -
    -
    -
    -
    - mysql-2(10.186.62.14:33062) -
    -
    -
    -
    - xin-test-database(10.186.62.15:33063) -
    -
    -
    -
    - mysql-5(139.196.241.182:33061) -
    -
    -
    - -
    - - - PostgreSQL - -
    -
    -
    -
    -
    - progres-1(10.186.62.16:5432) -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - - - - -
    -
    -
    -
    -
    -
    -
    - testSchema -
    -
    -
    -
    - dms -
    -
    -
    -
    - sqle -
    -
    -
    -
    - test123 -
    -
    -
    -
    - test -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    - - - -
    -
    -

    - 审核SQL语句信息 -

    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - - - - - - - -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - sqle - -
    - - - - - - - - - - - - - - - -
    - - -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - 输入SQL语句 - -
    - - - - - - - -
    -
    -
    -
    -
    - - - - - - - - - 上传SQL文件 - - -
    -
    -
    -
    - - - - - - - - - 上传ZIP文件 - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    - -
    -
    -
    - -
    -
    - -
    -
    -
    -
    -
    -
    - workflow_name_2 -
    -
    - workflow desc -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    - 数据去重 -
    -
    -
    - -
    - -
    -
    -
    -
    -
    -
    - 全部等级 -
    -
    - 普通(Normal) -
    -
    - 提示(Notice) -
    -
    - 告警(Warning) -
    -
    - 错误(Error) -
    -
    -
    -
    -
    - - 100 - % - - - 审核通过率 - -
    -
    -
    -
    - - 100 - - - 审核结果评分 - -
    -
    -
    -
    - - dms - - - Schema - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - 序号 - - 执行语句 - - 审核结果 - - 说明 - - 操作 -
    - 1 - -
    -
    - - - SELECT - - - - 1 - - ; - -
    -
    - - - -
    -
    -
    -
    -
    -
    - - - - - - - test message - -
    -
    -
    -
    -
    - test -
    - - - - - -
    - - -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
      -
    • - - 共 1 条数据 - -
    • -
    • - -
    • -
    • - - 1 - -
    • -
    • - -
    • -
    • - -
    • -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    - - - - - - - - - - - - -
    -
    - -
    -
    -
    -
    -
    - -
    - - - MySQL - -
    -
    -
    -
    -
    - mysql-1(10.186.62.13:33061) -
    -
    -
    -
    - mysql-2(10.186.62.14:33062) -
    -
    -
    -
    - xin-test-database(10.186.62.15:33063) -
    -
    -
    -
    - mysql-5(139.196.241.182:33061) -
    -
    -
    - -
    - - - PostgreSQL - -
    -
    -
    -
    -
    - progres-1(10.186.62.16:5432) -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - - - - -
    -
    -
    -
    -
    -
    -
    - testSchema -
    -
    -
    -
    - dms -
    -
    -
    -
    - sqle -
    -
    -
    -
    - test123 -
    -
    -
    -
    - test -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    - - - -
    -
    -

    - 审核SQL语句信息 -

    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - - - - - - - -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - sqle - -
    - - - - - - - - - - - - - - - -
    - - -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - 输入SQL语句 - -
    - - - - - - - -
    -
    -
    -
    -
    - - - - - - - - - 上传SQL文件 - - -
    -
    -
    -
    - - - - - - - - - 上传ZIP文件 - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    -
    -
    -
    - -
    -
    - - - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - -
    - -
    -
    - -
    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    - 工单创建成功 -
    -
    - workflow desc -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - - - - -
    -
    - -
    -
    -
    -
    -
    - -
    - - - MySQL - -
    -
    -
    -
    -
    - mysql-1(10.186.62.13:33061) -
    -
    -
    -
    - mysql-2(10.186.62.14:33062) -
    -
    -
    -
    - xin-test-database(10.186.62.15:33063) -
    -
    -
    -
    - mysql-5(139.196.241.182:33061) -
    -
    -
    - -
    - - - PostgreSQL - -
    -
    -
    -
    -
    - progres-1(10.186.62.16:5432) -
    -
    -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - - - - -
    -
    -
    -
    -
    -
    -
    - testSchema -
    -
    -
    -
    - dms -
    -
    -
    -
    - sqle -
    -
    -
    -
    - test123 -
    -
    -
    -
    - test -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -