diff --git a/packages/core/client/src/acl/ACLShortcut.tsx b/packages/core/client/src/acl/ACLShortcut.tsx index afd31b5c5..3be892b94 100644 --- a/packages/core/client/src/acl/ACLShortcut.tsx +++ b/packages/core/client/src/acl/ACLShortcut.tsx @@ -1,31 +1,10 @@ -import { LockOutlined } from '@ant-design/icons'; import { ISchema } from '@formily/react'; import { uid } from '@formily/shared'; import { Card } from 'antd'; -import React, { useState } from 'react'; -import { useTranslation } from 'react-i18next'; -import { useHistory } from 'react-router-dom'; -import { PluginManager } from '../plugin-manager'; -import { ActionContextProvider, SchemaComponent } from '../schema-component'; +import React from 'react'; +import { SchemaComponent } from '../schema-component'; import * as components from './Configuration'; -const schema: ISchema = { - type: 'object', - properties: { - [uid()]: { - 'x-component': 'Action.Drawer', - type: 'void', - title: '{{t("Roles & Permissions")}}', - properties: { - hello1: { - type: 'void', - 'x-component': 'RoleTable', - }, - }, - }, - }, -}; - const schema2: ISchema = { type: 'object', properties: { @@ -42,34 +21,3 @@ export const ACLPane = () => { ); }; - -export const ACLShortcut = () => { - const { t } = useTranslation(); - const history = useHistory(); - return ( - } - title={t('Roles & Permissions')} - onClick={() => { - history.push('/admin/settings/acl/roles'); - }} - /> - ); -}; - -export const ACLShortcut2 = () => { - const [visible, setVisible] = useState(false); - const { t } = useTranslation(); - return ( - - } - title={t('Roles & Permissions')} - onClick={() => { - setVisible(true); - }} - /> - - - ); -}; diff --git a/packages/core/client/src/application/demos/demo2/index.tsx b/packages/core/client/src/application/demos/demo2/index.tsx index 91688b295..589316e36 100644 --- a/packages/core/client/src/application/demos/demo2/index.tsx +++ b/packages/core/client/src/application/demos/demo2/index.tsx @@ -1,17 +1,14 @@ import { - ACLShortcut, AdminLayout, AntdConfigProvider, AntdSchemaComponentProvider, APIClientProvider, AuthLayout, CollectionManagerProvider, - CollectionManagerShortcut, compose, DesignableSwitch, DocumentTitleProvider, i18n, - PluginManagerProvider, RouteSchemaComponent, RouteSwitch, RouteSwitchProvider, @@ -20,7 +17,6 @@ import { SigninPage, SignupPage, SystemSettingsProvider, - SystemSettingsShortcut, useRequest, } from '@nocobase/client'; import { Spin } from 'antd'; @@ -36,10 +32,7 @@ const providers = [ [I18nextProvider, { i18n }], [AntdConfigProvider, { remoteLocale: true }], SystemSettingsProvider, - [ - PluginManagerProvider, - { components: { ACLShortcut, DesignableSwitch, CollectionManagerShortcut, SystemSettingsShortcut } }, - ], + [{ components: { DesignableSwitch } }], [SchemaComponentProvider, { components: { Link, NavLink } }], CollectionManagerProvider, AntdSchemaComponentProvider, diff --git a/packages/core/client/src/collection-manager/CollectionManagerShortcut.tsx b/packages/core/client/src/collection-manager/CollectionManagerShortcut.tsx index b7aafd3b6..325c51130 100644 --- a/packages/core/client/src/collection-manager/CollectionManagerShortcut.tsx +++ b/packages/core/client/src/collection-manager/CollectionManagerShortcut.tsx @@ -1,33 +1,28 @@ -import { DatabaseOutlined } from '@ant-design/icons'; import { ISchema } from '@formily/react'; import { uid } from '@formily/shared'; -import { Card } from 'antd'; -import React, { useState } from 'react'; -import { useTranslation } from 'react-i18next'; -import { useHistory } from 'react-router-dom'; -import { PluginManager } from '../plugin-manager'; -import { ActionContextProvider, SchemaComponent } from '../schema-component'; +import React from 'react'; +import { SchemaComponent } from '../schema-component'; import { + AddCategory, + AddCategoryAction, + AddCollection, + AddCollectionAction, AddCollectionField, AddFieldAction, ConfigurationTable, - EditFieldAction, - EditCollectionField, - OverridingFieldAction, - OverridingCollectionField, - ViewCollectionField, - ViewFieldAction, - AddCollection, - AddCollectionAction, - AddCategoryAction, - AddCategory, - EditCollection, - EditCollectionAction, ConfigurationTabs, EditCategory, EditCategoryAction, + EditCollection, + EditCollectionAction, + EditCollectionField, + EditFieldAction, + OverridingCollectionField, + OverridingFieldAction, SyncFieldsAction, SyncFieldsActionCom, + ViewCollectionField, + ViewFieldAction, } from './Configuration'; import { CollectionCategroriesProvider } from './CollectionManagerProvider'; @@ -90,48 +85,3 @@ export const CollectionManagerPane = () => { // ); }; - -export const CollectionManagerShortcut = () => { - const { t } = useTranslation(); - const history = useHistory(); - return ( - } - title={t('Collections & Fields')} - onClick={() => { - history.push('/admin/settings/collection-manager/collections'); - }} - /> - ); -}; - -export const CollectionManagerShortcut2 = () => { - const [visible, setVisible] = useState(false); - const { t } = useTranslation(); - return ( - - } - title={t('Collections & Fields')} - onClick={() => { - setVisible(true); - }} - /> - - - ); -}; diff --git a/packages/core/client/src/plugin-manager/PluginManager.tsx b/packages/core/client/src/plugin-manager/PluginManager.tsx deleted file mode 100644 index 262e26191..000000000 --- a/packages/core/client/src/plugin-manager/PluginManager.tsx +++ /dev/null @@ -1,157 +0,0 @@ -import { SettingOutlined } from '@ant-design/icons'; -import { css } from '@emotion/css'; -import { ConfigProvider, Menu, MenuItemProps, Tooltip } from 'antd'; -import cls from 'classnames'; -import { get } from 'lodash'; -import React, { createContext, useContext } from 'react'; -import { useTranslation } from 'react-i18next'; -import { useHistory } from 'react-router-dom'; -import { useACLRoleContext } from '../acl/ACLProvider'; -import { PluginManagerContext } from './context'; - -export const usePrefixCls = ( - tag?: string, - props?: { - prefixCls?: string; - }, -) => { - const { getPrefixCls } = useContext(ConfigProvider.ConfigContext); - return getPrefixCls(tag, props?.prefixCls); -}; - -type PluginManagerType = { - Toolbar?: React.FC & { - Item?: React.FC; - }; -}; - -export const PluginManager: PluginManagerType = () => null; - -const ToolbarItemContext = createContext(null); - -interface ToolbarProps { - items?: ToolbarItemProps[]; -} - -interface ToolbarItemProps { - component: string; - pin?: boolean; -} - -const splitItems = (items: ToolbarItemProps[]) => { - const pinned = []; - const unpinned = []; - for (const item of items) { - if (item.pin) { - pinned.push(item); - } else { - unpinned.push(item); - } - } - return [pinned, unpinned]; -}; - -PluginManager.Toolbar = (props: ToolbarProps) => { - const { components } = useContext(PluginManagerContext); - const { items = [] } = props; - const [pinned, unpinned] = splitItems(items); - const { t } = useTranslation(); - const history = useHistory(); - return ( -
- - {pinned.map((item, index) => { - const Action = get(components, item.component); - return ( - Action && ( - - - - ) - ); - })} - {unpinned.length > 0 && ( - }> - {unpinned.map((item, index) => { - const Action = get(components, item.component); - return ( - Action && ( - - - - ) - ); - })} - {unpinned.length > 0 && } - { - history.push('/admin/settings'); - }} - icon={} - > - {t('All plugin settings')} - - - )} - -
- ); -}; - -PluginManager.Toolbar.Item = (props) => { - const item = useContext(ToolbarItemContext); - const { selected, icon, title, subtitle, ...others } = props; - const prefix = usePrefixCls(); - const className = cls({ [`${prefix}-menu-item-selected`]: selected }); - if (item.pin) { - const subtitleComponent = subtitle && ( -
- {subtitle} -
- ); - - const titleComponent = ( -
-
{title}
- {subtitleComponent} -
- ); - - return title ? ( - - - {icon} - - - ) : ( - - {icon} - - ); - } - return ( - - {title} - - ); -}; - -export const RemotePluginManagerToolbar = () => { - const { allowAll, snippets } = useACLRoleContext(); - const getSnippetsAllow = (aclKey) => { - return allowAll || snippets?.includes(aclKey); - }; - const items = [ - { component: 'DesignableSwitch', pin: true, isAllow: getSnippetsAllow('ui.*') }, - { component: 'PluginManagerLink', pin: true, isAllow: getSnippetsAllow('pm') }, - { component: 'SettingsCenterDropdown', pin: true, isAllow: getSnippetsAllow('pm.*') }, - // ...data?.data, - ]; - return v.isAllow)} />; -}; diff --git a/packages/core/client/src/plugin-manager/PluginManagerProvider.tsx b/packages/core/client/src/plugin-manager/PluginManagerProvider.tsx deleted file mode 100644 index 35a28f5b2..000000000 --- a/packages/core/client/src/plugin-manager/PluginManagerProvider.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import React from 'react'; -import { PluginManagerContext } from './context'; - -export const PluginManagerProvider: React.FC = (props) => { - const { components, children } = props; - return {children}; -}; diff --git a/packages/core/client/src/plugin-manager/demos/demo1.tsx b/packages/core/client/src/plugin-manager/demos/demo1.tsx deleted file mode 100644 index 866c2f4a3..000000000 --- a/packages/core/client/src/plugin-manager/demos/demo1.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import React from 'react'; -import { Action, PluginManager, PluginManagerProvider, SchemaComponentProvider } from '@nocobase/client'; -import * as plugins from './plugins'; - -export default () => { - return ( - - - - - - ); -}; diff --git a/packages/core/client/src/plugin-manager/demos/plugins/index.tsx b/packages/core/client/src/plugin-manager/demos/plugins/index.tsx deleted file mode 100644 index 2a632ebf5..000000000 --- a/packages/core/client/src/plugin-manager/demos/plugins/index.tsx +++ /dev/null @@ -1,5 +0,0 @@ -export * from './plugin1'; -export * from './plugin2'; -export * from './plugin3'; -export * from './plugin4'; -export * from './plugin5'; diff --git a/packages/core/client/src/plugin-manager/demos/plugins/plugin1.tsx b/packages/core/client/src/plugin-manager/demos/plugins/plugin1.tsx deleted file mode 100644 index 054aa35c5..000000000 --- a/packages/core/client/src/plugin-manager/demos/plugins/plugin1.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import React from 'react'; -import { DatabaseOutlined } from '@ant-design/icons'; -import { PluginManager } from '@nocobase/client'; - -export const Plugin1 = () => null; -Plugin1.ToolbarItem = () => { - return ( - } - title={'Plugin1'} - onClick={() => { - alert('Plugin1'); - }} - /> - ); -}; diff --git a/packages/core/client/src/plugin-manager/demos/plugins/plugin2.tsx b/packages/core/client/src/plugin-manager/demos/plugins/plugin2.tsx deleted file mode 100644 index ff1795584..000000000 --- a/packages/core/client/src/plugin-manager/demos/plugins/plugin2.tsx +++ /dev/null @@ -1,65 +0,0 @@ -import { VerifiedOutlined } from '@ant-design/icons'; -import { ISchema, useForm } from '@formily/react'; -import { ActionContextProvider, PluginManager, SchemaComponent, useActionContext } from '@nocobase/client'; -import React, { useState } from 'react'; - -const useCloseAction = () => { - const { setVisible } = useActionContext(); - const form = useForm(); - return { - async run() { - setVisible(false); - form.submit((values) => { - console.log(values); - }); - }, - }; -}; - -const schema: ISchema = { - type: 'object', - properties: { - drawer1: { - 'x-component': 'Action.Drawer', - type: 'void', - title: 'Drawer Title', - properties: { - hello1: { - 'x-content': 'Hello', - title: 'T1', - }, - footer1: { - 'x-component': 'Action.Drawer.Footer', - type: 'void', - properties: { - close1: { - title: 'Close', - 'x-component': 'Action', - 'x-component-props': { - useAction: '{{ useCloseAction }}', - }, - }, - }, - }, - }, - }, - }, -}; - -export const Plugin2 = () => null; - -Plugin2.ToolbarItem = () => { - const [visible, setVisible] = useState(false); - return ( - - } - title={'Plugin2'} - onClick={() => { - setVisible(true); - }} - /> - - - ); -}; diff --git a/packages/core/client/src/plugin-manager/demos/plugins/plugin3.tsx b/packages/core/client/src/plugin-manager/demos/plugins/plugin3.tsx deleted file mode 100644 index 102d8aa5b..000000000 --- a/packages/core/client/src/plugin-manager/demos/plugins/plugin3.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { Menu } from 'antd'; -import React from 'react'; -import { SaveOutlined, KeyOutlined, DatabaseOutlined, VerifiedOutlined, NotificationOutlined } from '@ant-design/icons'; -import { PluginManager } from '@nocobase/client'; - -export const Plugin3 = () => null; -Plugin3.ToolbarItem = () => { - return ( - } - title={'Plugin3'} - onClick={() => { - alert('Plugin3'); - }} - /> - ); -}; diff --git a/packages/core/client/src/plugin-manager/demos/plugins/plugin4.tsx b/packages/core/client/src/plugin-manager/demos/plugins/plugin4.tsx deleted file mode 100644 index 4664805cd..000000000 --- a/packages/core/client/src/plugin-manager/demos/plugins/plugin4.tsx +++ /dev/null @@ -1,65 +0,0 @@ -import { VerifiedOutlined } from '@ant-design/icons'; -import { ISchema, useForm } from '@formily/react'; -import { ActionContextProvider, PluginManager, SchemaComponent, useActionContext } from '@nocobase/client'; -import React, { useState } from 'react'; - -const useCloseAction = () => { - const { setVisible } = useActionContext(); - const form = useForm(); - return { - async run() { - setVisible(false); - form.submit((values) => { - console.log(values); - }); - }, - }; -}; - -const schema: ISchema = { - type: 'object', - properties: { - drawer1: { - 'x-component': 'Action.Drawer', - type: 'void', - title: 'Drawer Title', - properties: { - hello1: { - 'x-content': 'Hello', - title: 'T1', - }, - footer1: { - 'x-component': 'Action.Drawer.Footer', - type: 'void', - properties: { - close1: { - title: 'Close', - 'x-component': 'Action', - 'x-component-props': { - useAction: '{{ useCloseAction }}', - }, - }, - }, - }, - }, - }, - }, -}; - -export const Plugin4 = () => null; - -Plugin4.ToolbarItem = () => { - const [visible, setVisible] = useState(false); - return ( - - } - title={'Plugin4'} - onClick={() => { - setVisible(true); - }} - /> - - - ); -}; diff --git a/packages/core/client/src/plugin-manager/demos/plugins/plugin5.tsx b/packages/core/client/src/plugin-manager/demos/plugins/plugin5.tsx deleted file mode 100644 index a9a671c94..000000000 --- a/packages/core/client/src/plugin-manager/demos/plugins/plugin5.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { Menu } from 'antd'; -import React from 'react'; -import { SaveOutlined, KeyOutlined, DatabaseOutlined, VerifiedOutlined, NotificationOutlined } from '@ant-design/icons'; -import { PluginManager } from '@nocobase/client'; - -export const Plugin5 = () => null; -Plugin5.ToolbarItem = () => { - return ( - } - title={'Plugin5'} - onClick={() => { - alert('Plugin5'); - }} - /> - ); -}; diff --git a/packages/core/client/src/plugin-manager/index.md b/packages/core/client/src/plugin-manager/index.md deleted file mode 100644 index 1923e7ab8..000000000 --- a/packages/core/client/src/plugin-manager/index.md +++ /dev/null @@ -1,59 +0,0 @@ ---- -nav: - path: /client -group: - path: /client ---- - -# PluginManager - -## PluginManagerProvider - -## PluginManager.Toolbar - -插件管理器的工具栏,用于便捷的展示所有插件,不常用的可折叠显示。 - - - -## PluginManager.Toolbar.Item - -工具栏项,各个插件都可以配置自己的 `PluginManager.Toolbar.Item` - -- `icon` pin 时,只显示 icon -- `title` pin 时,title 以 tooltip 的方式显示 - -最简单的示例 - -```tsx | pure -Plugin1.ToolbarItem = () => { - return ( - } - title={'Plugin1'} - onClick={() => { - alert('Plugin1'); - }} - /> - ); -}; -``` - -弹出抽屉 - -```tsx | pure -Plugin2.ToolbarItem = () => { - const [visible, setVisible] = useState(false); - return ( - - } - title={'Plugin2'} - onClick={() => { - setVisible(true); - }} - /> - - - ); -}; -``` diff --git a/packages/core/client/src/plugin-manager/index.ts b/packages/core/client/src/plugin-manager/index.ts index 808e509c7..33cfb8b15 100644 --- a/packages/core/client/src/plugin-manager/index.ts +++ b/packages/core/client/src/plugin-manager/index.ts @@ -1,4 +1,3 @@ -export * from './context'; export * from './PinnedPluginListProvider'; -export * from './PluginManager'; -export * from './PluginManagerProvider'; +export * from './context'; + diff --git a/packages/core/client/src/schema-templates/SchemaTemplateShortcut.tsx b/packages/core/client/src/schema-templates/SchemaTemplateShortcut.tsx deleted file mode 100644 index aeefb7fad..000000000 --- a/packages/core/client/src/schema-templates/SchemaTemplateShortcut.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { LayoutOutlined } from '@ant-design/icons'; -import React from 'react'; -import { useTranslation } from 'react-i18next'; -import { useHistory } from 'react-router-dom'; -import { PluginManager } from '../plugin-manager'; - -export const SchemaTemplateShortcut = () => { - const { t } = useTranslation(); - const history = useHistory(); - return ( - } - title={t('Block templates')} - onClick={() => { - history.push('/admin/settings/block-templates/list'); - }} - /> - ); -}; diff --git a/packages/core/client/src/schema-templates/index.ts b/packages/core/client/src/schema-templates/index.ts index 670f555b6..4681d96df 100644 --- a/packages/core/client/src/schema-templates/index.ts +++ b/packages/core/client/src/schema-templates/index.ts @@ -1,4 +1,4 @@ export * from './BlockTemplateDetails'; export * from './BlockTemplatePage'; export * from './SchemaTemplateManagerProvider'; -export * from './SchemaTemplateShortcut'; + diff --git a/packages/core/client/src/system-settings/SystemSettingsShortcut.tsx b/packages/core/client/src/system-settings/SystemSettingsShortcut.tsx index 6c0540819..3f0f6fdb3 100644 --- a/packages/core/client/src/system-settings/SystemSettingsShortcut.tsx +++ b/packages/core/client/src/system-settings/SystemSettingsShortcut.tsx @@ -1,15 +1,13 @@ -import { SettingOutlined } from '@ant-design/icons'; import { ISchema, useForm } from '@formily/react'; import { uid } from '@formily/shared'; import { Card, message } from 'antd'; import cloneDeep from 'lodash/cloneDeep'; -import React, { useState } from 'react'; +import React from 'react'; import { useTranslation } from 'react-i18next'; -import { useHistory } from 'react-router-dom'; import { useSystemSettings } from '.'; -import { i18n, PluginManager, useAPIClient, useRequest } from '..'; +import { i18n, useAPIClient, useRequest } from '..'; import locale from '../locale'; -import { ActionContextProvider, SchemaComponent, useActionContext } from '../schema-component'; +import { SchemaComponent, useActionContext } from '../schema-component'; const langs = Object.keys(locale).map((lang) => { return { @@ -281,38 +279,3 @@ export const SystemSettingsPane = () => { ); }; - -export const SystemSettingsShortcut = () => { - const { t } = useTranslation(); - const history = useHistory(); - return ( - } - title={t('System settings')} - onClick={() => { - history.push('/admin/settings/system-settings/system-settings'); - }} - /> - ); -}; - -export const SystemSettingsShortcut2 = () => { - const [visible, setVisible] = useState(false); - const { t } = useTranslation(); - return ( - - { - setVisible(true); - }} - icon={} - title={t('System settings')} - /> - - - ); -}; diff --git a/packages/core/client/src/system-settings/demos/demo1.tsx b/packages/core/client/src/system-settings/demos/demo1.tsx index f87efe475..a4bec09ff 100644 --- a/packages/core/client/src/system-settings/demos/demo1.tsx +++ b/packages/core/client/src/system-settings/demos/demo1.tsx @@ -2,11 +2,8 @@ import { AntdSchemaComponentProvider, APIClient, APIClientProvider, - PluginManager, - PluginManagerProvider, SchemaComponentProvider, SystemSettingsProvider, - SystemSettingsShortcut, useSystemSettings, } from '@nocobase/client'; import MockAdapter from 'axios-mock-adapter'; @@ -38,17 +35,7 @@ export default () => { - - - - + diff --git a/packages/plugins/client/src/server.ts b/packages/plugins/client/src/server.ts index 2f3ec7021..b407bb787 100644 --- a/packages/plugins/client/src/server.ts +++ b/packages/plugins/client/src/server.ts @@ -194,18 +194,6 @@ export class ClientPlugin extends Plugin { this.app.resource({ name: 'plugins', actions: { - // TODO: 临时 - async getPinned(ctx, next) { - ctx.body = [ - { component: 'CollectionManagerShortcut' }, - { component: 'ACLShortcut' }, - { component: 'WorkflowShortcut' }, - { component: 'SchemaTemplateShortcut' }, - { component: 'SystemSettingsShortcut' }, - { component: 'FileStorageShortcut' }, - ]; - await next(); - }, async getInfo(ctx, next) { const lang = await getLang(ctx); const { filterByTk } = ctx.action.params; diff --git a/packages/plugins/file-manager/src/client/FileStorageShortcut.tsx b/packages/plugins/file-manager/src/client/FileStorageShortcut.tsx deleted file mode 100644 index e2c07ee4b..000000000 --- a/packages/plugins/file-manager/src/client/FileStorageShortcut.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { FileOutlined } from '@ant-design/icons'; -import { uid } from '@formily/shared'; -import { ActionContextProvider, PluginManager, SchemaComponent } from '@nocobase/client'; -import React, { useState } from 'react'; -import { useTranslation } from 'react-i18next'; -import { storageSchema } from './schemas/storage'; -import { StorageOptions } from './StorageOptions'; - -const schema = { - type: 'object', - properties: { - [uid()]: { - 'x-component': 'Action.Drawer', - type: 'void', - title: '{{t("File manager")}}', - properties: { - storageSchema, - }, - }, - }, -}; - -export const FileStorageShortcut = () => { - const [visible, setVisible] = useState(false); - const { t } = useTranslation(); - return ( - - { - setVisible(true); - }} - icon={} - title={t('File manager')} - /> - - - ); -}; diff --git a/packages/plugins/file-manager/src/client/index.tsx b/packages/plugins/file-manager/src/client/index.tsx index 68ccab3c4..94e00e714 100644 --- a/packages/plugins/file-manager/src/client/index.tsx +++ b/packages/plugins/file-manager/src/client/index.tsx @@ -12,12 +12,11 @@ import { import { forEach } from '@nocobase/utils/client'; import React, { useContext } from 'react'; import { FileStoragePane } from './FileStorage'; -import { FileStorageShortcut } from './FileStorageShortcut'; import * as hooks from './hooks'; import * as initializers from './initializers'; -import * as templates from './templates'; -import { NAMESPACE } from './locale'; import { attachment } from './interfaces/attachment'; +import { NAMESPACE } from './locale'; +import * as templates from './templates'; // 注册之后就可以在 Crete collection 按钮中选择创建了 forEach(templates, (template, key: string) => { @@ -71,7 +70,6 @@ export default function (props) { value={{ components: { ...ctx?.components, - FileStorageShortcut, }, }} > diff --git a/packages/plugins/graph-collection-manager/src/client/GraphCollectionProvider.tsx b/packages/plugins/graph-collection-manager/src/client/GraphCollectionProvider.tsx index 6c25c77a1..469b83971 100644 --- a/packages/plugins/graph-collection-manager/src/client/GraphCollectionProvider.tsx +++ b/packages/plugins/graph-collection-manager/src/client/GraphCollectionProvider.tsx @@ -5,7 +5,7 @@ import { SettingsCenterProvider, } from '@nocobase/client'; import React, { useContext } from 'react'; -import { GraphCollectionPane, GraphCollectionShortcut } from './GraphCollectionShortcut'; +import { GraphCollectionPane } from './GraphCollectionShortcut'; import { useGCMTranslation } from './utils'; export const GraphCollectionProvider = React.memo((props) => { @@ -28,7 +28,6 @@ export const GraphCollectionProvider = React.memo((props) => { value={{ components: { ...ctx?.components, - GraphCollectionShortcut, }, }} > diff --git a/packages/plugins/graph-collection-manager/src/client/GraphCollectionShortcut.tsx b/packages/plugins/graph-collection-manager/src/client/GraphCollectionShortcut.tsx index 5bd6005e5..7c2286d7a 100644 --- a/packages/plugins/graph-collection-manager/src/client/GraphCollectionShortcut.tsx +++ b/packages/plugins/graph-collection-manager/src/client/GraphCollectionShortcut.tsx @@ -1,12 +1,10 @@ -import { DeleteOutlined, PartitionOutlined } from '@ant-design/icons'; +import { DeleteOutlined } from '@ant-design/icons'; import { css } from '@emotion/css'; import { uid } from '@formily/shared'; -import { PluginManager, SchemaComponent, useActionContext, useRequest } from '@nocobase/client'; +import { SchemaComponent, useActionContext, useRequest } from '@nocobase/client'; import React, { useEffect } from 'react'; -import { useHistory } from 'react-router-dom'; -import { useCreateActionAndRefreshCM } from './action-hooks'; import { GraphDrawPage } from './GraphDrawPage'; -import { useGCMTranslation } from './utils'; +import { useCreateActionAndRefreshCM } from './action-hooks'; const useCollectionValues = (options) => { const { visible } = useActionContext(); @@ -142,17 +140,3 @@ export const GraphCollectionPane = () => { ); }; - -export const GraphCollectionShortcut = () => { - const { t } = useGCMTranslation(); - const history = useHistory(); - return ( - } - title={t('Graph Collection')} - onClick={() => { - history.push('/admin/settings/graph/collections'); - }} - /> - ); -}; diff --git a/packages/plugins/verification/src/client/Shortcut.tsx b/packages/plugins/verification/src/client/Shortcut.tsx deleted file mode 100644 index faca2c388..000000000 --- a/packages/plugins/verification/src/client/Shortcut.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import React from 'react'; -import { useHistory } from 'react-router-dom'; -import { useTranslation } from 'react-i18next'; -import { CheckCircleOutlined } from '@ant-design/icons'; -import { PluginManager } from '@nocobase/client'; -import { NAMESPACE } from './locale'; - -export const Shortcut = () => { - const { t } = useTranslation(); - const history = useHistory(); - return ( - } - title={t('Verification', { ns: NAMESPACE })} - onClick={() => { - history.push('/admin/settings/verification/providers'); - }} - /> - ); -}; diff --git a/packages/plugins/workflow/src/client/WorkflowProvider.tsx b/packages/plugins/workflow/src/client/WorkflowProvider.tsx index f5474b0e9..3ed1b4be4 100644 --- a/packages/plugins/workflow/src/client/WorkflowProvider.tsx +++ b/packages/plugins/workflow/src/client/WorkflowProvider.tsx @@ -1,5 +1,3 @@ -import React, { useContext } from 'react'; -import { Card } from 'antd'; import { CollectionManagerContext, PluginManagerContext, @@ -7,24 +5,25 @@ import { SchemaComponent, SchemaComponentOptions, SettingsCenterProvider, - registerField, - useCollectionDataSource, + useCollectionDataSource } from '@nocobase/client'; +import { Card } from 'antd'; +import React, { useContext } from 'react'; -import { WorkflowPage } from './WorkflowPage'; -import { ExecutionPage } from './ExecutionPage'; -import { triggers } from './triggers'; -import { instructions } from './nodes'; -import { lang } from './locale'; -import { workflowSchema } from './schemas/workflows'; -import { WorkflowLink } from './WorkflowLink'; -import { ExecutionResourceProvider } from './ExecutionResourceProvider'; import { ExecutionLink } from './ExecutionLink'; +import { ExecutionPage } from './ExecutionPage'; +import { ExecutionResourceProvider } from './ExecutionResourceProvider'; +import { WorkflowLink } from './WorkflowLink'; +import { WorkflowPage } from './WorkflowPage'; +import { DynamicExpression } from './components/DynamicExpression'; import OpenDrawer from './components/OpenDrawer'; +import expressionField from './interfaces/expression'; +import { lang } from './locale'; +import { instructions } from './nodes'; import { WorkflowTodo } from './nodes/manual/WorkflowTodo'; import { WorkflowTodoBlockInitializer } from './nodes/manual/WorkflowTodoBlockInitializer'; -import { DynamicExpression } from './components/DynamicExpression'; -import expressionField from './interfaces/expression'; +import { workflowSchema } from './schemas/workflows'; +import { triggers } from './triggers'; // registerField(expressionField.group, 'expression', expressionField); @@ -87,7 +86,6 @@ export const WorkflowProvider = (props) => { value={{ components: { ...pmCtx?.components, - // WorkflowShortcut, }, }} > diff --git a/packages/plugins/workflow/src/client/WorkflowShortcut.tsx b/packages/plugins/workflow/src/client/WorkflowShortcut.tsx deleted file mode 100644 index 83e3447c9..000000000 --- a/packages/plugins/workflow/src/client/WorkflowShortcut.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import React from 'react'; -import { PartitionOutlined } from '@ant-design/icons'; -import { useHistory } from 'react-router-dom'; - -import { PluginManager } from '@nocobase/client'; - -import { lang } from './locale'; - -export const WorkflowShortcut = () => { - const history = useHistory(); - return ( - } - title={lang('Workflow')} - onClick={() => { - history.push('/admin/settings/workflow/workflows'); - }} - /> - ); -}; diff --git a/packages/samples/shop-i18n/src/client/index.tsx b/packages/samples/shop-i18n/src/client/index.tsx index d72911be4..12dd8f5d0 100644 --- a/packages/samples/shop-i18n/src/client/index.tsx +++ b/packages/samples/shop-i18n/src/client/index.tsx @@ -1,15 +1,7 @@ -import { ShopOutlined } from '@ant-design/icons'; -import { - i18n, - PluginManager, - PluginManagerContext, - RouteSwitchContext, - SettingsCenterProvider, -} from '@nocobase/client'; +import { i18n, PluginManagerContext, RouteSwitchContext, SettingsCenterProvider } from '@nocobase/client'; import { Select } from 'antd'; import React, { useContext } from 'react'; import { useTranslation } from 'react-i18next'; -import { useHistory } from 'react-router-dom'; const ns = '@nocobase/plugin-sample-shop-i18n'; @@ -44,21 +36,6 @@ function OrderStatusSelect() { ); } -export const ShopShortcut = () => { - const { t } = useTranslation(); - const history = useHistory(); - return ( - } - title={t('Workflow')} - onClick={() => { - history.push('/admin/settings/workflow/workflows'); - }} - /> - ); -}; - const ShopI18n = React.memo((props) => { const ctx = useContext(PluginManagerContext); const { routes, components, ...others } = useContext(RouteSwitchContext); @@ -82,7 +59,6 @@ const ShopI18n = React.memo((props) => { value={{ components: { ...ctx?.components, - ShopShortcut, }, }} >