|
@@ -18,6 +18,7 @@ class GrowiArchiveSection extends React.Component {
|
|
|
this.initialState = {
|
|
this.initialState = {
|
|
|
fileName: null,
|
|
fileName: null,
|
|
|
innerFileStats: null,
|
|
innerFileStats: null,
|
|
|
|
|
+ isTheSameVersion: null,
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
this.state = this.initialState;
|
|
this.state = this.initialState;
|
|
@@ -25,6 +26,8 @@ class GrowiArchiveSection extends React.Component {
|
|
|
this.handleUpload = this.handleUpload.bind(this);
|
|
this.handleUpload = this.handleUpload.bind(this);
|
|
|
this.discardData = this.discardData.bind(this);
|
|
this.discardData = this.discardData.bind(this);
|
|
|
this.resetState = this.resetState.bind(this);
|
|
this.resetState = this.resetState.bind(this);
|
|
|
|
|
+ this.handleMismatchedVersions = this.handleMismatchedVersions.bind(this);
|
|
|
|
|
+ this.renderDefferentVersionAlert = this.renderDefferentVersionAlert.bind(this);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async componentWillMount() {
|
|
async componentWillMount() {
|
|
@@ -33,14 +36,19 @@ class GrowiArchiveSection extends React.Component {
|
|
|
|
|
|
|
|
if (res.data.zipFileStat != null) {
|
|
if (res.data.zipFileStat != null) {
|
|
|
const { fileName, innerFileStats } = res.data.zipFileStat;
|
|
const { fileName, innerFileStats } = res.data.zipFileStat;
|
|
|
- this.setState({ fileName, innerFileStats });
|
|
|
|
|
|
|
+ const { isTheSameVersion } = res.data;
|
|
|
|
|
+
|
|
|
|
|
+ this.setState({ fileName, innerFileStats, isTheSameVersion });
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- handleUpload({ meta, fileName, innerFileStats }) {
|
|
|
|
|
|
|
+ handleUpload({
|
|
|
|
|
+ meta, fileName, innerFileStats,
|
|
|
|
|
+ }) {
|
|
|
this.setState({
|
|
this.setState({
|
|
|
fileName,
|
|
fileName,
|
|
|
innerFileStats,
|
|
innerFileStats,
|
|
|
|
|
+ isTheSameVersion: true,
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -74,18 +82,51 @@ class GrowiArchiveSection extends React.Component {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ handleMismatchedVersions(err) {
|
|
|
|
|
+ this.setState({
|
|
|
|
|
+ isTheSameVersion: false,
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ renderDefferentVersionAlert() {
|
|
|
|
|
+ const { t } = this.props;
|
|
|
|
|
+ return (
|
|
|
|
|
+ <div className="alert alert-warning mt-3">
|
|
|
|
|
+ {t('admin:importer_management.growi_settings.errors.different_versions')}
|
|
|
|
|
+ </div>
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
resetState() {
|
|
resetState() {
|
|
|
this.setState(this.initialState);
|
|
this.setState(this.initialState);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
render() {
|
|
|
const { t } = this.props;
|
|
const { t } = this.props;
|
|
|
|
|
+ const { isTheSameVersion } = this.state;
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<Fragment>
|
|
<Fragment>
|
|
|
<h2>{t('admin:importer_management.import_growi_archive')}</h2>
|
|
<h2>{t('admin:importer_management.import_growi_archive')}</h2>
|
|
|
-
|
|
|
|
|
- {this.state.fileName != null ? (
|
|
|
|
|
|
|
+ <div className="card well mb-4 small">
|
|
|
|
|
+ <ul>
|
|
|
|
|
+ <li>{t('admin:importer_management.skip_username_and_email_when_overlapped')}</li>
|
|
|
|
|
+ <li>{t('admin:importer_management.prepare_new_account_for_migration')}</li>
|
|
|
|
|
+ <li>
|
|
|
|
|
+ <a
|
|
|
|
|
+ href={`${t('admin:importer_management.admin_archive_data_import_guide_url')}`}
|
|
|
|
|
+ target="_blank"
|
|
|
|
|
+ rel="noopener noreferrer"
|
|
|
|
|
+ >{t('admin:importer_management.archive_data_import_detail')}
|
|
|
|
|
+ </a>
|
|
|
|
|
+ </li>
|
|
|
|
|
+ </ul>
|
|
|
|
|
+ </div>
|
|
|
|
|
+
|
|
|
|
|
+ {isTheSameVersion === false && this.renderDefferentVersionAlert()}
|
|
|
|
|
+ {this.state.fileName != null && isTheSameVersion === true ? (
|
|
|
<div className="px-4">
|
|
<div className="px-4">
|
|
|
<ImportForm
|
|
<ImportForm
|
|
|
fileName={this.state.fileName}
|
|
fileName={this.state.fileName}
|
|
@@ -94,10 +135,11 @@ class GrowiArchiveSection extends React.Component {
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
|
)
|
|
)
|
|
|
- : (
|
|
|
|
|
- <UploadForm
|
|
|
|
|
- onUpload={this.handleUpload}
|
|
|
|
|
- />
|
|
|
|
|
|
|
+ : (
|
|
|
|
|
+ <UploadForm
|
|
|
|
|
+ onUpload={this.handleUpload}
|
|
|
|
|
+ onVersionMismatch={this.handleMismatchedVersions}
|
|
|
|
|
+ />
|
|
|
)}
|
|
)}
|
|
|
</Fragment>
|
|
</Fragment>
|
|
|
);
|
|
);
|