From 5a09774cf6063e2bda7777b7765e4ce9db9b4e5b Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Mon, 22 Jan 2024 14:40:04 +0800 Subject: [PATCH 1/5] refactor: permission sholud passed without setting x-acl action (#3410) --- .../antd/association-field/InternalSubTable.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/client/src/schema-component/antd/association-field/InternalSubTable.tsx b/packages/core/client/src/schema-component/antd/association-field/InternalSubTable.tsx index 5512583cfe..a48d3c1c6f 100644 --- a/packages/core/client/src/schema-component/antd/association-field/InternalSubTable.tsx +++ b/packages/core/client/src/schema-component/antd/association-field/InternalSubTable.tsx @@ -35,7 +35,7 @@ export const InternalSubTable = observer( }; return ( - + Date: Tue, 23 Jan 2024 15:33:48 +0800 Subject: [PATCH 2/5] refactor: configuration mode, buttons without permission should be displayed, but cannot be clicked (#3421) --- packages/core/client/src/acl/ACLProvider.tsx | 2 +- .../client/src/schema-component/antd/action/Action.tsx | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/core/client/src/acl/ACLProvider.tsx b/packages/core/client/src/acl/ACLProvider.tsx index c8f7b69df6..52074922ce 100644 --- a/packages/core/client/src/acl/ACLProvider.tsx +++ b/packages/core/client/src/acl/ACLProvider.tsx @@ -233,7 +233,7 @@ export const ACLActionProvider = (props) => { } const params = parseAction(actionPath, { schema, recordPkValue }); if (!params) { - return null; + return {props.children}; } //视图表无编辑权限时不显示 if (editablePath.includes(actionPath) || editablePath.includes(actionPath?.split(':')[1])) { diff --git a/packages/core/client/src/schema-component/antd/action/Action.tsx b/packages/core/client/src/schema-component/antd/action/Action.tsx index b88b73a6f0..ace42978e9 100644 --- a/packages/core/client/src/schema-component/antd/action/Action.tsx +++ b/packages/core/client/src/schema-component/antd/action/Action.tsx @@ -25,6 +25,7 @@ import { useA } from './hooks'; import { useGetAriaLabelOfAction } from './hooks/useGetAriaLabelOfAction'; import { ComposedAction } from './types'; import { linkageAction } from './utils'; +import { useACLActionParamsContext } from '../../../acl'; export const Action: ComposedAction = observer( (props: any) => { @@ -44,6 +45,7 @@ export const Action: ComposedAction = observer( disabled: propsDisabled, ...others } = useProps(props); + const aclCtx = useACLActionParamsContext(); const { wrapSSR, componentCls, hashId } = useStyles(); const { t } = useTranslation(); const [visible, setVisible] = useState(false); @@ -99,7 +101,7 @@ export const Action: ComposedAction = observer( e.preventDefault(); e.stopPropagation(); - if (!disabled) { + if (!disabled && aclCtx) { const onOk = () => { onClick?.(e); setVisible(true); @@ -122,12 +124,12 @@ export const Action: ComposedAction = observer( const buttonStyle = useMemo(() => { return { ...style, - opacity: designable && field?.data?.hidden && 0.1, + opacity: designable && (field?.data?.hidden || !aclCtx) && 0.1, }; }, [designable, field?.data?.hidden, style]); const renderButton = () => { - if (!designable && field?.data?.hidden) { + if (!designable && (field?.data?.hidden || !aclCtx)) { return null; } From 1b2c67fea7c43c372246d5e06ebf9e484dccb818 Mon Sep 17 00:00:00 2001 From: chenos Date: Wed, 24 Jan 2024 13:06:06 +0800 Subject: [PATCH 3/5] fix: symlink dir --- packages/core/utils/plugin-symlink.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core/utils/plugin-symlink.js b/packages/core/utils/plugin-symlink.js index f067400bb2..94ea24c87f 100644 --- a/packages/core/utils/plugin-symlink.js +++ b/packages/core/utils/plugin-symlink.js @@ -78,7 +78,7 @@ async function createDevPluginSymLink(pluginName) { if (await fsExists(link)) { await unlink(link); } - await symlink(resolve(packagePluginsPath, pluginName), link); + await symlink(resolve(packagePluginsPath, pluginName), link, 'dir'); } catch (error) { console.error(error); } From 2792cb1b0a6a104b0f0c1e4c77e9b46ae2ef9b10 Mon Sep 17 00:00:00 2001 From: chenos Date: Wed, 24 Jan 2024 14:55:41 +0800 Subject: [PATCH 4/5] fix: e2e test did not exit successfully (#3427) * fix: e2e test did not exit successfully * fix: tree kill --------- Co-authored-by: dream2023 <1098626505@qq.com> --- package.json | 1 + packages/core/cli/src/commands/e2e.js | 16 ++++++++++++++++ yarn.lock | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 546b0c1f83..5d571da2bf 100644 --- a/package.json +++ b/package.json @@ -79,6 +79,7 @@ "pretty-quick": "^3.1.0", "react": "^18.0.0", "react-dom": "^18.0.0", + "tree-kill": "^1.2.2", "typescript": "5.1.3" }, "volta": { diff --git a/packages/core/cli/src/commands/e2e.js b/packages/core/cli/src/commands/e2e.js index ee702a4467..06127a317b 100644 --- a/packages/core/cli/src/commands/e2e.js +++ b/packages/core/cli/src/commands/e2e.js @@ -4,6 +4,7 @@ const { execSync } = require('node:child_process'); const axios = require('axios'); const { pTest } = require('./p-test'); const os = require('os'); +const treeKill = require('tree-kill'); /** * 检查服务是否启动成功 @@ -91,6 +92,17 @@ async function runApp(options = {}) { run('nocobase', [process.env.APP_ENV === 'production' ? 'start' : 'dev'], options); } +process.on('SIGINT', async () => { + treeKill(process.pid, (error) => { + if (error) { + console.error(error); + } else { + console.log('所有子进程已被杀掉,应用程序即将退出'); + } + process.exit(); + }); +}); + const commonConfig = { stdio: 'inherit', }; @@ -150,6 +162,10 @@ module.exports = (cli) => { console.log('APP_BASE_URL:', process.env.APP_BASE_URL); } }); + process.on('SIGINT', () => { + console.log('SIGINT......'); + }); + e2e .command('test') .allowUnknownOption() diff --git a/yarn.lock b/yarn.lock index f6ac61e719..01a558f2cc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -24424,7 +24424,7 @@ transformation-matrix@^2.11.1: tree-kill@^1.2.2: version "1.2.2" - resolved "https://registry.npmmirror.com/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc" + resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc" integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A== trim-lines@^3.0.0: From b7948d5409fd03b66e7712530e9aff13dcc0051a Mon Sep 17 00:00:00 2001 From: jack zhang <1098626505@qq.com> Date: Wed, 24 Jan 2024 16:05:29 +0800 Subject: [PATCH 5/5] fix: remove tree-kill package to core/cli (#3429) * fix: remove tree-kill package to core/cli * fix: remove unuse code --- package.json | 1 - packages/core/cli/package.json | 1 + packages/core/cli/src/commands/e2e.js | 3 --- 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/package.json b/package.json index 5d571da2bf..546b0c1f83 100644 --- a/package.json +++ b/package.json @@ -79,7 +79,6 @@ "pretty-quick": "^3.1.0", "react": "^18.0.0", "react-dom": "^18.0.0", - "tree-kill": "^1.2.2", "typescript": "5.1.3" }, "volta": { diff --git a/packages/core/cli/package.json b/packages/core/cli/package.json index 288cb3732c..7a7530d389 100644 --- a/packages/core/cli/package.json +++ b/packages/core/cli/package.json @@ -18,6 +18,7 @@ "fast-glob": "^3.3.1", "fs-extra": "^11.1.1", "p-all": "3.0.0", + "tree-kill": "^1.2.2", "pm2": "^5.2.0", "portfinder": "^1.0.28", "serve": "^13.0.2", diff --git a/packages/core/cli/src/commands/e2e.js b/packages/core/cli/src/commands/e2e.js index 06127a317b..3f14c6507d 100644 --- a/packages/core/cli/src/commands/e2e.js +++ b/packages/core/cli/src/commands/e2e.js @@ -162,9 +162,6 @@ module.exports = (cli) => { console.log('APP_BASE_URL:', process.env.APP_BASE_URL); } }); - process.on('SIGINT', () => { - console.log('SIGINT......'); - }); e2e .command('test')