diff --git a/packages/strapi-plugin-documentation/admin/src/containers/App/index.js b/packages/strapi-plugin-documentation/admin/src/containers/App/index.js
index 15f97bd26c..e0a7c68a0e 100755
--- a/packages/strapi-plugin-documentation/admin/src/containers/App/index.js
+++ b/packages/strapi-plugin-documentation/admin/src/containers/App/index.js
@@ -11,14 +11,14 @@ import { Switch, Route } from 'react-router-dom';
import pluginId from '../../pluginId';
// Containers
import HomePage from '../HomePage';
-import NotFoundPage from '../NotFoundPage';
+import { NotFound } from 'strapi-helper-plugin';
function App() {
return (
-
+
);
diff --git a/packages/strapi-plugin-documentation/admin/src/containers/HomePage/saga.js b/packages/strapi-plugin-documentation/admin/src/containers/HomePage/saga.js
index bcb8eabeef..53e366af7e 100755
--- a/packages/strapi-plugin-documentation/admin/src/containers/HomePage/saga.js
+++ b/packages/strapi-plugin-documentation/admin/src/containers/HomePage/saga.js
@@ -1,14 +1,24 @@
-// import { LOCATION_CHANGE } from 'react-router-redux';
import { cloneDeep, isArray } from 'lodash';
import { all, takeLatest, put, fork, call, select } from 'redux-saga/effects';
-import request from 'utils/request';
-import { GET_DOC_INFOS, ON_CONFIRM_DELETE_DOC, ON_UPDATE_DOC, ON_SUBMIT } from './constants';
+import { request } from 'strapi-helper-plugin';
+import {
+ GET_DOC_INFOS,
+ ON_CONFIRM_DELETE_DOC,
+ ON_UPDATE_DOC,
+ ON_SUBMIT,
+} from './constants';
import { getDocInfosSucceeded, setFormErrors } from './actions';
-import { makeSelectVersionToDelete, makeSelectPrefix, makeSelectForm } from './selectors';
+import {
+ makeSelectVersionToDelete,
+ makeSelectPrefix,
+ makeSelectForm,
+} from './selectors';
function* getData() {
try {
- const response = yield call(request, '/documentation/getInfos', { method: 'GET' });
+ const response = yield call(request, '/documentation/getInfos', {
+ method: 'GET',
+ });
yield put(getDocInfosSucceeded(response));
} catch (err) {
strapi.notification.error('An error occurred');
@@ -50,7 +60,9 @@ function* submit() {
if (body.restrictedAccess && body.password === '') {
return yield put(
- setFormErrors({ password: [{ id: 'components.Input.error.validation.required' }] }),
+ setFormErrors({
+ password: [{ id: 'components.Input.error.validation.required' }],
+ }),
);
}
@@ -67,7 +79,10 @@ function* updateDoc(action) {
try {
const body = { version: action.version };
const prefix = yield select(makeSelectPrefix());
- const response = yield call(request, `${prefix}/regenerateDoc`, { method: 'POST', body });
+ const response = yield call(request, `${prefix}/regenerateDoc`, {
+ method: 'POST',
+ body,
+ });
if (response.ok) {
yield call(getData);
diff --git a/packages/strapi-plugin-documentation/admin/src/containers/NotFoundPage/index.js b/packages/strapi-plugin-documentation/admin/src/containers/NotFoundPage/index.js
deleted file mode 100755
index 8ca6fd2190..0000000000
--- a/packages/strapi-plugin-documentation/admin/src/containers/NotFoundPage/index.js
+++ /dev/null
@@ -1,20 +0,0 @@
-/**
- * NotFoundPage
- *
- * This is the page we show when the user visits a url that doesn't have a route
- *
- * NOTE: while this component should technically be a stateless functional
- * component (SFC), hot reloading does not currently support SFCs. If hot
- * reloading is not a neccessity for you then you can refactor it and remove
- * the linting exception.
- */
-
-import React from 'react';
-
-import NotFound from 'components/NotFound';
-
-export default class NotFoundPage extends React.Component {
- render() {
- return ;
- }
-}
diff --git a/packages/strapi-plugin-documentation/admin/src/index.js b/packages/strapi-plugin-documentation/admin/src/index.js
new file mode 100644
index 0000000000..57b8002290
--- /dev/null
+++ b/packages/strapi-plugin-documentation/admin/src/index.js
@@ -0,0 +1,93 @@
+import React from 'react';
+import { reduce } from 'lodash';
+import pluginPkg from '../../package.json';
+import pluginId from './pluginId';
+
+import App from './containers/App';
+
+const pluginDescription = pluginPkg.strapi.description || pluginPkg.description;
+
+const formatMessages = messages =>
+ reduce(
+ messages,
+ (result, value, key) => {
+ result[`${pluginId}.${key}`] = value;
+
+ return result;
+ },
+ {},
+ );
+const requireTranslations = language => {
+ try {
+ return require(`./translations/${language}.json`); // eslint-disable-line global-require
+ } catch (error) {
+ console.error(
+ `Unable to load "${language}" translation for the plugin ${pluginId}. Please make sure "${language}.json" file exists in "pluginPath/admin/src/translations" folder.`,
+ );
+ return;
+ }
+};
+
+const translationMessages = reduce(
+ strapi.languages,
+ (result, language) => {
+ result[language] = formatMessages(requireTranslations(language));
+ return result;
+ },
+ {},
+);
+// const layout = (() => {
+// try {
+// return require('../../config/layout.js'); // eslint-disable-line import/no-unresolved
+// } catch (err) {
+// return null;
+// }
+// })();
+
+const injectedComponents = (() => {
+ try {
+ return require('./injectedComponents').default; // eslint-disable-line import/no-unresolved
+ } catch (err) {
+ return [];
+ }
+})();
+
+const initializer = (() => {
+ try {
+ return require('./initializer');
+ } catch (err) {
+ return null;
+ }
+})();
+
+const lifecycles = (() => {
+ try {
+ return require('./lifecycles');
+ } catch (err) {
+ return null;
+ }
+})();
+
+function Comp(props) {
+ return ;
+}
+
+const plugin = {
+ blockerComponent: null,
+ blockerComponentProps: {},
+ description: pluginDescription,
+ icon: pluginPkg.strapi.icon,
+ id: pluginId,
+ initializer,
+ injectedComponents,
+ layout: null,
+ lifecycles,
+ leftMenuLinks: [],
+ leftMenuSections: [],
+ mainComponent: Comp,
+ name: pluginPkg.strapi.name,
+ preventComponentRendering: false,
+ translationMessages,
+};
+
+export default plugin;