Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[zip download dialog] redesigned it for 'display error msg' #5796

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions frontend/src/components/dialog/zip-download-dialog.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import { Modal, ModalHeader, ModalBody } from 'reactstrap';
import { gettext, fileServerRoot } from '../../utils/constants';
import { mediaUrl, gettext, fileServerRoot } from '../../utils/constants';
import { seafileAPI } from '../../utils/seafile-api';
import { Utils } from '../../utils/utils';
import Loading from '../loading';
Expand Down Expand Up @@ -64,9 +64,20 @@ class ZipDownloadDialog extends React.Component {
const data = res.data;
if (data.failed == 1) {
clearInterval(interval);
let errorMsg;
switch (data.failed_reason) { // returned from seaserv
case 'size too large':
errorMsg = gettext('Failed to download. The total size of the files exceeded the limit.');
break;
case 'internal error':
errorMsg = gettext('Internal Server Error');
break;
default:
errorMsg = gettext('Error');
}
this.setState({
isLoading: false,
errorMsg: data.failed_reason
errorMsg: errorMsg
});
} else {
this.setState({
Expand Down Expand Up @@ -128,7 +139,12 @@ class Content extends React.Component {
}

if (errorMsg) {
return <p className="error mt-4 text-center">{errorMsg}</p>;
return (
<div className="text-center mt-7 mb-8">
<img src={`${mediaUrl}img/error-tip.png`} alt="" width="100" />
<p className="mt-3">{errorMsg}</p>
</div>
);
}

return <p className="mt-4 text-center">{`${gettext('Packaging...')} ${zipProgress}`}</p>;
Expand Down
Binary file added media/img/error-tip.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading