mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-22 20:08:19 +00:00
update
This commit is contained in:
@@ -3,7 +3,7 @@ import ReactDOM from 'react-dom';
|
|||||||
import { Button, Dropdown, DropdownToggle, DropdownItem } from 'reactstrap';
|
import { Button, Dropdown, DropdownToggle, DropdownItem } from 'reactstrap';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import Account from './components/common/account';
|
import Account from './components/common/account';
|
||||||
import { isPro, gettext, siteRoot, mediaUrl, logoPath, logoWidth, logoHeight, siteTitle, thumbnailSizeForOriginal } from './utils/constants';
|
import { isPro, useGoFileserver, fileServerRoot, gettext, siteRoot, mediaUrl, logoPath, logoWidth, logoHeight, siteTitle, thumbnailSizeForOriginal } from './utils/constants';
|
||||||
import { Utils } from './utils/utils';
|
import { Utils } from './utils/utils';
|
||||||
import { seafileAPI } from './utils/seafile-api';
|
import { seafileAPI } from './utils/seafile-api';
|
||||||
import Loading from './components/loading';
|
import Loading from './components/loading';
|
||||||
@@ -141,13 +141,28 @@ class SharedDirView extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
zipDownloadFolder = (folderPath) => {
|
zipDownloadFolder = (folderPath) => {
|
||||||
|
if (!useGoFileserver) {
|
||||||
this.setState({
|
this.setState({
|
||||||
isZipDialogOpen: true,
|
isZipDialogOpen: true,
|
||||||
zipFolderPath: folderPath
|
zipFolderPath: folderPath
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
seafileAPI.getShareLinkZipTask(token, folderPath).then((res) => {
|
||||||
|
const zipToken = res.data['zip_token'];
|
||||||
|
location.href = `${fileServerRoot}zip/${zipToken}`;
|
||||||
|
}).catch((error) => {
|
||||||
|
let errorMsg = Utils.getErrorMsg(error);
|
||||||
|
this.setState({
|
||||||
|
isLoading: false,
|
||||||
|
errorMsg: errorMsg
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
zipDownloadSelectedItems = () => {
|
zipDownloadSelectedItems = () => {
|
||||||
|
if (!useGoFileserver) {
|
||||||
this.setState({
|
this.setState({
|
||||||
isZipDialogOpen: true,
|
isZipDialogOpen: true,
|
||||||
zipFolderPath: relativePath,
|
zipFolderPath: relativePath,
|
||||||
@@ -155,6 +170,20 @@ class SharedDirView extends React.Component {
|
|||||||
.map(item => item.file_name || item.folder_name)
|
.map(item => item.file_name || item.folder_name)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
let target = this.state.items.filter(item => item.isSelected).map(item => item.file_name || item.folder_name);
|
||||||
|
seafileAPI.getShareLinkDirentsZipTask(token, relativePath, target).then((res) => {
|
||||||
|
const zipToken = res.data['zip_token'];
|
||||||
|
location.href = `${fileServerRoot}zip/${zipToken}`;
|
||||||
|
}).catch((error) => {
|
||||||
|
let errorMsg = Utils.getErrorMsg(error);
|
||||||
|
this.setState({
|
||||||
|
isLoading: false,
|
||||||
|
errorMsg: errorMsg
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
closeZipDialog = () => {
|
closeZipDialog = () => {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
Reference in New Issue
Block a user