Merge branch 'main' into T-2327-and-2771

This commit is contained in:
Zeke Zhang 2024-01-24 18:04:43 +08:00
commit 4e7c95f22b
7 changed files with 23 additions and 7 deletions

View File

@ -18,6 +18,7 @@
"fast-glob": "^3.3.1", "fast-glob": "^3.3.1",
"fs-extra": "^11.1.1", "fs-extra": "^11.1.1",
"p-all": "3.0.0", "p-all": "3.0.0",
"tree-kill": "^1.2.2",
"pm2": "^5.2.0", "pm2": "^5.2.0",
"portfinder": "^1.0.28", "portfinder": "^1.0.28",
"serve": "^13.0.2", "serve": "^13.0.2",

View File

@ -4,6 +4,7 @@ const { execSync } = require('node:child_process');
const axios = require('axios'); const axios = require('axios');
const { pTest } = require('./p-test'); const { pTest } = require('./p-test');
const os = require('os'); 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); 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 = { const commonConfig = {
stdio: 'inherit', stdio: 'inherit',
}; };
@ -150,6 +162,7 @@ module.exports = (cli) => {
console.log('APP_BASE_URL:', process.env.APP_BASE_URL); console.log('APP_BASE_URL:', process.env.APP_BASE_URL);
} }
}); });
e2e e2e
.command('test') .command('test')
.allowUnknownOption() .allowUnknownOption()

View File

@ -236,7 +236,7 @@ export const ACLActionProvider = (props) => {
} }
const params = parseAction(actionPath, { schema, recordPkValue }); const params = parseAction(actionPath, { schema, recordPkValue });
if (!params) { if (!params) {
return null; return <ACLActionParamsContext.Provider value={params}>{props.children}</ACLActionParamsContext.Provider>;
} }
//视图表无编辑权限时不显示 //视图表无编辑权限时不显示
if (editablePath.includes(actionPath) || editablePath.includes(actionPath?.split(':')[1])) { if (editablePath.includes(actionPath) || editablePath.includes(actionPath?.split(':')[1])) {

View File

@ -25,6 +25,7 @@ import { useA } from './hooks';
import { useGetAriaLabelOfAction } from './hooks/useGetAriaLabelOfAction'; import { useGetAriaLabelOfAction } from './hooks/useGetAriaLabelOfAction';
import { ComposedAction } from './types'; import { ComposedAction } from './types';
import { linkageAction } from './utils'; import { linkageAction } from './utils';
import { useACLActionParamsContext } from '../../../acl';
export const Action: ComposedAction = observer( export const Action: ComposedAction = observer(
(props: any) => { (props: any) => {
@ -44,6 +45,7 @@ export const Action: ComposedAction = observer(
disabled: propsDisabled, disabled: propsDisabled,
...others ...others
} = useProps(props); } = useProps(props);
const aclCtx = useACLActionParamsContext();
const { wrapSSR, componentCls, hashId } = useStyles(); const { wrapSSR, componentCls, hashId } = useStyles();
const { t } = useTranslation(); const { t } = useTranslation();
const [visible, setVisible] = useState(false); const [visible, setVisible] = useState(false);
@ -99,7 +101,7 @@ export const Action: ComposedAction = observer(
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
if (!disabled) { if (!disabled && aclCtx) {
const onOk = () => { const onOk = () => {
onClick?.(e); onClick?.(e);
setVisible(true); setVisible(true);
@ -122,12 +124,12 @@ export const Action: ComposedAction = observer(
const buttonStyle = useMemo(() => { const buttonStyle = useMemo(() => {
return { return {
...style, ...style,
opacity: designable && field?.data?.hidden && 0.1, opacity: designable && (field?.data?.hidden || !aclCtx) && 0.1,
}; };
}, [designable, field?.data?.hidden, style]); }, [designable, field?.data?.hidden, style]);
const renderButton = () => { const renderButton = () => {
if (!designable && field?.data?.hidden) { if (!designable && (field?.data?.hidden || !aclCtx)) {
return null; return null;
} }

View File

@ -35,7 +35,7 @@ export const InternalSubTable = observer(
}; };
return ( return (
<CollectionProvider name={options.target}> <CollectionProvider name={options.target}>
<ACLCollectionProvider actionPath={`${options.target}:${actionName}`}> <ACLCollectionProvider actionPath={`${options.target}:${actionName || 'view'}`}>
<FormLayout <FormLayout
className={css` className={css`
.ant-formily-item-bordered-none { .ant-formily-item-bordered-none {

View File

@ -78,7 +78,7 @@ async function createDevPluginSymLink(pluginName) {
if (await fsExists(link)) { if (await fsExists(link)) {
await unlink(link); await unlink(link);
} }
await symlink(resolve(packagePluginsPath, pluginName), link); await symlink(resolve(packagePluginsPath, pluginName), link, 'dir');
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }

View File

@ -24518,7 +24518,7 @@ transformation-matrix@^2.11.1:
tree-kill@^1.2.2: tree-kill@^1.2.2:
version "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== integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==
trim-lines@^3.0.0: trim-lines@^3.0.0: