|
|
@@ -3,16 +3,17 @@ import { withTranslation } from 'react-i18next';
|
|
|
import PropTypes from 'prop-types';
|
|
|
import loggerFactory from '@alias/logger';
|
|
|
|
|
|
-import { createSubscribedElement } from '../UnstatedUtils';
|
|
|
-import { toastError } from '../../util/apiNotification';
|
|
|
+import { createSubscribedElement } from '../../UnstatedUtils';
|
|
|
+import { toastError } from '../../../util/apiNotification';
|
|
|
|
|
|
-import AppContainer from '../../services/AppContainer';
|
|
|
+import AppContainer from '../../../services/AppContainer';
|
|
|
+import AdminAppContainer from '../../../services/AdminAppContainer';
|
|
|
|
|
|
-import AppSetting from './App/AppSetting';
|
|
|
-import SiteUrlSetting from './App/SiteUrlSetting';
|
|
|
-import MailSetting from './App/MailSetting';
|
|
|
-import AwsSetting from './App/AwsSetting';
|
|
|
-import PluginSetting from './App/PluginSetting';
|
|
|
+import AppSetting from './AppSetting';
|
|
|
+import SiteUrlSetting from './SiteUrlSetting';
|
|
|
+import MailSetting from './MailSetting';
|
|
|
+import AwsSetting from './AwsSetting';
|
|
|
+import PluginSetting from './PluginSetting';
|
|
|
|
|
|
const logger = loggerFactory('growi:appSettings');
|
|
|
|
|
|
@@ -22,35 +23,20 @@ class AppSettingPage extends React.Component {
|
|
|
super(props);
|
|
|
this.state = {
|
|
|
isLoading: true,
|
|
|
- title: '',
|
|
|
- confidential: '',
|
|
|
- globalLang: '',
|
|
|
- fileUpload: '',
|
|
|
- siteUrl: '',
|
|
|
- envSiteUrl: '',
|
|
|
- isSetSiteUrl: true,
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
async componentDidMount() {
|
|
|
+ const { adminAppContainer } = this.props;
|
|
|
+
|
|
|
try {
|
|
|
- const response = await this.props.appContainer.apiv3.get('/app-settings/');
|
|
|
- const appSettingParams = response.data.appSettingParams;
|
|
|
-
|
|
|
- this.setState({
|
|
|
- isLoading: false,
|
|
|
- title: appSettingParams.title || '',
|
|
|
- confidential: appSettingParams.confidential || '',
|
|
|
- globalLang: appSettingParams.globalLang || 'en-US',
|
|
|
- fileUpload: appSettingParams.fileUpload || false,
|
|
|
- siteUrl: appSettingParams.siteUrl || appSettingParams.envSiteUrl || '',
|
|
|
- envSiteUrl: appSettingParams.envSiteUrl || '',
|
|
|
- isSetSiteUrl: !!appSettingParams.siteUrl,
|
|
|
- });
|
|
|
+ await adminAppContainer.retrieveAppSettingsData();
|
|
|
+ this.setState({ isLoading: false });
|
|
|
}
|
|
|
catch (err) {
|
|
|
toastError(err);
|
|
|
+ adminAppContainer.setState({ retrieveError: err });
|
|
|
logger.error(err);
|
|
|
}
|
|
|
}
|
|
|
@@ -63,23 +49,14 @@ class AppSettingPage extends React.Component {
|
|
|
<div className="row">
|
|
|
<div className="col-md-12">
|
|
|
<h2>{t('App Settings')}</h2>
|
|
|
- <AppSetting
|
|
|
- title={this.state.title}
|
|
|
- confidential={this.state.confidential}
|
|
|
- globalLang={this.state.globalLang}
|
|
|
- fileUpload={this.state.fileUpload}
|
|
|
- />
|
|
|
+ <AppSetting />
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
<div className="row">
|
|
|
<div className="col-md-12">
|
|
|
<h2>{t('Site URL settings')}</h2>
|
|
|
- <SiteUrlSetting
|
|
|
- siteUrl={this.state.siteUrl}
|
|
|
- envSiteUrl={this.state.envSiteUrl}
|
|
|
- isSetSiteUrl={this.state.isSetSiteUrl}
|
|
|
- />
|
|
|
+ <SiteUrlSetting />
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
@@ -112,13 +89,14 @@ class AppSettingPage extends React.Component {
|
|
|
AppSettingPage.propTypes = {
|
|
|
t: PropTypes.func.isRequired, // i18next
|
|
|
appContainer: PropTypes.instanceOf(AppContainer).isRequired,
|
|
|
+ adminAppContainer: PropTypes.instanceOf(AdminAppContainer).isRequired,
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* Wrapper component for using unstated
|
|
|
*/
|
|
|
const AppSettingPageWrapper = (props) => {
|
|
|
- return createSubscribedElement(AppSettingPage, props, [AppContainer]);
|
|
|
+ return createSubscribedElement(AppSettingPage, props, [AppContainer, AdminAppContainer]);
|
|
|
};
|
|
|
|
|
|
|