mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 05:29:26 +08:00
fix: support admin.xx static (#4304)
This commit is contained in:
parent
f2db1218b0
commit
9e04f405dc
@ -300,7 +300,7 @@ export class NocoBaseBuildInPlugin extends Plugin {
|
|||||||
});
|
});
|
||||||
this.router.add('admin.page', {
|
this.router.add('admin.page', {
|
||||||
path: '/admin/:name',
|
path: '/admin/:name',
|
||||||
Component: 'RouteSchemaComponent',
|
Component: 'AdminDynamicPage',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ import {
|
|||||||
RemoteCollectionManagerProvider,
|
RemoteCollectionManagerProvider,
|
||||||
RemoteSchemaTemplateManagerPlugin,
|
RemoteSchemaTemplateManagerPlugin,
|
||||||
RemoteSchemaTemplateManagerProvider,
|
RemoteSchemaTemplateManagerProvider,
|
||||||
|
RouteSchemaComponent,
|
||||||
SchemaComponent,
|
SchemaComponent,
|
||||||
findByUid,
|
findByUid,
|
||||||
findMenuItem,
|
findMenuItem,
|
||||||
@ -82,9 +83,11 @@ const MenuEditor = (props) => {
|
|||||||
const isMatchAdmin = useMatch('/admin');
|
const isMatchAdmin = useMatch('/admin');
|
||||||
const isMatchAdminName = useMatch('/admin/:name');
|
const isMatchAdminName = useMatch('/admin/:name');
|
||||||
const defaultSelectedUid = params.name;
|
const defaultSelectedUid = params.name;
|
||||||
|
const isDynamicPage = !!defaultSelectedUid;
|
||||||
const { sideMenuRef } = props;
|
const { sideMenuRef } = props;
|
||||||
const ctx = useACLRoleContext();
|
const ctx = useACLRoleContext();
|
||||||
const [current, setCurrent] = useState(null);
|
const [current, setCurrent] = useState(null);
|
||||||
|
|
||||||
const onSelect = ({ item }) => {
|
const onSelect = ({ item }) => {
|
||||||
const schema = item.props.schema;
|
const schema = item.props.schema;
|
||||||
setTitle(schema.title);
|
setTitle(schema.title);
|
||||||
@ -116,7 +119,7 @@ const MenuEditor = (props) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// url 不为 `/admin/xxx` 的情况,不做处理
|
// url 不为 `/admin/xxx` 的情况,不做处理
|
||||||
if (!isMatchAdminName) return;
|
if (!isMatchAdminName || !isDynamicPage) return;
|
||||||
|
|
||||||
// url 为 `admin/xxx` 的情况
|
// url 为 `admin/xxx` 的情况
|
||||||
const s = findByUid(schema, defaultSelectedUid);
|
const s = findByUid(schema, defaultSelectedUid);
|
||||||
@ -303,6 +306,11 @@ const AdminSideBar = ({ sideMenuRef }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const AdminDynamicPage = () => {
|
||||||
|
const params = useParams<{ name?: string }>();
|
||||||
|
return <RouteSchemaComponent schema={params.name} />;
|
||||||
|
};
|
||||||
|
|
||||||
export const InternalAdminLayout = () => {
|
export const InternalAdminLayout = () => {
|
||||||
const result = useSystemSettings();
|
const result = useSystemSettings();
|
||||||
const { token } = useToken();
|
const { token } = useToken();
|
||||||
@ -493,6 +501,6 @@ export class AdminLayoutPlugin extends Plugin {
|
|||||||
await this.app.pm.add(RemoteSchemaTemplateManagerPlugin);
|
await this.app.pm.add(RemoteSchemaTemplateManagerPlugin);
|
||||||
}
|
}
|
||||||
async load() {
|
async load() {
|
||||||
this.app.addComponents({ AdminLayout });
|
this.app.addComponents({ AdminLayout, AdminDynamicPage });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user