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 ee702a4467..82b6b3d071 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('all subprocesses were killed, exiting main process'); + } + process.exit(); + }); +}); + const commonConfig = { stdio: 'inherit', }; @@ -150,6 +162,7 @@ module.exports = (cli) => { console.log('APP_BASE_URL:', process.env.APP_BASE_URL); } }); + e2e .command('test') .allowUnknownOption() diff --git a/packages/core/client/src/acl/ACLProvider.tsx b/packages/core/client/src/acl/ACLProvider.tsx index b5f10cd71b..495af22fb3 100644 --- a/packages/core/client/src/acl/ACLProvider.tsx +++ b/packages/core/client/src/acl/ACLProvider.tsx @@ -236,7 +236,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; } 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 ( - +