mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-07 22:49:26 +08:00
Merge branch 'main' into next
This commit is contained in:
commit
aa02e551ff
@ -20,6 +20,7 @@ import { useResourceActionContext } from '../collection-manager/ResourceActionPr
|
|||||||
import { useDataSourceKey } from '../data-source/data-source/DataSourceProvider';
|
import { useDataSourceKey } from '../data-source/data-source/DataSourceProvider';
|
||||||
import { useRecord } from '../record-provider';
|
import { useRecord } from '../record-provider';
|
||||||
import { SchemaComponentOptions, useDesignable } from '../schema-component';
|
import { SchemaComponentOptions, useDesignable } from '../schema-component';
|
||||||
|
import { CollectionNotAllowViewPlaceholder } from '../data-source';
|
||||||
|
|
||||||
import { useApp } from '../application';
|
import { useApp } from '../application';
|
||||||
|
|
||||||
@ -233,7 +234,7 @@ export const ACLCollectionProvider = (props) => {
|
|||||||
}
|
}
|
||||||
const params = parseAction(actionPath, { schema });
|
const params = parseAction(actionPath, { schema });
|
||||||
if (!params) {
|
if (!params) {
|
||||||
return null;
|
return <CollectionNotAllowViewPlaceholder />;
|
||||||
}
|
}
|
||||||
const [_, actionName] = actionPath.split(':');
|
const [_, actionName] = actionPath.split(':');
|
||||||
params.actionName = actionName;
|
params.actionName = actionName;
|
||||||
|
@ -16,6 +16,7 @@ import { useDataSourceManager } from '../data-source';
|
|||||||
import { DEFAULT_DATA_SOURCE_KEY } from '../../data-source/data-source/DataSourceManager';
|
import { DEFAULT_DATA_SOURCE_KEY } from '../../data-source/data-source/DataSourceManager';
|
||||||
import { useCollection } from '../collection';
|
import { useCollection } from '../collection';
|
||||||
import { BlockItemCard } from '../../schema-component/antd/block-item/BlockItemCard';
|
import { BlockItemCard } from '../../schema-component/antd/block-item/BlockItemCard';
|
||||||
|
import { AnyKindOfDictionary } from 'lodash';
|
||||||
|
|
||||||
export interface CollectionDeletedPlaceholderProps {
|
export interface CollectionDeletedPlaceholderProps {
|
||||||
type: 'Collection' | 'Field' | 'Data Source' | 'Block template';
|
type: 'Collection' | 'Field' | 'Data Source' | 'Block template';
|
||||||
@ -112,3 +113,47 @@ export const CollectionDeletedPlaceholder: FC<CollectionDeletedPlaceholderProps>
|
|||||||
|
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
export const CollectionNotAllowViewPlaceholder: FC<any> = () => {
|
||||||
|
const { designable } = useDesignable();
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const dataSource = useDataSource();
|
||||||
|
const compile = useCompile();
|
||||||
|
const collection = useCollection();
|
||||||
|
const dataSourceManager = useDataSourceManager();
|
||||||
|
const nameValue = useMemo(() => {
|
||||||
|
const dataSourcePrefix =
|
||||||
|
dataSourceManager?.getDataSources().length >= 1 && dataSource && dataSource.key !== DEFAULT_DATA_SOURCE_KEY
|
||||||
|
? `${compile(dataSource.displayName || dataSource.key)} > `
|
||||||
|
: '';
|
||||||
|
if (collection) {
|
||||||
|
return `${dataSourcePrefix}${collection.name}`;
|
||||||
|
}
|
||||||
|
const collectionPrefix = collection
|
||||||
|
? `${compile(collection.title) || collection.name || collection.tableName} > `
|
||||||
|
: '';
|
||||||
|
return `${dataSourcePrefix}${collectionPrefix}${collection.name}`;
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const messageValue = useMemo(() => {
|
||||||
|
return t(
|
||||||
|
`The current user only has the UI configuration permission, but don't have view permission for collection "{{name}}"`,
|
||||||
|
{
|
||||||
|
name: nameValue,
|
||||||
|
},
|
||||||
|
).replaceAll('>', '>');
|
||||||
|
}, [nameValue, t]);
|
||||||
|
|
||||||
|
if (designable) {
|
||||||
|
return (
|
||||||
|
<BlockItemCard>
|
||||||
|
<Result status="404" subTitle={messageValue} />
|
||||||
|
</BlockItemCard>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
@ -971,5 +971,6 @@
|
|||||||
"Use simple pagination mode": "使用简单分页模式",
|
"Use simple pagination mode": "使用简单分页模式",
|
||||||
"Sorry, the page you visited does not exist.": "抱歉,你访问的页面不存在。",
|
"Sorry, the page you visited does not exist.": "抱歉,你访问的页面不存在。",
|
||||||
"Set Template Engine": "设置模板引擎",
|
"Set Template Engine": "设置模板引擎",
|
||||||
"Skip getting the total number of table records during paging to speed up loading. It is recommended to enable this option for data tables with a large amount of data": "在分页时跳过获取表记录总数,以加快加载速度,建议对有大量数据的数据表开启此选项"
|
"Skip getting the total number of table records during paging to speed up loading. It is recommended to enable this option for data tables with a large amount of data": "在分页时跳过获取表记录总数,以加快加载速度,建议对有大量数据的数据表开启此选项",
|
||||||
|
"The current user only has the UI configuration permission, but don't have view permission for collection \"{{name}}\"": "当前用户只有 UI 配置权限,但没有数据表 \"{{name}}\" 查看权限。"
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ function UpdateMode() {
|
|||||||
title={t('Data will be updated')}
|
title={t('Data will be updated')}
|
||||||
options={[
|
options={[
|
||||||
{ label: t('Selected'), value: 'selected' },
|
{ label: t('Selected'), value: 'selected' },
|
||||||
{ label: t('All'), value: 'all' },
|
{ label: t('Entire collection', { ns: 'action-bulk-edit' }), value: 'all' },
|
||||||
]}
|
]}
|
||||||
value={fieldSchema?.['x-action-settings']?.['updateMode']}
|
value={fieldSchema?.['x-action-settings']?.['updateMode']}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
|
@ -21,7 +21,7 @@ test.describe('bulk edit action setting', () => {
|
|||||||
await expect(page.getByTitle('Data will be updated').getByText('Selected')).toBeVisible();
|
await expect(page.getByTitle('Data will be updated').getByText('Selected')).toBeVisible();
|
||||||
await page.getByRole('menuitem', { name: 'Data will be updated' }).click();
|
await page.getByRole('menuitem', { name: 'Data will be updated' }).click();
|
||||||
//切换为全部数据
|
//切换为全部数据
|
||||||
await page.getByRole('option', { name: 'All' }).click();
|
await page.getByRole('option', { name: 'Entire collection' }).click();
|
||||||
//配置更新规则
|
//配置更新规则
|
||||||
await page.getByLabel('Bulk edit').click();
|
await page.getByLabel('Bulk edit').click();
|
||||||
await page.getByLabel('schema-initializer-Grid-popup:bulkEdit:addBlock-general').hover();
|
await page.getByLabel('schema-initializer-Grid-popup:bulkEdit:addBlock-general').hover();
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
"Bulk edit": "批量编辑",
|
"Bulk edit": "批量编辑",
|
||||||
"Data will be updated": "更新的数据"
|
"Data will be updated": "更新的数据",
|
||||||
|
"Entire collection":"全表"
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ function UpdateMode() {
|
|||||||
title={t('Data will be updated')}
|
title={t('Data will be updated')}
|
||||||
options={[
|
options={[
|
||||||
{ label: t('Selected'), value: 'selected' },
|
{ label: t('Selected'), value: 'selected' },
|
||||||
{ label: t('All'), value: 'all' },
|
{ label: t('Entire collection', { ns: 'action-bulk-edit' }), value: 'all' },
|
||||||
]}
|
]}
|
||||||
value={fieldSchema?.['x-action-settings']?.['updateMode']}
|
value={fieldSchema?.['x-action-settings']?.['updateMode']}
|
||||||
onChange={(value) => {
|
onChange={(value) => {
|
||||||
|
@ -24,7 +24,7 @@ test.describe('data will be updated && Assign field values && after successful s
|
|||||||
await expect(page.getByTitle('Data will be updated').getByText('Selected')).toBeVisible();
|
await expect(page.getByTitle('Data will be updated').getByText('Selected')).toBeVisible();
|
||||||
await page.getByRole('menuitem', { name: 'Data will be updated' }).click();
|
await page.getByRole('menuitem', { name: 'Data will be updated' }).click();
|
||||||
//切换为全部数据
|
//切换为全部数据
|
||||||
await page.getByRole('option', { name: 'All' }).click();
|
await page.getByRole('option', { name: 'Entire collection' }).click();
|
||||||
//字段赋值
|
//字段赋值
|
||||||
await page.getByRole('menuitem', { name: 'Assign field values' }).click();
|
await page.getByRole('menuitem', { name: 'Assign field values' }).click();
|
||||||
await page.getByLabel('schema-initializer-Grid-assignFieldValuesForm:configureFields-general').click();
|
await page.getByLabel('schema-initializer-Grid-assignFieldValuesForm:configureFields-general').click();
|
||||||
|
@ -11,4 +11,5 @@ export default {
|
|||||||
'Bulk update': '批量更新',
|
'Bulk update': '批量更新',
|
||||||
'After successful bulk update': '批量成功更新后',
|
'After successful bulk update': '批量成功更新后',
|
||||||
'Please select the records to be updated': '请选择要更新的记录',
|
'Please select the records to be updated': '请选择要更新的记录',
|
||||||
|
"Entire collection":"全表"
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user