mirror of
https://github.com/strapi/strapi.git
synced 2025-09-27 09:25:46 +00:00
Merge pull request #10544 from strapi/cm/change-routing
[WIP] Change content manager routing
This commit is contained in:
commit
dbfbca533b
@ -66,9 +66,7 @@ class StrapiApp {
|
|||||||
`Expected link.to to be a string instead received ${typeof link.to}`
|
`Expected link.to to be a string instead received ${typeof link.to}`
|
||||||
);
|
);
|
||||||
invariant(
|
invariant(
|
||||||
['/plugins/content-manager', '/plugins/content-type-builder', '/plugins/upload'].includes(
|
['/plugins/content-type-builder', '/plugins/upload'].includes(link.to),
|
||||||
link.to
|
|
||||||
),
|
|
||||||
'This method is not available for your plugin'
|
'This method is not available for your plugin'
|
||||||
);
|
);
|
||||||
invariant(
|
invariant(
|
||||||
|
@ -15,7 +15,7 @@ const LeftMenu = ({ generalSectionLinks, pluginsSectionLinks }) => {
|
|||||||
<LinksContainer>
|
<LinksContainer>
|
||||||
<BaselineAlignment top size="16px" />
|
<BaselineAlignment top size="16px" />
|
||||||
<LeftMenuLink
|
<LeftMenuLink
|
||||||
to="/plugins/content-manager"
|
to="/content-manager"
|
||||||
icon="book-open"
|
icon="book-open"
|
||||||
intlLabel={{
|
intlLabel={{
|
||||||
id: `content-manager.plugin.name`,
|
id: `content-manager.plugin.name`,
|
||||||
|
@ -267,8 +267,7 @@ const CollectionTypeFormWrapper = ({ allLayoutData, children, slug, id, origin }
|
|||||||
// Enable navigation and remove loaders
|
// Enable navigation and remove loaders
|
||||||
dispatch(setStatus('resolved'));
|
dispatch(setStatus('resolved'));
|
||||||
|
|
||||||
// FIXME when updating the routing
|
replace(`/content-manager/collectionType/${slug}/${data.id}${rawQuery}`);
|
||||||
replace(`/plugins/content-manager/collectionType/${slug}/${data.id}${rawQuery}`);
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
trackUsageRef.current('didNotCreateEntry', { error: err, trackerProperty });
|
trackUsageRef.current('didNotCreateEntry', { error: err, trackerProperty });
|
||||||
displayErrors(err);
|
displayErrors(err);
|
||||||
|
@ -140,8 +140,8 @@ const DraggedField = forwardRef(
|
|||||||
<Link
|
<Link
|
||||||
onClick={e => {
|
onClick={e => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
// FIXME when changing the routing
|
|
||||||
goTo(`/plugins/content-manager/components/${componentUid}/configurations/edit`);
|
goTo(`/content-manager/components/${componentUid}/configurations/edit`);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<FontAwesomeIcon icon="cog" />
|
<FontAwesomeIcon icon="cog" />
|
||||||
|
@ -45,8 +45,7 @@ const DynamicComponent = ({ componentUid, friendlyName, icon, setIsOverDynamicZo
|
|||||||
isOver={isOver}
|
isOver={isOver}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (!isLoading && canAccess) {
|
if (!isLoading && canAccess) {
|
||||||
// FIXME when changing the routing
|
push(`/content-manager/components/${componentUid}/configurations/edit`);
|
||||||
push(`/plugins/content-manager/components/${componentUid}/configurations/edit`);
|
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
onMouseEvent={handleMouseEvent}
|
onMouseEvent={handleMouseEvent}
|
||||||
|
@ -19,8 +19,7 @@ function ListItem({
|
|||||||
searchToPersist,
|
searchToPersist,
|
||||||
targetModel,
|
targetModel,
|
||||||
}) {
|
}) {
|
||||||
// FIXME when changing the routing
|
const to = `/content-manager/collectionType/${targetModel}/${data.id}`;
|
||||||
const to = `/plugins/content-manager/collectionType/${targetModel}/${data.id}`;
|
|
||||||
|
|
||||||
const hasDraftAndPublish = has(data, 'published_at');
|
const hasDraftAndPublish = has(data, 'published_at');
|
||||||
|
|
||||||
|
@ -230,8 +230,7 @@ function SelectWrapper({
|
|||||||
setIsOpen(true);
|
setIsOpen(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
// FIXME when changing the routing
|
const to = `/content-manager/collectionType/${targetModel}/${value ? value.id : null}`;
|
||||||
const to = `/plugins/content-manager/collectionType/${targetModel}/${value ? value.id : null}`;
|
|
||||||
|
|
||||||
const searchToPersist = stringify(buildParams(query, paramsToKeep), { encode: false });
|
const searchToPersist = stringify(buildParams(query, paramsToKeep), { encode: false });
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ const SettingsViewWrapper = ({
|
|||||||
)}${pluginsQueryParams ? `&${pluginsQueryParams}` : ''}`;
|
)}${pluginsQueryParams ? `&${pluginsQueryParams}` : ''}`;
|
||||||
|
|
||||||
// FIXME when changing the routing
|
// FIXME when changing the routing
|
||||||
history.replace(`/plugins/content-manager/${kind}/${uid}?${goBackSearch}`);
|
history.replace(`/content-manager/${kind}/${uid}?${goBackSearch}`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ describe('CONTENT MANAGER | Containers | CollectionTypeFormWrapper | selectors',
|
|||||||
name: 'application::address.address',
|
name: 'application::address.address',
|
||||||
search: 'page=1&pageSize=50&_sort=city:ASC&plugins[i18n][locale]=fr',
|
search: 'page=1&pageSize=50&_sort=city:ASC&plugins[i18n][locale]=fr',
|
||||||
title: 'Addresses',
|
title: 'Addresses',
|
||||||
to: '/plugins/content-manager/collectionType/application::address.address',
|
to: '/content-manager/collectionType/application::address.address',
|
||||||
uid: 'application::address.address',
|
uid: 'application::address.address',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -25,7 +25,7 @@ describe('CONTENT MANAGER | Containers | CollectionTypeFormWrapper | selectors',
|
|||||||
name: 'application::category.category',
|
name: 'application::category.category',
|
||||||
search: 'page=1&pageSize=50&_sort=city:ASC&plugins[i18n][locale]=fr',
|
search: 'page=1&pageSize=50&_sort=city:ASC&plugins[i18n][locale]=fr',
|
||||||
title: 'Categories',
|
title: 'Categories',
|
||||||
to: '/plugins/content-manager/collectionType/application::category.category',
|
to: '/content-manager/collectionType/application::category.category',
|
||||||
uid: 'application::category.category',
|
uid: 'application::category.category',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -38,7 +38,7 @@ describe('CONTENT MANAGER | Containers | CollectionTypeFormWrapper | selectors',
|
|||||||
name: 'application::address.address',
|
name: 'application::address.address',
|
||||||
search: 'page=1&pageSize=50&_sort=city:ASC&plugins[i18n][locale]=fr',
|
search: 'page=1&pageSize=50&_sort=city:ASC&plugins[i18n][locale]=fr',
|
||||||
title: 'Addresses',
|
title: 'Addresses',
|
||||||
to: '/plugins/content-manager/collectionType/application::address.address',
|
to: '/content-manager/collectionType/application::address.address',
|
||||||
uid: 'application::address.address',
|
uid: 'application::address.address',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -46,7 +46,7 @@ describe('CONTENT MANAGER | Containers | CollectionTypeFormWrapper | selectors',
|
|||||||
name: 'application::category.category',
|
name: 'application::category.category',
|
||||||
search: 'page=1&pageSize=50&_sort=city:ASC&plugins[i18n][locale]=fr',
|
search: 'page=1&pageSize=50&_sort=city:ASC&plugins[i18n][locale]=fr',
|
||||||
title: 'Categories',
|
title: 'Categories',
|
||||||
to: '/plugins/content-manager/collectionType/application::category.category',
|
to: '/content-manager/collectionType/application::category.category',
|
||||||
uid: 'application::category.category',
|
uid: 'application::category.category',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
@ -16,7 +16,7 @@ import useModels from './useModels';
|
|||||||
const cmPermissions = permissions.contentManager;
|
const cmPermissions = permissions.contentManager;
|
||||||
|
|
||||||
const App = () => {
|
const App = () => {
|
||||||
const contentTypeMatch = useRouteMatch(`/plugins/content-manager/:kind/:uid`);
|
const contentTypeMatch = useRouteMatch(`/content-manager/:kind/:uid`);
|
||||||
const { status, collectionTypeLinks, singleTypeLinks, models, refetchData } = useModels();
|
const { status, collectionTypeLinks, singleTypeLinks, models, refetchData } = useModels();
|
||||||
const authorisedModels = [...collectionTypeLinks, ...singleTypeLinks];
|
const authorisedModels = [...collectionTypeLinks, ...singleTypeLinks];
|
||||||
const { pathname } = useLocation();
|
const { pathname } = useLocation();
|
||||||
@ -27,17 +27,13 @@ const App = () => {
|
|||||||
|
|
||||||
// Redirect the user to the 403 page
|
// Redirect the user to the 403 page
|
||||||
// FIXME when changing the routing
|
// FIXME when changing the routing
|
||||||
if (
|
if (authorisedModels.length === 0 && models.length > 0 && pathname !== '/content-manager/403') {
|
||||||
authorisedModels.length === 0 &&
|
return <Redirect to="/content-manager/403" />;
|
||||||
models.length > 0 &&
|
|
||||||
pathname !== '/plugins/content-manager/403'
|
|
||||||
) {
|
|
||||||
return <Redirect to="/plugins/content-manager/403" />;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redirect the user to the create content type page
|
// Redirect the user to the create content type page
|
||||||
if (models.length === 0 && pathname !== '/plugins/content-manager/no-content-types') {
|
if (models.length === 0 && pathname !== '/content-manager/no-content-types') {
|
||||||
return <Redirect to="/plugins/content-manager/no-content-types" />;
|
return <Redirect to="/content-manager/no-content-types" />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!contentTypeMatch && authorisedModels.length > 0) {
|
if (!contentTypeMatch && authorisedModels.length > 0) {
|
||||||
@ -59,26 +55,26 @@ const App = () => {
|
|||||||
<LeftMenu />
|
<LeftMenu />
|
||||||
<div className="col-md-9" style={{ padding: 0 }}>
|
<div className="col-md-9" style={{ padding: 0 }}>
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route path="/plugins/content-manager/components/:uid/configurations/edit">
|
<Route path="/content-manager/components/:uid/configurations/edit">
|
||||||
<CheckPagePermissions permissions={cmPermissions.componentsConfigurations}>
|
<CheckPagePermissions permissions={cmPermissions.componentsConfigurations}>
|
||||||
<ComponentSettingsView />
|
<ComponentSettingsView />
|
||||||
</CheckPagePermissions>
|
</CheckPagePermissions>
|
||||||
</Route>
|
</Route>
|
||||||
<Route
|
<Route
|
||||||
path="/plugins/content-manager/collectionType/:slug"
|
path="/content-manager/collectionType/:slug"
|
||||||
component={CollectionTypeRecursivePath}
|
component={CollectionTypeRecursivePath}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/plugins/content-manager/singleType/:slug"
|
path="/content-manager/singleType/:slug"
|
||||||
component={SingleTypeRecursivePath}
|
component={SingleTypeRecursivePath}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* These pages must be defined */}
|
{/* These pages must be defined */}
|
||||||
<Route
|
<Route
|
||||||
path="/plugins/content-manager/403"
|
path="/content-manager/403"
|
||||||
render={() => <div>TBD No rights to see the content types</div>}
|
render={() => <div>TBD No rights to see the content types</div>}
|
||||||
/>
|
/>
|
||||||
<Route path="/plugins/content-manager/no-content-types">
|
<Route path="/content-manager/no-content-types">
|
||||||
<NoContentType />
|
<NoContentType />
|
||||||
</Route>
|
</Route>
|
||||||
<Route path="" component={NotFound} />
|
<Route path="" component={NotFound} />
|
||||||
|
@ -9,8 +9,6 @@ import ContentManagerApp from '..';
|
|||||||
import cmReducers from '../../../../reducers';
|
import cmReducers from '../../../../reducers';
|
||||||
import useModels from '../useModels';
|
import useModels from '../useModels';
|
||||||
|
|
||||||
const pluginId = 'content-manager';
|
|
||||||
|
|
||||||
jest.mock('../useModels', () =>
|
jest.mock('../useModels', () =>
|
||||||
jest.fn(() => {
|
jest.fn(() => {
|
||||||
return {};
|
return {};
|
||||||
@ -43,7 +41,7 @@ describe('Content manager | App | main', () => {
|
|||||||
uid: 'category',
|
uid: 'category',
|
||||||
title: 'Categories',
|
title: 'Categories',
|
||||||
name: 'category',
|
name: 'category',
|
||||||
to: `/plugins/${pluginId}/collectionType/category`,
|
to: '/content-manager/collectionType/category',
|
||||||
kind: 'collectionType',
|
kind: 'collectionType',
|
||||||
isDisplayed: true,
|
isDisplayed: true,
|
||||||
permissions: [
|
permissions: [
|
||||||
@ -83,9 +81,9 @@ describe('Content manager | App | main', () => {
|
|||||||
};
|
};
|
||||||
useModels.mockImplementation(() => contentManagerState);
|
useModels.mockImplementation(() => contentManagerState);
|
||||||
const rootReducer = combineReducers(cmReducers);
|
const rootReducer = combineReducers(cmReducers);
|
||||||
const store = createStore(rootReducer, { [`${pluginId}_app`]: contentManagerState });
|
const store = createStore(rootReducer, { 'content-manager_app': contentManagerState });
|
||||||
const history = createMemoryHistory();
|
const history = createMemoryHistory();
|
||||||
history.push(`/plugins/${pluginId}`);
|
history.push('/content-manager');
|
||||||
|
|
||||||
const { container } = render(
|
const { container } = render(
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
@ -97,7 +95,7 @@ describe('Content manager | App | main', () => {
|
|||||||
|
|
||||||
expect(screen.getByText('Home page')).toBeVisible();
|
expect(screen.getByText('Home page')).toBeVisible();
|
||||||
expect(screen.getByText('Categories')).toBeVisible();
|
expect(screen.getByText('Categories')).toBeVisible();
|
||||||
expect(history.location.pathname).toEqual(`/plugins/${pluginId}/collectionType/category`);
|
expect(history.location.pathname).toEqual('/content-manager/collectionType/category');
|
||||||
expect(container.firstChild).toMatchInlineSnapshot(`
|
expect(container.firstChild).toMatchInlineSnapshot(`
|
||||||
.c2 {
|
.c2 {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
@ -344,7 +342,7 @@ describe('Content manager | App | main', () => {
|
|||||||
<a
|
<a
|
||||||
aria-current="page"
|
aria-current="page"
|
||||||
class="active"
|
class="active"
|
||||||
href="/plugins/content-manager/collectionType/category"
|
href="/content-manager/collectionType/category"
|
||||||
>
|
>
|
||||||
<p>
|
<p>
|
||||||
Categories
|
Categories
|
||||||
@ -416,7 +414,7 @@ describe('Content manager | App | main', () => {
|
|||||||
uid: 'homepage',
|
uid: 'homepage',
|
||||||
title: 'Home page',
|
title: 'Home page',
|
||||||
name: 'homepage',
|
name: 'homepage',
|
||||||
to: `/plugins/${pluginId}/homepage`,
|
to: '/content-manager/homepage',
|
||||||
kind: 'singleType',
|
kind: 'singleType',
|
||||||
isDisplayed: true,
|
isDisplayed: true,
|
||||||
permissions: [
|
permissions: [
|
||||||
@ -440,9 +438,9 @@ describe('Content manager | App | main', () => {
|
|||||||
};
|
};
|
||||||
useModels.mockImplementation(() => contentManagerState);
|
useModels.mockImplementation(() => contentManagerState);
|
||||||
const rootReducer = combineReducers(cmReducers);
|
const rootReducer = combineReducers(cmReducers);
|
||||||
const store = createStore(rootReducer, { [`${pluginId}_app`]: contentManagerState });
|
const store = createStore(rootReducer, { 'content-manager_app': contentManagerState });
|
||||||
const history = createMemoryHistory();
|
const history = createMemoryHistory();
|
||||||
history.push(`/plugins/${pluginId}`);
|
history.push('/content-manager');
|
||||||
|
|
||||||
render(
|
render(
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
@ -452,7 +450,7 @@ describe('Content manager | App | main', () => {
|
|||||||
</Provider>
|
</Provider>
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(history.location.pathname).toEqual(`/plugins/${pluginId}/homepage`);
|
expect(history.location.pathname).toEqual('/content-manager/homepage');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should redirect to 403 page', () => {
|
it('should redirect to 403 page', () => {
|
||||||
@ -478,8 +476,8 @@ describe('Content manager | App | main', () => {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
const rootReducer = combineReducers(cmReducers);
|
const rootReducer = combineReducers(cmReducers);
|
||||||
const store = createStore(rootReducer, { [`${pluginId}_app`]: contentManagerState });
|
const store = createStore(rootReducer, { 'content-manager_app': contentManagerState });
|
||||||
history.push(`/plugins/${pluginId}/collectionType/category`);
|
history.push('/content-manager/collectionType/category');
|
||||||
|
|
||||||
render(
|
render(
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
@ -489,7 +487,7 @@ describe('Content manager | App | main', () => {
|
|||||||
</Provider>
|
</Provider>
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(history.location.pathname).toEqual(`/plugins/${pluginId}/403`);
|
expect(history.location.pathname).toEqual('/content-manager/403');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should redirect to the no-content-types page', () => {
|
it('should redirect to the no-content-types page', () => {
|
||||||
@ -508,8 +506,8 @@ describe('Content manager | App | main', () => {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
const rootReducer = combineReducers(cmReducers);
|
const rootReducer = combineReducers(cmReducers);
|
||||||
const store = createStore(rootReducer, { [`${pluginId}_app`]: contentManagerState });
|
const store = createStore(rootReducer, { 'content-manager_app': contentManagerState });
|
||||||
history.push(`/plugins/${pluginId}/collectionType/category`);
|
history.push('/content-manager/collectionType/category');
|
||||||
|
|
||||||
render(
|
render(
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
@ -519,6 +517,6 @@ describe('Content manager | App | main', () => {
|
|||||||
</Provider>
|
</Provider>
|
||||||
);
|
);
|
||||||
|
|
||||||
expect(history.location.pathname).toEqual(`/plugins/${pluginId}/no-content-types`);
|
expect(history.location.pathname).toEqual('/content-manager/no-content-types');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -34,7 +34,7 @@ const generateLinks = (links, type, configurations = []) => {
|
|||||||
search,
|
search,
|
||||||
kind: link.kind,
|
kind: link.kind,
|
||||||
title: link.info.label,
|
title: link.info.label,
|
||||||
to: `/plugins/content-manager/${link.kind}/${link.uid}`,
|
to: `/content-manager/${link.kind}/${link.uid}`,
|
||||||
uid: link.uid,
|
uid: link.uid,
|
||||||
// Used for the list item key in the helper plugin
|
// Used for the list item key in the helper plugin
|
||||||
name: link.uid,
|
name: link.uid,
|
||||||
|
@ -46,7 +46,7 @@ describe('ADMIN | LeftMenu | utils', () => {
|
|||||||
|
|
||||||
const expected = [
|
const expected = [
|
||||||
{
|
{
|
||||||
to: '/plugins/content-manager/collectionType/application::address.address',
|
to: '/content-manager/collectionType/application::address.address',
|
||||||
isDisplayed: true,
|
isDisplayed: true,
|
||||||
search: `page=1&pageSize=2&_sort=name:ASC`,
|
search: `page=1&pageSize=2&_sort=name:ASC`,
|
||||||
permissions: [
|
permissions: [
|
||||||
@ -65,7 +65,7 @@ describe('ADMIN | LeftMenu | utils', () => {
|
|||||||
name: 'application::address.address',
|
name: 'application::address.address',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
to: '/plugins/content-manager/singleType/application::test1.test1',
|
to: '/content-manager/singleType/application::test1.test1',
|
||||||
isDisplayed: true,
|
isDisplayed: true,
|
||||||
search: null,
|
search: null,
|
||||||
kind: 'singleType',
|
kind: 'singleType',
|
||||||
@ -125,7 +125,7 @@ describe('ADMIN | LeftMenu | utils', () => {
|
|||||||
search: null,
|
search: null,
|
||||||
kind: 'collectionType',
|
kind: 'collectionType',
|
||||||
title: 'Addresses',
|
title: 'Addresses',
|
||||||
to: '/plugins/content-manager/collectionType/application::address.address',
|
to: '/content-manager/collectionType/application::address.address',
|
||||||
uid: 'application::address.address',
|
uid: 'application::address.address',
|
||||||
name: 'application::address.address',
|
name: 'application::address.address',
|
||||||
permissions: [
|
permissions: [
|
||||||
@ -146,7 +146,7 @@ describe('ADMIN | LeftMenu | utils', () => {
|
|||||||
kind: 'singleType',
|
kind: 'singleType',
|
||||||
search: null,
|
search: null,
|
||||||
title: 'Test 1',
|
title: 'Test 1',
|
||||||
to: '/plugins/content-manager/singleType/application::test1.test1',
|
to: '/content-manager/singleType/application::test1.test1',
|
||||||
uid: 'application::test1.test1',
|
uid: 'application::test1.test1',
|
||||||
name: 'application::test1.test1',
|
name: 'application::test1.test1',
|
||||||
permissions: [
|
permissions: [
|
||||||
|
@ -92,7 +92,7 @@ describe('checkPermissions', () => {
|
|||||||
const expected = {
|
const expected = {
|
||||||
authorizedCtLinks: [
|
authorizedCtLinks: [
|
||||||
{
|
{
|
||||||
destination: '/plugins/content-manager/collectionType/application::address.address',
|
destination: '/content-manager/collectionType/application::address.address',
|
||||||
icon: 'circle',
|
icon: 'circle',
|
||||||
isDisplayed: true,
|
isDisplayed: true,
|
||||||
label: 'address',
|
label: 'address',
|
||||||
@ -109,7 +109,7 @@ describe('checkPermissions', () => {
|
|||||||
search: 'page=1&pageSize=10&_sort=name:ASC',
|
search: 'page=1&pageSize=10&_sort=name:ASC',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
destination: '/plugins/content-manager/collectionType/application::article.article',
|
destination: '/content-manager/collectionType/application::article.article',
|
||||||
icon: 'circle',
|
icon: 'circle',
|
||||||
isDisplayed: true,
|
isDisplayed: true,
|
||||||
label: 'article',
|
label: 'article',
|
||||||
|
@ -51,7 +51,7 @@ const EditView = ({
|
|||||||
}, [isSingleType]);
|
}, [isSingleType]);
|
||||||
|
|
||||||
// FIXME when changing the routing
|
// FIXME when changing the routing
|
||||||
const configurationsURL = `/plugins/content-manager/${
|
const configurationsURL = `/content-manager/${
|
||||||
isSingleType ? 'singleType' : 'collectionType'
|
isSingleType ? 'singleType' : 'collectionType'
|
||||||
}/${slug}/configurations/edit`;
|
}/${slug}/configurations/edit`;
|
||||||
const currentContentTypeLayoutData = useMemo(() => get(layout, ['contentType'], {}), [layout]);
|
const currentContentTypeLayoutData = useMemo(() => get(layout, ['contentType'], {}), [layout]);
|
||||||
|
@ -96,7 +96,7 @@ const Admin = () => {
|
|||||||
<Route path="/" component={HomePage} exact />
|
<Route path="/" component={HomePage} exact />
|
||||||
<Route path="/me" component={ProfilePage} exact />
|
<Route path="/me" component={ProfilePage} exact />
|
||||||
|
|
||||||
<Route path="/plugins/content-manager" component={CM} />
|
<Route path="/content-manager" component={CM} />
|
||||||
<Route path="/plugins/content-type-builder" component={CTB} />
|
<Route path="/plugins/content-type-builder" component={CTB} />
|
||||||
<Route path="/plugins/upload" component={Upload} />
|
<Route path="/plugins/upload" component={Upload} />
|
||||||
{routes}
|
{routes}
|
||||||
|
@ -54,7 +54,7 @@ describe('<Admin />', () => {
|
|||||||
useStrapiApp.mockImplementation(() => ({
|
useStrapiApp.mockImplementation(() => ({
|
||||||
menu: [
|
menu: [
|
||||||
{
|
{
|
||||||
to: '/plugins/content-manager',
|
to: '/plugins/ctb',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
to: '/plugins/documentation',
|
to: '/plugins/documentation',
|
||||||
|
@ -225,10 +225,13 @@ describe('ADMIN | StrapiApp', () => {
|
|||||||
it('addCorePluginMenuLink should add a link to the menu', () => {
|
it('addCorePluginMenuLink should add a link to the menu', () => {
|
||||||
const app = StrapiApp({ middlewares, reducers, library, locales });
|
const app = StrapiApp({ middlewares, reducers, library, locales });
|
||||||
const link = {
|
const link = {
|
||||||
to: '/plugins/content-manager',
|
to: '/plugins/content-type-builder',
|
||||||
icon: 'book',
|
icon: 'book',
|
||||||
permissions: [],
|
permissions: [],
|
||||||
intlLabel: { id: 'content-manager.plugin.name', defaultMessage: 'Content Manager' },
|
intlLabel: {
|
||||||
|
id: 'content-type-builder.plugin.name',
|
||||||
|
defaultMessage: 'Content Type builder',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
app.addCorePluginMenuLink(link);
|
app.addCorePluginMenuLink(link);
|
||||||
|
@ -50,9 +50,9 @@ const LinkToCMSettingsView = ({ isTemporary, isInContentTypeView, contentTypeKin
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isInContentTypeView) {
|
if (isInContentTypeView) {
|
||||||
push(`/plugins/content-manager/collectionType/${targetUid}/configurations/edit`);
|
push(`/content-manager/collectionType/${targetUid}/configurations/edit`);
|
||||||
} else {
|
} else {
|
||||||
push(`/plugins/content-manager/components/${targetUid}/configurations/edit`);
|
push(`/content-manager/components/${targetUid}/configurations/edit`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -51,7 +51,7 @@ const CMEditViewLocalePicker = ({
|
|||||||
|
|
||||||
if (status === 'did-not-create-locale') {
|
if (status === 'did-not-create-locale') {
|
||||||
push({
|
push({
|
||||||
pathname: `/plugins/content-manager/collectionType/${slug}/create`,
|
pathname: `/content-manager/collectionType/${slug}/create`,
|
||||||
search: stringify(defaultParams, { encode: false }),
|
search: stringify(defaultParams, { encode: false }),
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ const CMEditViewLocalePicker = ({
|
|||||||
}
|
}
|
||||||
|
|
||||||
push({
|
push({
|
||||||
pathname: `/plugins/content-manager/collectionType/${slug}/${id}`,
|
pathname: `/content-manager/collectionType/${slug}/${id}`,
|
||||||
search: stringify(defaultParams, { encode: false }),
|
search: stringify(defaultParams, { encode: false }),
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -46,7 +46,7 @@ const LocalePicker = () => {
|
|||||||
const [{ query }, setQuery] = useQueryParams();
|
const [{ query }, setQuery] = useQueryParams();
|
||||||
const {
|
const {
|
||||||
params: { slug },
|
params: { slug },
|
||||||
} = useRouteMatch('/plugins/content-manager/collectionType/:slug');
|
} = useRouteMatch('/content-manager/collectionType/:slug');
|
||||||
const isFieldLocalized = useHasI18n();
|
const isFieldLocalized = useHasI18n();
|
||||||
const { createPermissions, readPermissions } = useContentTypePermissions(slug);
|
const { createPermissions, readPermissions } = useContentTypePermissions(slug);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user