mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 23:24:03 +00:00
chore(admin): fix exports & settings links in CE (#18624)
* chore(admin): add index files to files list * chore: incl. additional deps with quickstart projects * chore: fix issue with menu links being undefined.
This commit is contained in:
parent
524af8055c
commit
c563f77eee
@ -1 +0,0 @@
|
||||
declare module '@strapi/generate-new';
|
||||
@ -1,4 +1,4 @@
|
||||
import { useState, useEffect, useCallback } from 'react';
|
||||
import { useState, useEffect, useCallback, useMemo } from 'react';
|
||||
|
||||
import { hasPermissions, useRBACProvider, useStrapiApp, useAppInfo } from '@strapi/helper-plugin';
|
||||
import { useSelector } from 'react-redux';
|
||||
@ -20,14 +20,17 @@ const useSettingsMenu = () => {
|
||||
const { settings } = useStrapiApp();
|
||||
const permissions = useSelector(selectAdminPermissions);
|
||||
|
||||
const { global: globalLinks, admin: adminLinks } = useEnterprise(
|
||||
SETTINGS_LINKS_CE,
|
||||
async () => (await import('../../../../ee/admin/src/constants')).SETTINGS_LINKS_EE,
|
||||
{
|
||||
combine(getCeLinks, getEeLinks) {
|
||||
const ceLinks = getCeLinks();
|
||||
const eeLinks = getEeLinks();
|
||||
/**
|
||||
* memoize the return value of this function to avoid re-computing it on every render
|
||||
* because it's used in an effect it ends up re-running recursively.
|
||||
*/
|
||||
const ceLinks = useMemo(() => SETTINGS_LINKS_CE(), []);
|
||||
|
||||
const { global: globalLinks, admin: adminLinks } = useEnterprise(
|
||||
ceLinks,
|
||||
async () => (await import('../../../../ee/admin/src/constants')).SETTINGS_LINKS_EE(),
|
||||
{
|
||||
combine(ceLinks, eeLinks) {
|
||||
return {
|
||||
admin: [...eeLinks.admin, ...ceLinks.admin],
|
||||
global: [...ceLinks.global, ...eeLinks.global],
|
||||
@ -72,24 +75,26 @@ const useSettingsMenu = () => {
|
||||
|
||||
const menuPermissions = await buildMenuPermissions(sections);
|
||||
|
||||
setData((prev) => ({
|
||||
...prev,
|
||||
isLoading: false,
|
||||
menu: sections.map((section, sectionIndex) => ({
|
||||
...section,
|
||||
links: section.links.map((link, linkIndex) => {
|
||||
const permission = menuPermissions.find(
|
||||
(permission) =>
|
||||
permission.sectionIndex === sectionIndex && permission.linkIndex === linkIndex
|
||||
);
|
||||
setData((prev) => {
|
||||
return {
|
||||
...prev,
|
||||
isLoading: false,
|
||||
menu: sections.map((section, sectionIndex) => ({
|
||||
...section,
|
||||
links: section.links.map((link, linkIndex) => {
|
||||
const permission = menuPermissions.find(
|
||||
(permission) =>
|
||||
permission.sectionIndex === sectionIndex && permission.linkIndex === linkIndex
|
||||
);
|
||||
|
||||
return {
|
||||
...link,
|
||||
isDisplayed: Boolean(permission.hasPermission),
|
||||
};
|
||||
}),
|
||||
})),
|
||||
}));
|
||||
return {
|
||||
...link,
|
||||
isDisplayed: Boolean(permission.hasPermission),
|
||||
};
|
||||
}),
|
||||
})),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
const { global, ...otherSections } = settings;
|
||||
|
||||
@ -52,7 +52,9 @@
|
||||
"strapi-server.js",
|
||||
"server",
|
||||
"ee/strapi-server.js",
|
||||
"ee/server/**"
|
||||
"ee/server/**",
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "pack-up build",
|
||||
|
||||
@ -14,7 +14,7 @@ export default async function createQuickStartProject(scope: Scope) {
|
||||
const configuration: Configuration = {
|
||||
client,
|
||||
connection: defaultConfigs[client],
|
||||
dependencies: clientDependencies({ client }),
|
||||
dependencies: { ...clientDependencies({ client }), ...scope.additionalsDependencies },
|
||||
};
|
||||
|
||||
await createProject(scope, configuration);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user