mirror of
https://gitee.com/nocobase/nocobase.git
synced 2024-11-29 18:58:26 +08:00
Merge branch 'main' into next
This commit is contained in:
commit
3d38ec0858
12
packages/core/cli/templates/plugin/src/client/locale.ts
Normal file
12
packages/core/cli/templates/plugin/src/client/locale.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
|
// @ts-ignore
|
||||||
|
import pkg from './../../package.json';
|
||||||
|
|
||||||
|
export function usePluginTranslation() {
|
||||||
|
return useTranslation([pkg.name, 'client'], { nsMode: 'fallback' });
|
||||||
|
}
|
||||||
|
|
||||||
|
export function generatePluginTranslationTemplate(key: string) {
|
||||||
|
return `{{t('${key}', { ns: ['${pkg.name}', 'client'], nsMode: 'fallback' })}}`;
|
||||||
|
}
|
1
packages/core/cli/templates/plugin/src/locale/en-US.json
Normal file
1
packages/core/cli/templates/plugin/src/locale/en-US.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{}
|
1
packages/core/cli/templates/plugin/src/locale/zh-CN.json
Normal file
1
packages/core/cli/templates/plugin/src/locale/zh-CN.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{}
|
@ -52,7 +52,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@faker-js/faker": "8.1.0",
|
"@faker-js/faker": "8.1.0",
|
||||||
"@nocobase/server": "1.3.0-alpha",
|
"@nocobase/server": "1.3.0-alpha",
|
||||||
"@playwright/test": "^1.44.0",
|
"@playwright/test": "^1.45.3",
|
||||||
"@testing-library/jest-dom": "^6.4.2",
|
"@testing-library/jest-dom": "^6.4.2",
|
||||||
"@testing-library/react": "^14.0.0",
|
"@testing-library/react": "^14.0.0",
|
||||||
"@testing-library/react-hooks": "^8.0.1",
|
"@testing-library/react-hooks": "^8.0.1",
|
||||||
|
@ -12,6 +12,8 @@ export class CreateWorkFlow {
|
|||||||
readonly page: Page;
|
readonly page: Page;
|
||||||
name: Locator;
|
name: Locator;
|
||||||
triggerType: Locator;
|
triggerType: Locator;
|
||||||
|
synchronouslyRadio: Locator;
|
||||||
|
asynchronouslyRadio: Locator;
|
||||||
description: Locator;
|
description: Locator;
|
||||||
autoDeleteHistory: Locator;
|
autoDeleteHistory: Locator;
|
||||||
submitButton: Locator;
|
submitButton: Locator;
|
||||||
@ -20,6 +22,8 @@ export class CreateWorkFlow {
|
|||||||
this.page = page;
|
this.page = page;
|
||||||
this.name = page.getByLabel('block-item-CollectionField-workflows-Name').getByRole('textbox');
|
this.name = page.getByLabel('block-item-CollectionField-workflows-Name').getByRole('textbox');
|
||||||
this.triggerType = page.getByTestId('select-single');
|
this.triggerType = page.getByTestId('select-single');
|
||||||
|
this.synchronouslyRadio = page.getByLabel('Synchronously', { exact: true });
|
||||||
|
this.asynchronouslyRadio = page.getByLabel('Asynchronously', { exact: true });
|
||||||
this.description = page.getByTestId('description-item').getByRole('textbox');
|
this.description = page.getByTestId('description-item').getByRole('textbox');
|
||||||
this.autoDeleteHistory = page.getByTestId('select-multiple');
|
this.autoDeleteHistory = page.getByTestId('select-multiple');
|
||||||
this.submitButton = page.getByLabel('action-Action-Submit-workflows');
|
this.submitButton = page.getByLabel('action-Action-Submit-workflows');
|
||||||
@ -365,6 +369,30 @@ export class FormEventTriggerNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class CustomActionEventTriggerNode {
|
||||||
|
readonly page: Page;
|
||||||
|
node: Locator;
|
||||||
|
nodeTitle: Locator;
|
||||||
|
nodeConfigure: Locator;
|
||||||
|
collectionDropDown: Locator;
|
||||||
|
relationalDataDropdown: Locator;
|
||||||
|
submitButton: Locator;
|
||||||
|
cancelButton: Locator;
|
||||||
|
addNodeButton: Locator;
|
||||||
|
constructor(page: Page, triggerName: string, collectionName: string) {
|
||||||
|
this.page = page;
|
||||||
|
this.node = page.getByLabel(`Trigger-${triggerName}`);
|
||||||
|
this.nodeTitle = page.getByLabel(`Trigger-${triggerName}`).getByRole('textbox');
|
||||||
|
this.nodeConfigure = page.getByLabel(`Trigger-${triggerName}`).getByRole('button', { name: 'Configure' });
|
||||||
|
this.collectionDropDown = page
|
||||||
|
.getByLabel('block-item-DataSourceCollectionCascader-workflows-Collection')
|
||||||
|
.locator('.ant-select-selection-search-input');
|
||||||
|
this.relationalDataDropdown = page.getByTestId('select-field-Preload associations');
|
||||||
|
this.submitButton = page.getByLabel('action-Action-Submit-workflows');
|
||||||
|
this.cancelButton = page.getByLabel('action-Action-Cancel-workflows');
|
||||||
|
this.addNodeButton = page.getByLabel('add-button', { exact: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
export class CalculationNode {
|
export class CalculationNode {
|
||||||
readonly page: Page;
|
readonly page: Page;
|
||||||
node: Locator;
|
node: Locator;
|
||||||
@ -746,4 +774,5 @@ export default module.exports = {
|
|||||||
SQLNode,
|
SQLNode,
|
||||||
ParallelBranchNode,
|
ParallelBranchNode,
|
||||||
ApprovalBranchModeNode,
|
ApprovalBranchModeNode,
|
||||||
|
CustomActionEventTriggerNode,
|
||||||
};
|
};
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
* For more information, please refer to: https://www.nocobase.com/agreement.
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { request, Browser } from '@nocobase/test/e2e';
|
import { Browser, request } from '@nocobase/test/e2e';
|
||||||
|
|
||||||
const PORT = process.env.APP_PORT || 20000;
|
const PORT = process.env.APP_PORT || 20000;
|
||||||
const APP_BASE_URL = process.env.APP_BASE_URL || `http://localhost:${PORT}`;
|
const APP_BASE_URL = process.env.APP_BASE_URL || `http://localhost:${PORT}`;
|
||||||
@ -808,6 +808,57 @@ export const apiCreateRecordTriggerActionEvent = async (
|
|||||||
return (await result.json()).data;
|
return (await result.json()).data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 添加业务表单条数据触发工作流表单事件,triggerWorkflows=key1!field,key2,key3!field.subfield
|
||||||
|
export const apiTriggerCustomActionEvent = async (collectionName: string, triggerWorkflows: string, data: any) => {
|
||||||
|
const api = await request.newContext({
|
||||||
|
storageState: process.env.PLAYWRIGHT_AUTH_FILE,
|
||||||
|
});
|
||||||
|
const state = await api.storageState();
|
||||||
|
const headers = getHeaders(state);
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
"title": "a11",
|
||||||
|
"enabled": true,
|
||||||
|
"description": null
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
const result = await api.post(`/api/${collectionName}:trigger?triggerWorkflows=${triggerWorkflows}`, {
|
||||||
|
headers,
|
||||||
|
data,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!result.ok()) {
|
||||||
|
throw new Error(await result.text());
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"id": 1,
|
||||||
|
"createdAt": "2023-12-12T02:43:53.793Z",
|
||||||
|
"updatedAt": "2023-12-12T05:41:33.300Z",
|
||||||
|
"key": "fzk3j2oj4el",
|
||||||
|
"title": "a11",
|
||||||
|
"enabled": true,
|
||||||
|
"description": null
|
||||||
|
},
|
||||||
|
"meta": {
|
||||||
|
"allowedActions": {
|
||||||
|
"view": [
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"update": [
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"destroy": [
|
||||||
|
1
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
return (await result.json()).data;
|
||||||
|
};
|
||||||
|
|
||||||
// 审批中心发起审批
|
// 审批中心发起审批
|
||||||
export const apiApplyApprovalEvent = async (data: any) => {
|
export const apiApplyApprovalEvent = async (data: any) => {
|
||||||
const api = await request.newContext({
|
const api = await request.newContext({
|
||||||
@ -1021,4 +1072,5 @@ export default module.exports = {
|
|||||||
apiApplyApprovalEvent,
|
apiApplyApprovalEvent,
|
||||||
userLogin,
|
userLogin,
|
||||||
apiCreateField,
|
apiCreateField,
|
||||||
|
apiTriggerCustomActionEvent,
|
||||||
};
|
};
|
||||||
|
@ -30,7 +30,6 @@
|
|||||||
"packages/**/dist",
|
"packages/**/dist",
|
||||||
"packages/**/public",
|
"packages/**/public",
|
||||||
"packages/core/build/bin",
|
"packages/core/build/bin",
|
||||||
"packages/core/cli/**/*",
|
|
||||||
"packages/**/lib",
|
"packages/**/lib",
|
||||||
"packages/**/es"
|
"packages/**/es"
|
||||||
]
|
]
|
||||||
|
28
yarn.lock
28
yarn.lock
@ -5053,12 +5053,12 @@
|
|||||||
picocolors "^1.0.0"
|
picocolors "^1.0.0"
|
||||||
tslib "^2.6.0"
|
tslib "^2.6.0"
|
||||||
|
|
||||||
"@playwright/test@^1.44.0":
|
"@playwright/test@^1.45.3":
|
||||||
version "1.44.0"
|
version "1.45.3"
|
||||||
resolved "https://registry.npmmirror.com/@playwright/test/-/test-1.44.0.tgz#ac7a764b5ee6a80558bdc0fcbc525fcb81f83465"
|
resolved "https://registry.npmmirror.com/@playwright/test/-/test-1.45.3.tgz#22e9c38b3081d6674b28c6e22f784087776c72e5"
|
||||||
integrity sha512-rNX5lbNidamSUorBhB4XZ9SQTjAqfe5M+p37Z8ic0jPFBMo5iCtQz1kRWkEMg+rYOKSlVycpQmpqjSFq7LXOfg==
|
integrity sha512-UKF4XsBfy+u3MFWEH44hva1Q8Da28G6RFtR2+5saw+jgAFQV5yYnB1fu68Mz7fO+5GJF3wgwAIs0UelU8TxFrA==
|
||||||
dependencies:
|
dependencies:
|
||||||
playwright "1.44.0"
|
playwright "1.45.3"
|
||||||
|
|
||||||
"@pm2/agent@~2.0.0":
|
"@pm2/agent@~2.0.0":
|
||||||
version "2.0.3"
|
version "2.0.3"
|
||||||
@ -20886,17 +20886,17 @@ platform@^1.3.1:
|
|||||||
resolved "https://registry.npmmirror.com/platform/-/platform-1.3.6.tgz#48b4ce983164b209c2d45a107adb31f473a6e7a7"
|
resolved "https://registry.npmmirror.com/platform/-/platform-1.3.6.tgz#48b4ce983164b209c2d45a107adb31f473a6e7a7"
|
||||||
integrity sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==
|
integrity sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==
|
||||||
|
|
||||||
playwright-core@1.44.0:
|
playwright-core@1.45.3:
|
||||||
version "1.44.0"
|
version "1.45.3"
|
||||||
resolved "https://registry.npmmirror.com/playwright-core/-/playwright-core-1.44.0.tgz#316c4f0bca0551ffb88b6eb1c97bc0d2d861b0d5"
|
resolved "https://registry.npmmirror.com/playwright-core/-/playwright-core-1.45.3.tgz#e77bc4c78a621b96c3e629027534ee1d25faac93"
|
||||||
integrity sha512-ZTbkNpFfYcGWohvTTl+xewITm7EOuqIqex0c7dNZ+aXsbrLj0qI8XlGKfPpipjm0Wny/4Lt4CJsWJk1stVS5qQ==
|
integrity sha512-+ym0jNbcjikaOwwSZycFbwkWgfruWvYlJfThKYAlImbxUgdWFO2oW70ojPm4OpE4t6TAo2FY/smM+hpVTtkhDA==
|
||||||
|
|
||||||
playwright@1.44.0:
|
playwright@1.45.3:
|
||||||
version "1.44.0"
|
version "1.45.3"
|
||||||
resolved "https://registry.npmmirror.com/playwright/-/playwright-1.44.0.tgz#22894e9b69087f6beb639249323d80fe2b5087ff"
|
resolved "https://registry.npmmirror.com/playwright/-/playwright-1.45.3.tgz#75143f73093a6e1467f7097083d2f0846fb8dd2f"
|
||||||
integrity sha512-F9b3GUCLQ3Nffrfb6dunPOkE5Mh68tR7zN32L4jCk4FjQamgesGay7/dAAe1WaMEGV04DkdJfcJzjoCKygUaRQ==
|
integrity sha512-QhVaS+lpluxCaioejDZ95l4Y4jSFCsBvl2UZkpeXlzxmqS+aABr5c82YmfMHrL6x27nvrvykJAFpkzT2eWdJww==
|
||||||
dependencies:
|
dependencies:
|
||||||
playwright-core "1.44.0"
|
playwright-core "1.45.3"
|
||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
fsevents "2.3.2"
|
fsevents "2.3.2"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user