mirror of
https://github.com/strapi/strapi.git
synced 2025-11-14 09:07:59 +00:00
Remove single store documentation and settings manager
This commit is contained in:
parent
835a26e8c3
commit
46e13f71c6
@ -1,5 +0,0 @@
|
|||||||
/*
|
|
||||||
*
|
|
||||||
* App actions
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
/*
|
|
||||||
*
|
|
||||||
* App constants
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
@ -6,41 +6,22 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { connect } from 'react-redux';
|
|
||||||
import { createStructuredSelector } from 'reselect';
|
|
||||||
import { Switch, Route } from 'react-router-dom';
|
import { Switch, Route } from 'react-router-dom';
|
||||||
import { bindActionCreators, compose } from 'redux';
|
|
||||||
// Utils
|
// Utils
|
||||||
import { pluginId } from 'app';
|
import { pluginId } from 'app';
|
||||||
// Containers
|
// Containers
|
||||||
import HomePage from 'containers/HomePage';
|
import HomePage from 'containers/HomePage';
|
||||||
import NotFoundPage from 'containers/NotFoundPage';
|
import NotFoundPage from 'containers/NotFoundPage';
|
||||||
|
|
||||||
class App extends React.Component {
|
function App() {
|
||||||
render() {
|
return (
|
||||||
return (
|
<div className={pluginId}>
|
||||||
<div className={pluginId}>
|
<Switch>
|
||||||
<Switch>
|
<Route path={`/plugins/${pluginId}`} component={HomePage} exact />
|
||||||
<Route path={`/plugins/${pluginId}`} component={HomePage} exact />
|
<Route component={NotFoundPage} />
|
||||||
<Route component={NotFoundPage} />
|
</Switch>
|
||||||
</Switch>
|
</div>
|
||||||
</div>
|
);
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
App.propTypes = {};
|
export default App;
|
||||||
|
|
||||||
export function mapDispatchToProps(dispatch) {
|
|
||||||
return bindActionCreators({}, dispatch);
|
|
||||||
}
|
|
||||||
|
|
||||||
const mapStateToProps = createStructuredSelector({});
|
|
||||||
|
|
||||||
// Wrap the component to inject dispatch and state into it
|
|
||||||
const withConnect = connect(
|
|
||||||
mapStateToProps,
|
|
||||||
mapDispatchToProps,
|
|
||||||
);
|
|
||||||
|
|
||||||
export default compose(withConnect)(App);
|
|
||||||
|
|||||||
@ -1,18 +0,0 @@
|
|||||||
/*
|
|
||||||
*
|
|
||||||
* App reducer
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { fromJS } from 'immutable';
|
|
||||||
|
|
||||||
const initialState = fromJS({});
|
|
||||||
|
|
||||||
function appReducer(state = initialState, action) {
|
|
||||||
switch (action.type) {
|
|
||||||
default:
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default appReducer;
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
// import { createSelector } from 'reselect';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Direct selector to the list state domain
|
|
||||||
*/
|
|
||||||
|
|
||||||
// const selectGlobalDomain = () => state => state.get('global');
|
|
||||||
|
|
||||||
export {};
|
|
||||||
@ -22,8 +22,6 @@ import Input from 'components/InputsIndex';
|
|||||||
import { pluginId } from 'app';
|
import { pluginId } from 'app';
|
||||||
// Utils
|
// Utils
|
||||||
import auth from 'utils/auth';
|
import auth from 'utils/auth';
|
||||||
import injectReducer from 'utils/injectReducer';
|
|
||||||
import injectSaga from 'utils/injectSaga';
|
|
||||||
import openWithNewTab from 'utils/openWithNewTab';
|
import openWithNewTab from 'utils/openWithNewTab';
|
||||||
// Actions
|
// Actions
|
||||||
import {
|
import {
|
||||||
@ -245,8 +243,8 @@ const withConnect = connect(
|
|||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
mapDispatchToProps,
|
mapDispatchToProps,
|
||||||
);
|
);
|
||||||
const withReducer = injectReducer({ key: 'homePage', reducer });
|
const withReducer = strapi.injectReducer({ key: 'homePage', reducer, pluginId: 'documentation' });
|
||||||
const withSaga = injectSaga({ key: 'homePage', saga });
|
const withSaga = strapi.injectSaga({ key: 'homePage', saga, pluginId: 'documentation' });
|
||||||
|
|
||||||
export default compose(
|
export default compose(
|
||||||
withReducer,
|
withReducer,
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { createSelector } from 'reselect';
|
|||||||
/**
|
/**
|
||||||
* Direct selector to the homePage state domain
|
* Direct selector to the homePage state domain
|
||||||
*/
|
*/
|
||||||
const selectHomePageDomain = () => state => state.get('homePage');
|
const selectHomePageDomain = () => state => state.get('documentation-homePage');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default selector used by HomePage
|
* Default selector used by HomePage
|
||||||
|
|||||||
@ -16,14 +16,13 @@ import { Switch, Route } from 'react-router-dom';
|
|||||||
import { isEmpty } from 'lodash';
|
import { isEmpty } from 'lodash';
|
||||||
import { pluginId } from 'app';
|
import { pluginId } from 'app';
|
||||||
|
|
||||||
import injectSaga from 'utils/injectSaga';
|
|
||||||
|
|
||||||
import HomePage from 'containers/HomePage';
|
import HomePage from 'containers/HomePage';
|
||||||
|
|
||||||
import { menuFetch, environmentsFetch } from './actions';
|
import { menuFetch, environmentsFetch } from './actions';
|
||||||
import { makeSelectLoading, makeSelectSections } from './selectors';
|
import { makeSelectLoading, makeSelectSections } from './selectors';
|
||||||
import styles from './styles.scss';
|
import styles from './styles.scss';
|
||||||
|
|
||||||
|
import reducer from './reducer';
|
||||||
import saga from './sagas';
|
import saga from './sagas';
|
||||||
|
|
||||||
/* eslint-disable react/require-default-props */
|
/* eslint-disable react/require-default-props */
|
||||||
@ -95,9 +94,11 @@ const mapStateToProps = createStructuredSelector({
|
|||||||
// Wrap the component to inject dispatch and state into it
|
// Wrap the component to inject dispatch and state into it
|
||||||
const withConnect = connect(mapStateToProps, mapDispatchToProps);
|
const withConnect = connect(mapStateToProps, mapDispatchToProps);
|
||||||
|
|
||||||
const withSaga = injectSaga({ key: 'global', saga });
|
const withReducer = strapi.injectReducer({ key: 'global', reducer, pluginId: 'settings-manager' });
|
||||||
|
const withSaga = strapi.injectSaga({ key: 'global', saga, pluginId: 'settings-manager' });
|
||||||
|
|
||||||
export default compose(
|
export default compose(
|
||||||
|
withReducer,
|
||||||
withSaga,
|
withSaga,
|
||||||
withConnect,
|
withConnect,
|
||||||
)(App);
|
)(App);
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import { createSelector } from 'reselect';
|
|||||||
* Direct selector to the list state domain
|
* Direct selector to the list state domain
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const selectGlobalDomain = () => state => state.get('global');
|
const selectGlobalDomain = () => state => state.get('settings-manager-global');
|
||||||
|
|
||||||
const selectLocationState = () => {
|
const selectLocationState = () => {
|
||||||
let prevRoutingState;
|
let prevRoutingState;
|
||||||
|
|||||||
@ -45,8 +45,6 @@ import { makeSelectSections, makeSelectEnvironments } from 'containers/App/selec
|
|||||||
|
|
||||||
// utils
|
// utils
|
||||||
import unknowFlag from 'assets/images/unknow_flag.png';
|
import unknowFlag from 'assets/images/unknow_flag.png';
|
||||||
import injectReducer from 'utils/injectReducer';
|
|
||||||
import injectSaga from 'utils/injectSaga';
|
|
||||||
import supportedFlags from 'utils/supportedFlags.json';
|
import supportedFlags from 'utils/supportedFlags.json';
|
||||||
import { checkFormValidity, getRequiredInputsDb } from '../../utils/inputValidations';
|
import { checkFormValidity, getRequiredInputsDb } from '../../utils/inputValidations';
|
||||||
import getFlag, { formatLanguageLocale } from '../../utils/getFlag';
|
import getFlag, { formatLanguageLocale } from '../../utils/getFlag';
|
||||||
@ -564,8 +562,8 @@ HomePage.propTypes = {
|
|||||||
|
|
||||||
const withConnect = connect(mapStateToProps, mapDispatchToProps);
|
const withConnect = connect(mapStateToProps, mapDispatchToProps);
|
||||||
|
|
||||||
const withReducer = injectReducer({ key: 'homePage', reducer });
|
const withReducer = strapi.injectReducer({ key: 'homePage', reducer, pluginId: 'settings-manager' });
|
||||||
const withSaga = injectSaga({ key: 'homePage', saga });
|
const withSaga = strapi.injectSaga({ key: 'homePage', saga, pluginId: 'settings-manager' });
|
||||||
|
|
||||||
export default compose(
|
export default compose(
|
||||||
withReducer,
|
withReducer,
|
||||||
|
|||||||
@ -1,6 +1,15 @@
|
|||||||
import { LOCATION_CHANGE } from 'react-router-redux';
|
// import { LOCATION_CHANGE } from 'react-router-redux';
|
||||||
import { forEach, set, map, replace } from 'lodash';
|
import { forEach, set, map, replace } from 'lodash';
|
||||||
import { all, call, take, put, fork, cancel, select, takeLatest } from 'redux-saga/effects';
|
import {
|
||||||
|
all,
|
||||||
|
call,
|
||||||
|
// take,
|
||||||
|
put,
|
||||||
|
fork,
|
||||||
|
// cancel,
|
||||||
|
select,
|
||||||
|
takeLatest,
|
||||||
|
} from 'redux-saga/effects';
|
||||||
import request from 'utils/request';
|
import request from 'utils/request';
|
||||||
// selectors
|
// selectors
|
||||||
import { makeSelectModifiedData } from './selectors';
|
import { makeSelectModifiedData } from './selectors';
|
||||||
@ -240,28 +249,40 @@ export function* fetchSpecificDatabase(action) {
|
|||||||
|
|
||||||
// Individual exports for testing
|
// Individual exports for testing
|
||||||
export function* defaultSaga() {
|
export function* defaultSaga() {
|
||||||
const loadConfigWatcher = yield fork(takeLatest, CONFIG_FETCH, fetchConfig);
|
yield fork(takeLatest, CONFIG_FETCH, fetchConfig);
|
||||||
const loadLanguagesWatcher = yield fork(takeLatest, LANGUAGES_FETCH, fetchLanguages);
|
yield fork(takeLatest, LANGUAGES_FETCH, fetchLanguages);
|
||||||
const editConfigWatcher = yield fork(takeLatest, EDIT_SETTINGS, settingsEdit);
|
yield fork(takeLatest, EDIT_SETTINGS, settingsEdit);
|
||||||
const postLanguageWatcher = yield fork(takeLatest, NEW_LANGUAGE_POST, postLanguage);
|
yield fork(takeLatest, NEW_LANGUAGE_POST, postLanguage);
|
||||||
const deleteLanguageWatcher = yield fork(takeLatest, LANGUAGE_DELETE, deleteLanguage);
|
yield fork(takeLatest, LANGUAGE_DELETE, deleteLanguage);
|
||||||
const loadDatabasesWatcher = yield fork(takeLatest, DATABASES_FETCH, fetchDatabases);
|
yield fork(takeLatest, DATABASES_FETCH, fetchDatabases);
|
||||||
const postDatabaseWatcher = yield fork(takeLatest, NEW_DATABASE_POST, postDatabase);
|
yield fork(takeLatest, NEW_DATABASE_POST, postDatabase);
|
||||||
const deleteDatabaseWatcher = yield fork(takeLatest, DATABASE_DELETE, deleteDatabase);
|
yield fork(takeLatest, DATABASE_DELETE, deleteDatabase);
|
||||||
const fetchSpecificDatabaseWatcher = yield fork(takeLatest, SPECIFIC_DATABASE_FETCH, fetchSpecificDatabase);
|
yield fork(takeLatest, SPECIFIC_DATABASE_FETCH, fetchSpecificDatabase);
|
||||||
const editDatabaseWatcher = yield fork(takeLatest, DATABASE_EDIT, editDatabase);
|
yield fork(takeLatest, DATABASE_EDIT, editDatabase);
|
||||||
|
|
||||||
yield take(LOCATION_CHANGE);
|
// TODO Fix router (Other PR)
|
||||||
yield cancel(loadConfigWatcher);
|
// const loadConfigWatcher = yield fork(takeLatest, CONFIG_FETCH, fetchConfig);
|
||||||
yield cancel(loadLanguagesWatcher);
|
// const loadLanguagesWatcher = yield fork(takeLatest, LANGUAGES_FETCH, fetchLanguages);
|
||||||
yield cancel(editConfigWatcher);
|
// const editConfigWatcher = yield fork(takeLatest, EDIT_SETTINGS, settingsEdit);
|
||||||
yield cancel(postLanguageWatcher);
|
// const postLanguageWatcher = yield fork(takeLatest, NEW_LANGUAGE_POST, postLanguage);
|
||||||
yield cancel(deleteLanguageWatcher);
|
// const deleteLanguageWatcher = yield fork(takeLatest, LANGUAGE_DELETE, deleteLanguage);
|
||||||
yield cancel(loadDatabasesWatcher);
|
// const loadDatabasesWatcher = yield fork(takeLatest, DATABASES_FETCH, fetchDatabases);
|
||||||
yield cancel(postDatabaseWatcher);
|
// const postDatabaseWatcher = yield fork(takeLatest, NEW_DATABASE_POST, postDatabase);
|
||||||
yield cancel(deleteDatabaseWatcher);
|
// const deleteDatabaseWatcher = yield fork(takeLatest, DATABASE_DELETE, deleteDatabase);
|
||||||
yield cancel(fetchSpecificDatabaseWatcher);
|
// const fetchSpecificDatabaseWatcher = yield fork(takeLatest, SPECIFIC_DATABASE_FETCH, fetchSpecificDatabase);
|
||||||
yield cancel(editDatabaseWatcher);
|
// const editDatabaseWatcher = yield fork(takeLatest, DATABASE_EDIT, editDatabase);
|
||||||
|
|
||||||
|
// yield take(LOCATION_CHANGE);
|
||||||
|
// yield cancel(loadConfigWatcher);
|
||||||
|
// yield cancel(loadLanguagesWatcher);
|
||||||
|
// yield cancel(editConfigWatcher);
|
||||||
|
// yield cancel(postLanguageWatcher);
|
||||||
|
// yield cancel(deleteLanguageWatcher);
|
||||||
|
// yield cancel(loadDatabasesWatcher);
|
||||||
|
// yield cancel(postDatabaseWatcher);
|
||||||
|
// yield cancel(deleteDatabaseWatcher);
|
||||||
|
// yield cancel(fetchSpecificDatabaseWatcher);
|
||||||
|
// yield cancel(editDatabaseWatcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
// All sagas to be loaded
|
// All sagas to be loaded
|
||||||
|
|||||||
@ -3,7 +3,7 @@ import { createSelector } from 'reselect';
|
|||||||
/**
|
/**
|
||||||
* Direct selector to the home state domain
|
* Direct selector to the home state domain
|
||||||
*/
|
*/
|
||||||
const selectHomePageDomain = () => state => state.get('homePage');
|
const selectHomePageDomain = () => state => state.get('settings-manager-homePage');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Other specific selectors
|
* Other specific selectors
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user