mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 15:13:21 +00:00
Merge pull request #18472 from strapi/chore/admin-misc-ts
chore(admin): move and combine various constants into a single TS file
This commit is contained in:
commit
26ef626a0d
@ -11,20 +11,24 @@ import { BrowserRouter } from 'react-router-dom';
|
||||
import Logo from './assets/images/logo-strapi-2022.svg';
|
||||
import { LANGUAGE_LOCAL_STORAGE_KEY } from './components/LanguageProvider';
|
||||
import Providers from './components/Providers';
|
||||
import {
|
||||
HOOKS,
|
||||
INJECTION_ZONES
|
||||
} from './constants';
|
||||
import { customFields, Plugin, Reducers } from './core/apis';
|
||||
import { configureStore } from './core/store';
|
||||
import { basename, createHook } from './core/utils';
|
||||
import {
|
||||
INJECT_COLUMN_IN_TABLE,
|
||||
MUTATE_COLLECTION_TYPES_LINKS,
|
||||
MUTATE_EDIT_VIEW_LAYOUT,
|
||||
MUTATE_SINGLE_TYPES_LINKS,
|
||||
} from './exposedHooks';
|
||||
import favicon from './favicon.png';
|
||||
import injectionZones from './injectionZones';
|
||||
import App from './pages/App';
|
||||
import languageNativeNames from './translations/languageNativeNames';
|
||||
|
||||
const {
|
||||
INJECT_COLUMN_IN_TABLE,
|
||||
MUTATE_COLLECTION_TYPES_LINKS,
|
||||
MUTATE_EDIT_VIEW_LAYOUT,
|
||||
MUTATE_SINGLE_TYPES_LINKS
|
||||
} = HOOKS;
|
||||
|
||||
class StrapiApp {
|
||||
constructor({ adminConfig, appPlugins, library, middlewares }) {
|
||||
this.customConfigurations = adminConfig.config;
|
||||
@ -47,7 +51,7 @@ class StrapiApp {
|
||||
this.translations = {};
|
||||
this.hooksDict = {};
|
||||
this.admin = {
|
||||
injectionZones,
|
||||
injectionZones: INJECTION_ZONES,
|
||||
};
|
||||
this.customFields = customFields;
|
||||
|
||||
|
||||
@ -88,3 +88,51 @@ export const ADMIN_PERMISSIONS_CE = {
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const HOOKS = {
|
||||
/**
|
||||
* Hook that allows to mutate the displayed headers of the list view table
|
||||
* @constant
|
||||
* @type {string}
|
||||
*/
|
||||
INJECT_COLUMN_IN_TABLE: 'Admin/CM/pages/ListView/inject-column-in-table',
|
||||
|
||||
/**
|
||||
* Hook that allows to mutate the CM's collection types links pre-set filters
|
||||
* @constant
|
||||
* @type {string}
|
||||
*/
|
||||
MUTATE_COLLECTION_TYPES_LINKS: 'Admin/CM/pages/App/mutate-collection-types-links',
|
||||
|
||||
/**
|
||||
* Hook that allows to mutate the CM's edit view layout
|
||||
* @constant
|
||||
* @type {string}
|
||||
*/
|
||||
MUTATE_EDIT_VIEW_LAYOUT: 'Admin/CM/pages/EditView/mutate-edit-view-layout',
|
||||
|
||||
/**
|
||||
* Hook that allows to mutate the CM's single types links pre-set filters
|
||||
* @constant
|
||||
* @type {string}
|
||||
*/
|
||||
MUTATE_SINGLE_TYPES_LINKS: 'Admin/CM/pages/App/mutate-single-types-links',
|
||||
};
|
||||
|
||||
export const INJECTION_ZONES = {
|
||||
admin: {
|
||||
// Temporary injection zone, support for the react-tour plugin in foodadvisor
|
||||
tutorials: {
|
||||
links: [],
|
||||
},
|
||||
},
|
||||
contentManager: {
|
||||
editView: { informations: [], 'right-links': [] },
|
||||
listView: {
|
||||
actions: [],
|
||||
deleteModalAdditionalInfos: [],
|
||||
publishModalAdditionalInfos: [],
|
||||
unpublishModalAdditionalInfos: [],
|
||||
},
|
||||
},
|
||||
};
|
||||
@ -11,13 +11,15 @@ import axios from 'axios';
|
||||
import { useIntl } from 'react-intl';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
|
||||
import { MUTATE_COLLECTION_TYPES_LINKS, MUTATE_SINGLE_TYPES_LINKS } from '../../../exposedHooks';
|
||||
import { HOOKS } from '../../../constants';
|
||||
import { getTrad } from '../../utils';
|
||||
|
||||
import { getInitData, resetInitData, setInitData } from './actions';
|
||||
import { selectAppDomain } from './selectors';
|
||||
import getContentTypeLinks from './utils/getContentTypeLinks';
|
||||
|
||||
const { MUTATE_COLLECTION_TYPES_LINKS, MUTATE_SINGLE_TYPES_LINKS } = HOOKS;
|
||||
|
||||
const useContentManagerInitData = () => {
|
||||
const dispatch = useDispatch();
|
||||
const toggleNotification = useNotification();
|
||||
|
||||
@ -4,13 +4,15 @@ import { LoadingIndicatorPage, useQueryParams, useStrapiApp } from '@strapi/help
|
||||
import PropTypes from 'prop-types';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
|
||||
import { MUTATE_EDIT_VIEW_LAYOUT } from '../../../exposedHooks';
|
||||
import { HOOKS } from '../../../constants';
|
||||
import { useSyncRbac } from '../../hooks';
|
||||
|
||||
import { resetProps, setLayout } from './actions';
|
||||
import Permissions from './Permissions';
|
||||
import selectLayout from './selectors';
|
||||
|
||||
const { MUTATE_EDIT_VIEW_LAYOUT } = HOOKS;
|
||||
|
||||
const EditViewLayoutManager = ({ layout, ...rest }) => {
|
||||
const currentLayout = useSelector(selectLayout);
|
||||
const dispatch = useDispatch();
|
||||
|
||||
@ -43,8 +43,8 @@ import { useMutation } from 'react-query';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { useHistory, useLocation, Link as ReactRouterLink } from 'react-router-dom';
|
||||
|
||||
import { HOOKS } from '../../../constants';
|
||||
import { useTypedSelector } from '../../../core/store';
|
||||
import { INJECT_COLUMN_IN_TABLE } from '../../../exposedHooks';
|
||||
import { useAdminUsers } from '../../../hooks/useAdminUsers';
|
||||
import { useEnterprise } from '../../../hooks/useEnterprise';
|
||||
import { InjectionZone } from '../../../shared/components';
|
||||
@ -62,6 +62,7 @@ import { ViewSettingsMenu } from './components/ViewSettingsMenu';
|
||||
import makeSelectListView, { selectDisplayedHeaders } from './selectors';
|
||||
import { buildValidGetParams } from './utils';
|
||||
|
||||
const { INJECT_COLUMN_IN_TABLE } = HOOKS;
|
||||
const REVIEW_WORKFLOW_COLUMNS_CE = null;
|
||||
const REVIEW_WORKFLOW_COLUMNS_CELL_CE = () => null;
|
||||
const REVIEW_WORKFLOW_FILTER_CE = [];
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
/**
|
||||
* Hook that allows to mutate the displayed headers of the list view table
|
||||
* @constant
|
||||
* @type {string}
|
||||
*/
|
||||
export const INJECT_COLUMN_IN_TABLE = 'Admin/CM/pages/ListView/inject-column-in-table';
|
||||
|
||||
/**
|
||||
* Hook that allows to mutate the CM's collection types links pre-set filters
|
||||
* @constant
|
||||
* @type {string}
|
||||
*/
|
||||
export const MUTATE_COLLECTION_TYPES_LINKS = 'Admin/CM/pages/App/mutate-collection-types-links';
|
||||
|
||||
/**
|
||||
* Hook that allows to mutate the CM's edit view layout
|
||||
* @constant
|
||||
* @type {string}
|
||||
*/
|
||||
export const MUTATE_EDIT_VIEW_LAYOUT = 'Admin/CM/pages/EditView/mutate-edit-view-layout';
|
||||
|
||||
/**
|
||||
* Hook that allows to mutate the CM's single types links pre-set filters
|
||||
* @constant
|
||||
* @type {string}
|
||||
*/
|
||||
export const MUTATE_SINGLE_TYPES_LINKS = 'Admin/CM/pages/App/mutate-single-types-links';
|
||||
@ -1,25 +0,0 @@
|
||||
/**
|
||||
* Admin injection zones:
|
||||
* Available zones: Content Manager listView & editView
|
||||
* @constant
|
||||
* @type {Object}
|
||||
*/
|
||||
const injectionZones = {
|
||||
admin: {
|
||||
// Temporary injection zone, support for the react-tour plugin in foodadvisor
|
||||
tutorials: {
|
||||
links: [],
|
||||
},
|
||||
},
|
||||
contentManager: {
|
||||
editView: { informations: [], 'right-links': [] },
|
||||
listView: {
|
||||
actions: [],
|
||||
deleteModalAdditionalInfos: [],
|
||||
publishModalAdditionalInfos: [],
|
||||
unpublishModalAdditionalInfos: [],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default injectionZones;
|
||||
Loading…
x
Reference in New Issue
Block a user