diff --git a/app/src/js/components/menu/classifications/classifications.scss b/app/src/js/components/classifications/menu/classifications.scss
similarity index 100%
rename from app/src/js/components/menu/classifications/classifications.scss
rename to app/src/js/components/classifications/menu/classifications.scss
diff --git a/app/src/js/components/menu/classifications/classifications.spec.js b/app/src/js/components/classifications/menu/classifications.spec.js
similarity index 83%
rename from app/src/js/components/menu/classifications/classifications.spec.js
rename to app/src/js/components/classifications/menu/classifications.spec.js
index 2544a4fff..27d8820ad 100644
--- a/app/src/js/components/menu/classifications/classifications.spec.js
+++ b/app/src/js/components/classifications/menu/classifications.spec.js
@@ -1,6 +1,6 @@
import React from 'react';
import { shallow } from 'enzyme';
-import MenuClassifications from './';
+import MenuClassifications from '.';
describe('menu-classifications', () => {
it('renders without crashing', () => {
diff --git a/app/src/js/components/menu/classifications/index.js b/app/src/js/components/classifications/menu/index.js
similarity index 98%
rename from app/src/js/components/menu/classifications/index.js
rename to app/src/js/components/classifications/menu/index.js
index 2028a660a..468ca07f4 100644
--- a/app/src/js/components/menu/classifications/index.js
+++ b/app/src/js/components/classifications/menu/index.js
@@ -1,6 +1,6 @@
import React, { Component } from 'react';
import { Link, withRouter } from 'react-router-dom';
-import MenuReferentiels from '../referentiels';
+import MenuReferentiels from 'js/components/menu/referentiels';
import D from 'js/i18n';
import './classifications.scss';
diff --git a/app/src/js/components/classifications/routes/index.js b/app/src/js/components/classifications/routes/index.js
new file mode 100644
index 000000000..b0af9f08f
--- /dev/null
+++ b/app/src/js/components/classifications/routes/index.js
@@ -0,0 +1,100 @@
+import React from 'react';
+import { Switch, Route } from 'react-router-dom';
+
+import ClassificationsFamiliesContainer from 'js/components/classifications/families/home-container';
+import ClassificationsFamilyContainer from 'js/components/classifications/families/visualization/home-container';
+import ClassificationsSeriesContainer from 'js/components/classifications/series/home-container';
+import ClassificationsOneSeriesContainer from 'js/components/classifications/series/visualization/home-container';
+import ClassificationsContainer from 'js/components/classifications/home-container';
+import ClassificationContainer from 'js/components/classifications/visualization/home-container';
+import ClassificationItemsContainer from 'js/components/classifications/visualization/items/home-container';
+import ClassificationTreeContainer from 'js/components/classifications/visualization/tree/home-container';
+import ClassificationLevelContainer from 'js/components/classifications/level/home-container';
+import ClassificationItemContainer from 'js/components/classifications/item/home-container';
+import ClassificationItemCompareContainer from 'js/components/classifications/item/compare/home-container';
+import ClassificationsCorrespondencesContainer from 'js/components/classifications/correspondences/home-container';
+import ClassificationsCorrespondenceContainer from 'js/components/classifications/correspondences/visualization/home-container';
+import ClassificationsCorrespondenceAssociationContainer from 'js/components/classifications/correspondences/association/home-container';
+import D from 'js/i18n';
+import Menu from 'js/components/classifications/menu';
+
+export default () => {
+ document.title = 'Bauhaus - ' + D.classificationsTitle;
+ return (
+ <>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+ );
+};
diff --git a/app/src/js/components/menu/concepts/concepts.scss b/app/src/js/components/concepts/menu/concepts.scss
similarity index 100%
rename from app/src/js/components/menu/concepts/concepts.scss
rename to app/src/js/components/concepts/menu/concepts.scss
diff --git a/app/src/js/components/menu/concepts/concepts.spec.js b/app/src/js/components/concepts/menu/concepts.spec.js
similarity index 84%
rename from app/src/js/components/menu/concepts/concepts.spec.js
rename to app/src/js/components/concepts/menu/concepts.spec.js
index c8e77177a..9fecdfe94 100644
--- a/app/src/js/components/menu/concepts/concepts.spec.js
+++ b/app/src/js/components/concepts/menu/concepts.spec.js
@@ -1,6 +1,6 @@
import React from 'react';
import { shallow } from 'enzyme';
-import MenuConcepts from './';
+import MenuConcepts from '.';
describe('menu-concepts', () => {
it('renders without crashing', () => {
diff --git a/app/src/js/components/menu/concepts/index.js b/app/src/js/components/concepts/menu/index.js
similarity index 93%
rename from app/src/js/components/menu/concepts/index.js
rename to app/src/js/components/concepts/menu/index.js
index ce998ac4d..83eb55d58 100644
--- a/app/src/js/components/menu/concepts/index.js
+++ b/app/src/js/components/concepts/menu/index.js
@@ -1,10 +1,12 @@
import React, { Component } from 'react';
import { Link, withRouter } from 'react-router-dom';
-import MenuReferentiels from '../referentiels';
+import MenuReferentiels from 'js/components/menu/referentiels';
import check from 'js/utils/auth';
import { propTypes as permissionOverviewPropTypes } from 'js/utils/auth/permission-overview';
import D from 'js/i18n';
import './concepts.scss';
+import { compose } from 'recompose';
+import { withPermissions } from 'js/components/menu/home-container';
class MenuConcepts extends Component {
constructor(props) {
@@ -132,4 +134,7 @@ MenuConcepts.propTypes = {
permission: permissionOverviewPropTypes.isRequired,
};
-export default withRouter(MenuConcepts);
+export default compose(
+ withRouter,
+ withPermissions
+)(MenuConcepts);
diff --git a/app/src/js/components/router/concepts.js b/app/src/js/components/concepts/routes/index.js
similarity index 50%
rename from app/src/js/components/router/concepts.js
rename to app/src/js/components/concepts/routes/index.js
index a8de5470b..160dce93c 100644
--- a/app/src/js/components/router/concepts.js
+++ b/app/src/js/components/concepts/routes/index.js
@@ -23,87 +23,99 @@ import Help from 'js/components/help/home';
import Administration from 'js/components/administration/home-container';
import ConceptsDashboard from 'js/components/administration/dashboard/concepts/home-container';
import D from 'js/i18n';
+import Menu from 'js/components/concepts/menu';
export default () => {
document.title = 'Bauhaus - ' + D.conceptsTitle;
return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ <>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+ >
);
};
diff --git a/app/src/js/components/menu/home-container.js b/app/src/js/components/menu/home-container.js
index 408d1efde..2d57042e2 100644
--- a/app/src/js/components/menu/home-container.js
+++ b/app/src/js/components/menu/home-container.js
@@ -1,18 +1,23 @@
-import React, { Component } from 'react';
+import React from 'react';
import { connect } from 'react-redux';
-import Menu from './home';
import * as select from 'js/reducers';
-class MenuContainer extends Component {
- render() {
- const { permission } = this.props;
- return ;
- }
-}
+export function withPermissions(WrappedComponent) {
+ const mapStateToProps = state => {
+ const permission = select.getPermission(state);
+ return { permission };
+ };
-const mapStateToProps = state => {
- const permission = select.getPermission(state);
- return { permission };
-};
+ class MenuContainer extends React.Component {
+ render() {
+ return (
+
+ );
+ }
+ }
-export default connect(mapStateToProps)(MenuContainer);
+ return connect(mapStateToProps)(MenuContainer);
+}
diff --git a/app/src/js/components/menu/home.js b/app/src/js/components/menu/home.js
deleted file mode 100644
index 7885f800a..000000000
--- a/app/src/js/components/menu/home.js
+++ /dev/null
@@ -1,49 +0,0 @@
-import React, { Component } from 'react';
-import { withRouter } from 'react-router-dom';
-import MenuConcepts from './concepts';
-import MenuClassifications from './classifications';
-import MenuOperations from './operations';
-import { propTypes as permissionOverviewPropTypes } from 'js/utils/auth/permission-overview';
-
-class MenuDispatcher extends Component {
- render() {
- const { permission } = this.props;
- const path = this.props.location.pathname;
- let isConceptPath = [
- '/concept',
- '/collection',
- '/concepts/help',
- '/administration',
- ].reduce((_, p) => {
- if (path.includes(p)) _ = true;
- return _;
- }, false);
- const isClassificationPath = [
- '/classification',
- '/classifications/help',
- ].reduce((_, p) => {
- if (path.includes(p)) _ = true;
- return _;
- }, false);
- const isOperationPath = ['/operations', '/operations/help'].reduce(
- (_, p) => {
- if (path.includes(p)) _ = true;
- return _;
- },
- false
- );
- return (
-
- {isConceptPath && }
- {isClassificationPath && }
- {isOperationPath && }
-
- );
- }
-}
-
-MenuDispatcher.propTypes = {
- permission: permissionOverviewPropTypes.isRequired,
-};
-
-export default withRouter(MenuDispatcher);
diff --git a/app/src/js/components/menu/home.spec.js b/app/src/js/components/menu/home.spec.js
deleted file mode 100644
index 4bc62f5a2..000000000
--- a/app/src/js/components/menu/home.spec.js
+++ /dev/null
@@ -1,9 +0,0 @@
-import React from 'react';
-import { shallow } from 'enzyme';
-import MenuHome from './home';
-
-describe('menu-home', () => {
- it('renders without crashing', () => {
- shallow();
- });
-});
diff --git a/app/src/js/components/menu/operations/index.js b/app/src/js/components/operations/menu/index.js
similarity index 96%
rename from app/src/js/components/menu/operations/index.js
rename to app/src/js/components/operations/menu/index.js
index 9940bc5cf..5cc7cf73a 100644
--- a/app/src/js/components/menu/operations/index.js
+++ b/app/src/js/components/operations/menu/index.js
@@ -1,12 +1,13 @@
import React, { Component } from 'react';
import { Link, withRouter } from 'react-router-dom';
-import MenuReferentiels from '../referentiels';
+import MenuReferentiels from 'js/components/menu/referentiels';
import { connect } from 'react-redux';
import D from 'js/i18n';
import './operations.scss';
import { compose } from 'recompose';
import { getOperationsSimsCurrent } from 'js/reducers';
+import { propTypes as permissionOverviewPropTypes } from 'js/utils/auth/permission-overview';
const ACTIVE = 'active';
const defaultAttrs = { 'aria-current': 'page' };
@@ -230,6 +231,10 @@ class MenuOperations extends Component {
}
}
+MenuOperations.propTypes = {
+ permission: permissionOverviewPropTypes.isRequired,
+};
+
export default compose(
withRouter,
connect(state => {
diff --git a/app/src/js/components/menu/operations/operations.scss b/app/src/js/components/operations/menu/operations.scss
similarity index 100%
rename from app/src/js/components/menu/operations/operations.scss
rename to app/src/js/components/operations/menu/operations.scss
diff --git a/app/src/js/components/menu/operations/operations.spec.js b/app/src/js/components/operations/menu/operations.spec.js
similarity index 84%
rename from app/src/js/components/menu/operations/operations.spec.js
rename to app/src/js/components/operations/menu/operations.spec.js
index 89f6a3646..ac1d671cd 100644
--- a/app/src/js/components/menu/operations/operations.spec.js
+++ b/app/src/js/components/operations/menu/operations.spec.js
@@ -1,6 +1,6 @@
import React from 'react';
import { shallow } from 'enzyme';
-import MenuOperations from './';
+import MenuOperations from '.';
describe('menu-operations', () => {
it('renders without crashing', () => {
diff --git a/app/src/js/components/router/operations/document.js b/app/src/js/components/operations/routes/document.js
similarity index 100%
rename from app/src/js/components/router/operations/document.js
rename to app/src/js/components/operations/routes/document.js
diff --git a/app/src/js/components/router/operations/family.js b/app/src/js/components/operations/routes/family.js
similarity index 100%
rename from app/src/js/components/router/operations/family.js
rename to app/src/js/components/operations/routes/family.js
diff --git a/app/src/js/components/operations/routes/index.js b/app/src/js/components/operations/routes/index.js
new file mode 100644
index 000000000..9b23acd0b
--- /dev/null
+++ b/app/src/js/components/operations/routes/index.js
@@ -0,0 +1,47 @@
+import React, { Component } from 'react';
+import { Route } from 'react-router-dom';
+import { connect } from 'react-redux';
+
+import { loadSetup } from 'js/actions/operations/utils/setup';
+
+import D from 'js/i18n';
+import { ApplicationContext } from 'js/context';
+
+import FamilyRoutes from 'js/components/operations/routes/family';
+import SeriesRoutes from 'js/components/operations/routes/series';
+import OperationsRoutes from 'js/components/operations/routes/operation';
+import DocumentRoutes from 'js/components/operations/routes/document';
+import IndicatorRoutes from 'js/components/operations/routes/indicator';
+import SimsRoutes from 'js/components/operations/routes/sims';
+import Menu from 'js/components/operations/menu';
+
+class RootComponent extends Component {
+ componentDidMount() {
+ this.props.loadSetup();
+ document.title = 'Bauhaus - ' + D.operationsTitle;
+ }
+ render() {
+ return (
+ <>
+
+
+
+
+
+
+
+
+
+ >
+ );
+ }
+}
+const mapDispatchToProps = {
+ loadSetup,
+};
+const ConnectedRootComponent = connect(
+ undefined,
+ mapDispatchToProps
+)(RootComponent);
+
+export default () => ;
diff --git a/app/src/js/components/router/operations/indicator.js b/app/src/js/components/operations/routes/indicator.js
similarity index 100%
rename from app/src/js/components/router/operations/indicator.js
rename to app/src/js/components/operations/routes/indicator.js
diff --git a/app/src/js/components/router/operations/operation.js b/app/src/js/components/operations/routes/operation.js
similarity index 100%
rename from app/src/js/components/router/operations/operation.js
rename to app/src/js/components/operations/routes/operation.js
diff --git a/app/src/js/components/router/operations/series.js b/app/src/js/components/operations/routes/series.js
similarity index 100%
rename from app/src/js/components/router/operations/series.js
rename to app/src/js/components/operations/routes/series.js
diff --git a/app/src/js/components/router/operations/sims.js b/app/src/js/components/operations/routes/sims.js
similarity index 100%
rename from app/src/js/components/router/operations/sims.js
rename to app/src/js/components/operations/routes/sims.js
diff --git a/app/src/js/components/router/classifications.js b/app/src/js/components/router/classifications.js
deleted file mode 100644
index 2fea0ca95..000000000
--- a/app/src/js/components/router/classifications.js
+++ /dev/null
@@ -1,96 +0,0 @@
-import React from 'react';
-import { Switch, Route } from 'react-router-dom';
-
-import ClassificationsFamiliesContainer from 'js/components/classifications/families/home-container';
-import ClassificationsFamilyContainer from 'js/components/classifications/families/visualization/home-container';
-import ClassificationsSeriesContainer from 'js/components/classifications/series/home-container';
-import ClassificationsOneSeriesContainer from 'js/components/classifications/series/visualization/home-container';
-import ClassificationsContainer from 'js/components/classifications/home-container';
-import ClassificationContainer from 'js/components/classifications/visualization/home-container';
-import ClassificationItemsContainer from 'js/components/classifications/visualization/items/home-container';
-import ClassificationTreeContainer from 'js/components/classifications/visualization/tree/home-container';
-import ClassificationLevelContainer from 'js/components/classifications/level/home-container';
-import ClassificationItemContainer from 'js/components/classifications/item/home-container';
-import ClassificationItemCompareContainer from 'js/components/classifications/item/compare/home-container';
-import ClassificationsCorrespondencesContainer from 'js/components/classifications/correspondences/home-container';
-import ClassificationsCorrespondenceContainer from 'js/components/classifications/correspondences/visualization/home-container';
-import ClassificationsCorrespondenceAssociationContainer from 'js/components/classifications/correspondences/association/home-container';
-import D from 'js/i18n';
-
-export default () => {
- document.title = 'Bauhaus - ' + D.classificationsTitle;
- return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- );
-};
diff --git a/app/src/js/components/router/operations/index.js b/app/src/js/components/router/operations/index.js
deleted file mode 100644
index 0330f62be..000000000
--- a/app/src/js/components/router/operations/index.js
+++ /dev/null
@@ -1,43 +0,0 @@
-import React, { Component } from 'react';
-import { Route } from 'react-router-dom';
-import { connect } from 'react-redux';
-
-import { loadSetup } from 'js/actions/operations/utils/setup';
-
-import D from 'js/i18n';
-import { ApplicationContext } from 'js/context';
-
-import FamilyRoutes from 'js/components/router/operations/family';
-import SeriesRoutes from 'js/components/router/operations/series';
-import OperationsRoutes from 'js/components/router/operations/operation';
-import DocumentRoutes from 'js/components/router/operations/document';
-import IndicatorRoutes from 'js/components/router/operations/indicator';
-import SimsRoutes from 'js/components/router/operations/sims';
-
-class RootComponent extends Component {
- componentDidMount() {
- this.props.loadSetup();
- document.title = 'Bauhaus - ' + D.operationsTitle;
- }
- render() {
- return (
-
-
-
-
-
-
-
-
- );
- }
-}
-const mapDispatchToProps = {
- loadSetup,
-};
-const ConnectedRootComponent = connect(
- undefined,
- mapDispatchToProps
-)(RootComponent);
-
-export default () => ;
diff --git a/app/src/js/components/router/routes.js b/app/src/js/components/router/routes.js
index e2c72c957..714389f05 100644
--- a/app/src/js/components/router/routes.js
+++ b/app/src/js/components/router/routes.js
@@ -8,7 +8,6 @@ import Error from 'js/components/shared/error/error';
import NotFound from 'js/components/shared/not-found/';
import App from 'js/components/app';
-import MenuDispatcher from 'js/components/menu/home-container';
import Role from 'js/components/administration/roles/home-container';
const pages = process.env.REACT_APP_APPLICATIONS.split(',').reduce(
@@ -16,7 +15,7 @@ const pages = process.env.REACT_APP_APPLICATIONS.split(',').reduce(
const app = appName.trim();
return {
...acc,
- [app]: lazy(() => import('js/components/router/' + app)),
+ [app]: lazy(() => import('js/components/' + app + '/routes')),
};
},
{}
@@ -37,7 +36,6 @@ const getHomePage = () => {
export default withRouter(
auth(({ error }) => (
-
}>
{error && }