Remove useless files

Signed-off-by: soupette <cyril.lpz@gmail.com>
This commit is contained in:
soupette 2020-08-28 09:43:48 +02:00
parent 658ae9676f
commit bcd9075229
4 changed files with 2 additions and 78 deletions

View File

@ -1,27 +0,0 @@
/**
*
* Initializer
*
*/
import { memo, useEffect, useRef } from 'react';
import PropTypes from 'prop-types';
import pluginId from '../../pluginId';
const Initializer = ({ updatePlugin }) => {
const ref = useRef();
ref.current = updatePlugin;
useEffect(() => {
ref.current(pluginId, 'isReady', true);
}, []);
return null;
};
Initializer.propTypes = {
updatePlugin: PropTypes.func.isRequired,
};
export default memo(Initializer);
export { Initializer };

View File

@ -1,17 +0,0 @@
import React from 'react';
import { mount, shallow } from 'enzyme';
import { Initializer } from '../index';
describe('<Initializer />', () => {
it('should not crash', () => {
shallow(<Initializer updatePlugin={jest.fn()} />);
});
it('should call the updatePlugin props on mount', () => {
const props = { updatePlugin: jest.fn() };
mount(<Initializer {...props} />);
expect(props.updatePlugin).toHaveBeenCalledWith('users-permissions', 'isReady', true);
});
});

View File

@ -11,8 +11,6 @@ import pluginLogo from './assets/images/logo.svg';
import pluginPermissions from './permissions';
import layout from '../../config/layout';
import pluginId from './pluginId';
import Initializer from './containers/Initializer';
import lifecycles from './lifecycles';
import trads from './translations';
import RolesPage from './containers/Roles';
import ProvidersPage from './containers/Providers';
@ -31,11 +29,11 @@ export default strapi => {
description: pluginDescription,
icon,
id: pluginId,
initializer: Initializer,
initializer: null,
isReady: true,
injectedComponents: [],
isRequired: pluginPkg.strapi.required || false,
layout,
lifecycles,
mainComponent: null,
name,
pluginLogo,

View File

@ -1,30 +0,0 @@
/*
*
* SET THE HOOKS TO ENABLE THE MAGIC OF STRAPI.
* -------------------------------------------
*
* Secure, customise and enhance your project by setting
* the hooks via this file.
*
*/
function lifecycles() {
// TODO: Make it work and remove it when the split-admin PR has been merged
// const componentsToAdd = [
// {
// area: 'NavRight',
// key: 'UsersPermissionsLogout',
// mainComponent: require('./components/Logout').default,
// },
// ];
// this.setComponents(componentsToAdd);
// Set hooks for the AdminPage container.
// Note: we don't need to specify the first argument because we already know what "willSecure" refers to.
// Set hooks for the App container of the Content Manager.
// Note: we have to specify the first argument to select a specific container which is located in a plugin, or not.
// this.setHooks('content-manager.App', {
// willSomething: (props, store) => { console.log("Do Something"); }
// });
}
export default lifecycles;