Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d45ecae
[chore](jest): Introduce Jest Projects for conditional compilation, M…
LZS911 Mar 18, 2026
5da2611
[test]: add test for ai banner and governance
Mar 16, 2026
89b27c8
[test]: update snapshot
Mar 16, 2026
6c656b1
[feature](CompanyNotice): Add time-based notice display and include_l…
LZS911 Mar 20, 2026
da67c54
[test]: remove case and update snapshot
LZS911 Mar 20, 2026
084b02f
[ui]: update style and update snapshot
LZS911 Mar 20, 2026
e8a825b
fix(dms-kit): allow custom getPopupContainer in BasicRangePicker
LZS911 Mar 23, 2026
0633dd9
Sync sql optimization change to main
Mar 26, 2026
10fcbea
[feature]: SQL workbench maintenance windows in sql_query_config
LZS911 Mar 27, 2026
81c0f1c
[feature](sync-data-source): submit sql_query_config maintenance_time…
LZS911 Mar 27, 2026
734a61a
[fix]: code check
LZS911 Mar 27, 2026
e70eeb4
[fix]: sync company notice form in modal to stop valid period resetti…
LZS911 Mar 25, 2026
8e5ff56
[test]: update snapshot
LZS911 Mar 27, 2026
6eccb46
[fix]: add button permission checks and fix top announcement banner l…
LZS911 Mar 24, 2026
296cae5
[fix]: resolve stylelint error
LZS911 Mar 24, 2026
5c6230b
[test]: update snapshot
LZS911 Mar 27, 2026
3e75a25
[chore]: always show AI Performance Engine button and use notificatio…
LZS911 Mar 27, 2026
ac51770
datasource
tianzuzhao Mar 30, 2026
4447560
[test]: update snapshot
tianzuzhao Mar 30, 2026
544d26c
[test]: update snapshot
LZS911 Apr 8, 2026
287043a
[chore]: Remove SQLE operation action/type APIs
LZS911 Mar 12, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 8 additions & 33 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Code lint checker
run: pnpm checker

test-ee:
test:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.pull_request.title, '[skip checker]') }}
strategy:
Expand All @@ -34,65 +34,41 @@ jobs:
- name: Install dependencies
uses: ./.github/actions/catch-install-pnpm

- name: Coverage test report ee
run: sh ./scripts/jest/run-ci-ee.sh ${{ matrix.shard }} ${{ strategy.job-total }}
- name: Coverage test report
run: sh ./scripts/jest/run-ci.sh ${{ matrix.shard }} ${{ strategy.job-total }}

- uses: actions/upload-artifact@v4
with:
name: coverage-artifacts-${{ matrix.shard }}
path: coverage/

test-ce:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.pull_request.title, '[skip checker]') }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install dependencies
uses: ./.github/actions/catch-install-pnpm

- name: Coverage test report ce
run: sh ./scripts/jest/run-ci-ce.sh

- uses: actions/upload-artifact@v4
with:
name: ce-coverage-artifacts
path: ce_coverage/

report:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.pull_request.title, '[skip checker]') }}
needs: [test-ee, test-ce]
needs: [test]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Get CE Coverage
uses: actions/download-artifact@v4
with:
name: ce-coverage-artifacts
path: ce_coverage

- name: Get EE Coverage 1
- name: Get Coverage 1
uses: actions/download-artifact@v4
with:
name: coverage-artifacts-1
path: coverage

- name: Get EE Coverage 2
- name: Get Coverage 2
uses: actions/download-artifact@v4
with:
name: coverage-artifacts-2
path: coverage

- name: Get EE Coverage 3
- name: Get Coverage 3
uses: actions/download-artifact@v4
with:
name: coverage-artifacts-3
path: coverage

- name: Get EE Coverage 4
- name: Get Coverage 4
uses: actions/download-artifact@v4
with:
name: coverage-artifacts-4
Expand All @@ -115,7 +91,6 @@ jobs:
uses: geekyeggo/delete-artifact@v5
with:
name: |
ce-coverage-artifacts
coverage-artifacts-1
coverage-artifacts-2
coverage-artifacts-3
Expand Down
125 changes: 104 additions & 21 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,37 @@ const { pathsToModuleNameMapper } = require('ts-jest');

