diff --git a/packages/core/client/src/plugin-manager/PluginManager.tsx b/packages/core/client/src/plugin-manager/PluginManager.tsx index 86c177d78..8e06f89a3 100644 --- a/packages/core/client/src/plugin-manager/PluginManager.tsx +++ b/packages/core/client/src/plugin-manager/PluginManager.tsx @@ -1,8 +1,9 @@ import { MoreOutlined, SettingOutlined } from '@ant-design/icons'; -import { ConfigProvider, Menu, MenuItemProps, Tooltip } from 'antd'; +import { ConfigProvider, Menu, MenuItemProps, Spin, Tooltip } from 'antd'; import cls from 'classnames'; import { get } from 'lodash'; import React, { createContext, useContext } from 'react'; +import { useAPIClient, useRequest } from '../api-client'; import { PluginManagerContext } from './context'; export const usePrefixCls = ( @@ -107,3 +108,15 @@ PluginManager.Toolbar.Item = (props) => { ); }; + +export const RemotePluginManagerToolbar = () => { + const api = useAPIClient(); + const { data, loading } = useRequest({ + resource: 'plugins', + action: 'getPinned', + }); + if (loading) { + return ; + } + return ; +}; diff --git a/packages/core/client/src/route-switch/antd/admin-layout/index.tsx b/packages/core/client/src/route-switch/antd/admin-layout/index.tsx index d0c2e6118..b94df5727 100644 --- a/packages/core/client/src/route-switch/antd/admin-layout/index.tsx +++ b/packages/core/client/src/route-switch/antd/admin-layout/index.tsx @@ -9,8 +9,8 @@ import { CurrentUserProvider, findByUid, findMenuItem, - PluginManager, RemoteCollectionManagerProvider, + RemotePluginManagerToolbar, RemoteSchemaTemplateManagerProvider, SchemaComponent, useACLRoleContext, @@ -151,17 +151,7 @@ const InternalAdminLayout = (props: any) => {
- +
diff --git a/packages/plugins/client/src/plugin.ts b/packages/plugins/client/src/plugin.ts index 8b4ce1f35..d827ea51a 100644 --- a/packages/plugins/client/src/plugin.ts +++ b/packages/plugins/client/src/plugin.ts @@ -39,6 +39,24 @@ export class ClientPlugin extends Plugin { }, }, }); + this.app.resource({ + name: 'plugins', + actions: { + // TODO: 临时 + async getPinned(ctx, next) { + ctx.body = [ + { component: 'DesignableSwitch', pin: true }, + { component: 'CollectionManagerShortcut', pin: true }, + { component: 'ACLShortcut' }, + { component: 'WorkflowShortcut' }, + { component: 'SchemaTemplateShortcut' }, + { component: 'SystemSettingsShortcut' }, + { component: 'FileStorageShortcut' }, + ]; + await next(); + }, + }, + }); let root = this.options.dist; if (root && !root.startsWith('/')) { root = resolve(process.cwd(), root);