Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
soupette 2020-01-22 10:59:30 +01:00
parent 27c3cf7a91
commit a9c9549458
3 changed files with 18 additions and 1 deletions

View File

@ -144,6 +144,7 @@ export class Admin extends React.Component {
return (
<GlobalContextProvider
autoReload={this.props.global.autoReload}
emitEvent={this.props.emitEvent}
currentEnvironment={this.props.global.currentEnvironment}
disableGlobalOverlayBlocker={this.props.disableGlobalOverlayBlocker}
@ -216,6 +217,7 @@ Admin.propTypes = {
emitEvent: PropTypes.func.isRequired,
enableGlobalOverlayBlocker: PropTypes.func.isRequired,
global: PropTypes.shape({
autoReload: PropTypes.bool,
blockApp: PropTypes.bool,
currentEnvironment: PropTypes.string,
overlayBlockerData: PropTypes.oneOfType([PropTypes.bool, PropTypes.object]),

View File

@ -38,6 +38,7 @@ const DataManagerProvider = ({ allIcons, children }) => {
const [reducerState, dispatch] = useReducer(reducer, initialState, init);
const [infoModals, toggleInfoModal] = useState({ cancel: false });
const {
autoReload,
currentEnvironment,
emitEvent,
formatMessage,
@ -59,7 +60,10 @@ const DataManagerProvider = ({ allIcons, children }) => {
const componentMatch = useRouteMatch(
`/plugins/${pluginId}/component-categories/:categoryUid/:componentUid`
);
const isInDevelopmentMode = currentEnvironment === 'development';
const formatMessageRef = useRef();
formatMessageRef.current = formatMessage;
const isInDevelopmentMode =
currentEnvironment === 'development' && autoReload;
const isInContentTypeView = contentTypeMatch !== null;
const firstKeyToMainSchema = isInContentTypeView
@ -120,6 +124,16 @@ const DataManagerProvider = ({ allIcons, children }) => {
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isLoading, pathname]);
useEffect(() => {
if (currentEnvironment === 'development' && !autoReload) {
strapi.notification.info(
formatMessageRef.current({
id: getTrad('notification.info.autoreaload-disable'),
})
);
}
}, [autoReload, currentEnvironment]);
const didModifiedComponents =
getCreatedAndModifiedComponents(modifiedData.components || {}, components)
.length > 0;

View File

@ -132,6 +132,7 @@
"modelPage.attribute.relationWith": "Relation with",
"modelPage.contentHeader.emptyDescription.description": "There is no description",
"notification.info.creating.notSaved": "Please save your work before creating a new content type or component",
"notification.info.autoreaload-disable": "The autoReload feature is required to use this plugin. Start your server with `strapi develop`",
"plugin.description.long": "Modelize the data structure of your API. Create new fields and relations in just a minute. The files are automatically created and updated in your project.",
"plugin.description.short": "Modelize the data structure of your API.",
"popUpForm.navContainer.advanced": "Advanced settings",