compilerOptions.paths['~/*'][0] = path.resolve(compilerOptions.paths['~/*'][0]);

module.exports = {
const sharedModuleNameMapper = {
'.+\\.(css|style|less|sass|scss|ttf|woff|woff2)$': 'identity-obj-proxy',
'@ant-design/plots':
'<rootDir>/packages/shared/lib/testUtil/mockModule/mockAntDesignPlots.jsx',
'monaco-editor':
'<rootDir>/packages/shared/lib/testUtil/mockModule/mockEditor.jsx',
'@monaco-editor/react':
'<rootDir>/packages/shared/lib/testUtil/mockModule/mockEditor.jsx',
'@uiw/react-md-editor':
'<rootDir>/packages/shared/lib/testUtil/mockModule/mockEditor.jsx',
'@actiontech/(.*)': '<rootDir>/packages/$1',
'@react-sigma/core(.*)$':
'<rootDir>/packages/shared/lib/testUtil/mockModule/mockSigmaCore.tsx',
'@react-sigma/graph-search$':
'<rootDir>/packages/shared/lib/testUtil/mockModule/mockSigmaGraphSearch.tsx',
...pathsToModuleNameMapper(compilerOptions.paths)
};

const sharedIgnorePatterns = ['/node_modules/', '/demo/', '/demos/'];

// Naming conventions for condition-specific test files:
// *.ce.test.{ts,tsx} → CE project (ee=false, ce=true, sqle=true, dms=false) 不要强制匹配 ce.test, ce.[可选项].test.{ts,tsx}
// *.sqle.test.{ts,tsx} → EE project (ee=true, ce=false, sqle=true, dms=false) 同上
// *.provision.test.{ts,tsx} → PROVISION project (ee=true, ce=false, sqle=false, provision=true, dms=false) 同上
// *.test.{ts,tsx} → DMS project (ee=true, ce=false, sqle=true, provision=true, dms=true) [default] 同上
// 实现:`.ce.` / `.sqle.` / `.provision.` 与 `.test.` 之间可有零段或多段 `.xxx.`(正则见下方 *_TEST_FILE_RE)。
const CE_TEST_FILE_RE = '\\.ce(\\.[^./]+)*\\.test\\.[jt]sx?$';
const SQLE_TEST_FILE_RE = '\\.sqle(\\.[^./]+)*\\.test\\.[jt]sx?$';
const PROVISION_TEST_FILE_RE = '\\.provision(\\.[^./]+)*\\.test\\.[jt]sx?$';

const sharedProjectConfig = {
transform: {
'^.+\\.(ts|tsx|js|jsx)$': '<rootDir>/scripts/jest/custom-transform.js',
'^.+\\.(png|jpg|jpeg|css|json)$': '<rootDir>/scripts/jest/file-transform.js'
Expand All @@ -19,24 +49,7 @@ module.exports = {
moduleFileExtensions: ['ts', 'tsx', 'js', 'json', 'jsx', 'node'],
testEnvironment: 'jest-environment-jsdom',
resetMocks: true,
moduleNameMapper: {
'.+\\.(css|style|less|sass|scss|ttf|woff|woff2)$': 'identity-obj-proxy',
'@ant-design/plots':
'<rootDir>/packages/shared/lib/testUtil/mockModule/mockAntDesignPlots.jsx',
'monaco-editor':
'<rootDir>/packages/shared/lib/testUtil/mockModule/mockEditor.jsx',
'@monaco-editor/react':
'<rootDir>/packages/shared/lib/testUtil/mockModule/mockEditor.jsx',
'@uiw/react-md-editor':
'<rootDir>/packages/shared/lib/testUtil/mockModule/mockEditor.jsx',
'@actiontech/(.*)': '<rootDir>/packages/$1',
'@react-sigma/core(.*)$':
'<rootDir>/packages/shared/lib/testUtil/mockModule/mockSigmaCore.tsx',
'@react-sigma/graph-search$':
'<rootDir>/packages/shared/lib/testUtil/mockModule/mockSigmaGraphSearch.tsx',
...pathsToModuleNameMapper(compilerOptions.paths)
},

moduleNameMapper: sharedModuleNameMapper,
collectCoverageFrom: [
'packages/**/{src,lib}/{page,components,hooks,global,store,utils}/**/*.{ts,tsx}',
'packages/**/src/App.tsx',
Expand All @@ -49,8 +62,78 @@ module.exports = {
'!packages/**/demo/**',
'!packages/**/demos/**'
],
setupFilesAfterEnv: ['<rootDir>/jest-setup.ts'],
testPathIgnorePatterns: ['/node_modules/', '/demo/', '/demos/'],
setupFilesAfterEnv: ['<rootDir>/jest-setup.ts']
};

module.exports = {
projects: [
{
...sharedProjectConfig,
displayName: 'dms',
globals: {
TEST_CONDITIONS: {
ee: true,
ce: false,
sqle: true,
provision: true,
dms: true
}
},
// Default tests only: exclude CE / sqle / provision condition tests (dedicated projects)
testPathIgnorePatterns: [
...sharedIgnorePatterns,
CE_TEST_FILE_RE,
SQLE_TEST_FILE_RE,
PROVISION_TEST_FILE_RE
]
},
{
...sharedProjectConfig,
displayName: 'sqle-ce',
globals: {
TEST_CONDITIONS: {
ee: false,
ce: true,
sqle: true,
provision: false,
dms: false
}
},
testRegex: CE_TEST_FILE_RE,
testPathIgnorePatterns: sharedIgnorePatterns
},
{
...sharedProjectConfig,
displayName: 'sqle-ee',
globals: {
TEST_CONDITIONS: {
ee: true,
ce: false,
sqle: true,
provision: false,
dms: false
}
},
testRegex: SQLE_TEST_FILE_RE,
// e.g. *.ce.sqle.test.* belongs to CE, not EE
testPathIgnorePatterns: [...sharedIgnorePatterns, CE_TEST_FILE_RE]
},
{
...sharedProjectConfig,
displayName: 'provision',
globals: {
TEST_CONDITIONS: {
ee: true,
ce: false,
sqle: false,
provision: true,
dms: false
}
},
testRegex: PROVISION_TEST_FILE_RE,
testPathIgnorePatterns: [...sharedIgnorePatterns, CE_TEST_FILE_RE]
}
],
reporters: [
'default',
[
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"checker": "concurrently \"pnpm ts-check\" \"pnpm eslint\" \"pnpm stylelint\" \"pnpm prettier:c\"",
"test": "sh ./scripts/jest/run.sh",
"test:c": "sh ./scripts/jest/run-coverage.sh",
"test:ci": "sh ./scripts/jest/run-ci-ee.sh && sh ./scripts/jest/run-ci-ce.sh && node ./scripts/jest/merge-report-json.js",
"test:ci": "sh ./scripts/jest/run-ci.sh 1 1 && node ./scripts/jest/merge-report-json.js",
"test:clean": "jest --clearCache",
"icon:g": "pnpm --filter @actiontech/icons icon:g",
"icon:docs:g": "pnpm --filter @actiontech/icons docs:g",
Expand Down Expand Up @@ -149,4 +149,4 @@
"@babel/core": "^7.22.0",
"@ant-design/cssinjs": "1.17.0"
}
}
}
12 changes: 6 additions & 6 deletions packages/base/src/__snapshots__/App.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`App render App when "checkPageAction" is false 1`] = `
<div>
<section
class="css-m36rcd"
class="css-7jjle5"
>
<div
class="dms-layout-side css-g2hyay"
Expand Down Expand Up @@ -337,7 +337,7 @@ exports[`App render App when "checkPageAction" is false 1`] = `
class="dms-layout-content"
>
<div
class="actiontech-page-header-namespace css-1xspr0w"
class="actiontech-page-header-namespace css-ex8bfe"
>
<div
class="title"
Expand All @@ -349,7 +349,7 @@ exports[`App render App when "checkPageAction" is false 1`] = `
/>
</div>
<div
class="css-1n5cj6v"
class="css-1su4mhq"
>
<div
class="ant-card ant-card-loading ant-card-bordered ai-banner-card"
Expand Down Expand Up @@ -1109,7 +1109,7 @@ exports[`App render App when "isUserInfoFetched" is equal false 1`] = `<div />`;
exports[`App render App when token is existed 1`] = `
<div>
<section
class="css-m36rcd"
class="css-7jjle5"
>
<div
class="dms-layout-side css-g2hyay"
Expand Down Expand Up @@ -1544,7 +1544,7 @@ exports[`App render App when token is existed 1`] = `
class="dms-layout-content"
>
<div
class="actiontech-page-header-namespace css-1xspr0w"
class="actiontech-page-header-namespace css-ex8bfe"
>
<div
class="title"
Expand All @@ -1556,7 +1556,7 @@ exports[`App render App when token is existed 1`] = `
/>
</div>
<div
class="css-1n5cj6v"
class="css-1su4mhq"
>
<div
class="ant-card ant-card-loading ant-card-bordered ai-banner-card"
Expand Down
55 changes: 55 additions & 0 deletions packages/base/src/hooks/useOpPermission/index.sqle.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { cleanup, act, renderHook } from '@testing-library/react';
import useOpPermission from '.';
import userCenter from '@actiontech/shared/lib/testUtil/mockApi/base/userCenter';
import { ListOpPermissionsServiceEnum } from '@actiontech/shared/lib/api/base/service/OpPermission/index.enum';

// Verifies the [sqle && !dms] branch: service is set to sqle when calling ListOpPermissions

describe('test useOpPermission - sqle mode', () => {
let listOpPermissionSpy: jest.SpyInstance;

beforeEach(() => {
listOpPermissionSpy = userCenter.getOpPermissionsList();
jest.useFakeTimers();
});

afterEach(() => {
jest.useRealTimers();
cleanup();
});

it('should call ListOpPermissions with service=sqle', async () => {
const { result } = renderHook(() => useOpPermission());

act(() => {
result.current.updateOpPermissionList();
});

await act(async () => jest.advanceTimersByTime(3000));

expect(listOpPermissionSpy).toHaveBeenCalledTimes(1);
expect(listOpPermissionSpy).toHaveBeenCalledWith(
expect.objectContaining({
service: ListOpPermissionsServiceEnum.sqle
})
);
});

it('should call ListOpPermissions with service=sqle when filterBy is provided', async () => {
const { result } = renderHook(() => useOpPermission());

act(() => {
result.current.updateOpPermissionList();
});

await act(async () => jest.advanceTimersByTime(3000));

expect(listOpPermissionSpy).toHaveBeenCalledWith(
expect.objectContaining({
service: ListOpPermissionsServiceEnum.sqle
})
);
expect(result.current.loading).toBeFalsy();
expect(result.current.opPermissionList.length).toBeGreaterThan(0);
});
});
5 changes: 5 additions & 0 deletions packages/base/src/locale/en-US/dmsDataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ export default {
maintenanceTime: 'Maintenance time',
maintenanceTimeTips:
'After setting the maintenance time, workflows can only be executed during this maintenance time period',
sqlWorkbenchMaintenanceTime: 'SQL workbench maintenance time',
sqlWorkbenchMaintenanceTimeTips:
'Non-DQL statements in the SQL workbench can only run during these windows (independent from DB instance maintenance time)',
needAuditSqlService: 'Enable SQL audit service',
closeAuditSqlServiceTips:
'If you do not enable the SQL audit service, the DB instance cannot be used in SQL audit related services, are you sure to close it?',
Expand Down Expand Up @@ -90,6 +93,8 @@ export default {
text: 'Enable scan task for DB instance'
},

enableMaskingTask: 'Enable data masking task',

batchImportDataSource: {
buttonText: 'Batch import DB instances',
title: 'Batch import DB instances',
Expand Down
7 changes: 6 additions & 1 deletion packages/base/src/locale/en-US/dmsHome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ export default {
times: 'times',
aiPerformanceEngine: 'AI Performance Engine',
aiSmartCorrection: 'AI Smart Correction',
aiPerformanceEngineNoPermissionPrompt:
'No SQL optimization permission. Please contact your administrator',
paidFeaturePrompt:
'This feature is a paid value-added module. Please contact sales for details'
'This feature is a paid value-added module. Please contact sales for details',
aiBannerExampleDrawerTitle: 'SQL Rewritten Example',
aiBannerExampleDrawerDescription:
'This example shows the SQL comparison after AI smart correction. When using it in practice, please first perform SQL audit, and the system will automatically provide the correction entry for the SQL that triggers the rules.'
},
defaultScene: {
header: {
Expand Down
Loading