mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 13:46:45 +00:00
parent
de849b267c
commit
945bcb194e
@ -14,6 +14,7 @@ export const PluginManagerLink = () => {
|
|||||||
return (
|
return (
|
||||||
<Tooltip title={t('Plugin manager')}>
|
<Tooltip title={t('Plugin manager')}>
|
||||||
<Button
|
<Button
|
||||||
|
data-testid={'pm-button'}
|
||||||
icon={<ApiOutlined />}
|
icon={<ApiOutlined />}
|
||||||
title={t('Plugin manager')}
|
title={t('Plugin manager')}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
@ -77,6 +77,7 @@ export const Action: ComposedAction = observer(
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<SortableItem
|
<SortableItem
|
||||||
|
data-testid={`${fieldSchema['x-action'] || fieldSchema.name}-action`}
|
||||||
{...others}
|
{...others}
|
||||||
loading={field?.data?.loading}
|
loading={field?.data?.loading}
|
||||||
icon={icon ? <Icon type={icon} /> : null}
|
icon={icon ? <Icon type={icon} /> : null}
|
||||||
|
@ -1,14 +1,29 @@
|
|||||||
import { css } from '@emotion/css';
|
import { css } from '@emotion/css';
|
||||||
|
import { useFieldSchema } from '@formily/react';
|
||||||
import cls from 'classnames';
|
import cls from 'classnames';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { SortableItem } from '../../common';
|
import { SortableItem } from '../../common';
|
||||||
import { useDesigner, useProps } from '../../hooks';
|
import { useDesigner, useProps } from '../../hooks';
|
||||||
|
|
||||||
|
const getTestId = (schema) => {
|
||||||
|
const resource = schema?.['x-decorator-props']?.['resource'];
|
||||||
|
if (resource) {
|
||||||
|
return `${resource}-resource`;
|
||||||
|
}
|
||||||
|
const field = schema['x-collection-field'];
|
||||||
|
if (field) {
|
||||||
|
return `${field}-field`;
|
||||||
|
}
|
||||||
|
return `${schema.name}-item`;
|
||||||
|
};
|
||||||
|
|
||||||
export const BlockItem: React.FC<any> = (props) => {
|
export const BlockItem: React.FC<any> = (props) => {
|
||||||
const { className, children } = useProps(props);
|
const { className, children } = useProps(props);
|
||||||
const Designer = useDesigner();
|
const Designer = useDesigner();
|
||||||
|
const schema = useFieldSchema();
|
||||||
return (
|
return (
|
||||||
<SortableItem
|
<SortableItem
|
||||||
|
data-testid={getTestId(schema)}
|
||||||
className={cls(
|
className={cls(
|
||||||
'nb-block-item',
|
'nb-block-item',
|
||||||
className,
|
className,
|
||||||
|
@ -196,7 +196,7 @@ const HeaderMenu = ({
|
|||||||
key: 'x-designer-button',
|
key: 'x-designer-button',
|
||||||
disabled: true,
|
disabled: true,
|
||||||
style: { padding: '0 8px', order: 9999 },
|
style: { padding: '0 8px', order: 9999 },
|
||||||
label: render({ style: { background: 'none' } }),
|
label: render({ 'data-testid': 'add-menu-item-button-in-header', style: { background: 'none' } }),
|
||||||
notdelete: true,
|
notdelete: true,
|
||||||
};
|
};
|
||||||
const result = getMenuItems(() => {
|
const result = getMenuItems(() => {
|
||||||
@ -281,6 +281,7 @@ const SideMenu = ({
|
|||||||
key: 'x-designer-button',
|
key: 'x-designer-button',
|
||||||
disabled: true,
|
disabled: true,
|
||||||
label: render({
|
label: render({
|
||||||
|
'data-testid': 'add-menu-item-button-in-side',
|
||||||
insert: (s) => {
|
insert: (s) => {
|
||||||
const dn = createDesignable({
|
const dn = createDesignable({
|
||||||
t,
|
t,
|
||||||
|
@ -19,6 +19,7 @@ export const DesignableSwitch = () => {
|
|||||||
return (
|
return (
|
||||||
<Tooltip title={t('UI Editor')}>
|
<Tooltip title={t('UI Editor')}>
|
||||||
<Button
|
<Button
|
||||||
|
data-testid={'ui-editor-button'}
|
||||||
// selected={designable}
|
// selected={designable}
|
||||||
icon={<HighlightOutlined />}
|
icon={<HighlightOutlined />}
|
||||||
title={t('UI Editor')}
|
title={t('UI Editor')}
|
||||||
|
@ -123,6 +123,7 @@ export const DuplicateAction = observer((props: any) => {
|
|||||||
</a>
|
</a>
|
||||||
) : (
|
) : (
|
||||||
<Button
|
<Button
|
||||||
|
data-testid={'duplicate-action'}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
style={{
|
style={{
|
||||||
opacity: designable && field?.data?.hidden && 0.1,
|
opacity: designable && field?.data?.hidden && 0.1,
|
||||||
|
Loading…
Reference in New Issue
Block a user