mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-05-05 13:39:24 +08:00
fix: properly handle hidden field in tab routing (#6366)
* fix: format code and improve readability in routesTableSchema.tsx * fix: properly handle hidden field in tab routing
This commit is contained in:
parent
1c07aecdb4
commit
28500dd114
@ -411,6 +411,18 @@ export const createRoutesTableSchema = (collectionName: string, basename: string
|
||||
};
|
||||
}
|
||||
|
||||
const childrenObj: any = {};
|
||||
if (tabSchemaUid) {
|
||||
childrenObj.children = [
|
||||
{
|
||||
schemaUid: tabSchemaUid,
|
||||
type: NocoBaseDesktopRouteType.tabs,
|
||||
tabSchemaName,
|
||||
hidden: !form.values?.enableTabs,
|
||||
},
|
||||
];
|
||||
}
|
||||
|
||||
const res = await createRoute({
|
||||
..._.omit(form.values, ['href', 'params', 'url']),
|
||||
schemaUid:
|
||||
@ -419,18 +431,9 @@ export const createRoutesTableSchema = (collectionName: string, basename: string
|
||||
: menuSchemaUid,
|
||||
menuSchemaUid,
|
||||
options,
|
||||
...childrenObj,
|
||||
});
|
||||
|
||||
if (tabSchemaUid) {
|
||||
await createRoute({
|
||||
schemaUid: tabSchemaUid,
|
||||
parentId: res?.data?.data?.id,
|
||||
type: NocoBaseDesktopRouteType.tabs,
|
||||
tabSchemaName,
|
||||
hidden: true,
|
||||
});
|
||||
}
|
||||
|
||||
ctx.setVisible(false);
|
||||
actionCallback?.(res?.data?.data);
|
||||
await form.reset();
|
||||
@ -1207,6 +1210,7 @@ export const createRoutesTableSchema = (collectionName: string, basename: string
|
||||
const resource = useMemo(() => api.resource(collectionName), [api]);
|
||||
const { getDataBlockRequest } = useDataBlockRequestGetter();
|
||||
const { deleteRouteSchema } = useDeleteRouteSchema();
|
||||
const { refresh: refreshMenu } = useAllAccessDesktopRoutes();
|
||||
|
||||
return {
|
||||
onClick: async () => {
|
||||
@ -1217,6 +1221,7 @@ export const createRoutesTableSchema = (collectionName: string, basename: string
|
||||
})
|
||||
.then(() => {
|
||||
getDataBlockRequest().refresh();
|
||||
refreshMenu();
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
|
Loading…
x
Reference in New Issue
Block a user