1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-19 18:29:23 +00:00

12.0 grid view support multiple selection (#6403)

* Feature - multiple selection with ctrl/shift

* update grid view context menu list in multiple selection mode

* fix code format

* optimize codes
This commit is contained in:
Aries
2024-07-23 23:08:53 +08:00
committed by GitHub
parent 2bc5ef7957
commit be84e505d0
35 changed files with 220 additions and 103 deletions

View File

@@ -105,7 +105,7 @@ class CopyDirent extends React.Component {
}
// copy the dirent to it's child. eg: A/B -> A/B/C
if ( selectedPath && selectedPath.length > direntPath.length && selectedPath.indexOf(direntPath) > -1) {
if (selectedPath && selectedPath.length > direntPath.length && selectedPath.indexOf(direntPath) > -1) {
message = gettext('Can not copy directory %(src)s to its subdirectory %(des)s');
message = message.replace('%(src)s', direntPath);
message = message.replace('%(des)s', selectedPath);

View File

@@ -119,7 +119,7 @@ class MoveDirent extends React.Component {
}
// copy the dirent to it's child. eg: A/B -> A/B/C
if ( selectedPath && selectedPath.length > direntPath.length && selectedPath.indexOf(direntPath) > -1) {
if (selectedPath && selectedPath.length > direntPath.length && selectedPath.indexOf(direntPath) > -1) {
message = gettext('Can not move directory %(src)s to its subdirectory %(des)s');
message = message.replace('%(src)s', direntPath);
message = message.replace('%(des)s', selectedPath);

View File

@@ -56,7 +56,7 @@ class OpMenu extends React.Component {
aria-expanded={this.state.isItemMenuShow}
/>
<DropdownMenu className="my-1 mr-2">
{operations.map((item, index ) => {
{operations.map((item, index) => {
return (<DropdownItem key={index} data-op={item} onClick={this.onMenuItemClick}>{translateOperations(item)}</DropdownItem>);
})}
</DropdownMenu>

View File

@@ -209,7 +209,7 @@ class ShareToUser extends React.Component {
let users = [];
let path = this.props.itemPath;
let repoID = this.props.repoID;
if (this.state.selectedOption && this.state.selectedOption.length > 0 ) {
if (this.state.selectedOption && this.state.selectedOption.length > 0) {
for (let i = 0; i < this.state.selectedOption.length; i ++) {
users[i] = this.state.selectedOption[i].email;
}
@@ -284,7 +284,7 @@ class ShareToUser extends React.Component {
if (this.props.isGroupOwnedRepo) {
seafileAPI.deleteGroupOwnedRepoSharedUserItem(repoID, username, path).then(res => {
this.setState({
sharedItems: this.state.sharedItems.filter( item => { return item.user_info.name !== username; })
sharedItems: this.state.sharedItems.filter(item => { return item.user_info.name !== username; })
});
}).catch(error => {
let errMessage = Utils.getErrorMsg(error);
@@ -293,7 +293,7 @@ class ShareToUser extends React.Component {
} else {
seafileAPI.deleteShareToUserItem(repoID, path, 'user', username).then(res => {
this.setState({
sharedItems: this.state.sharedItems.filter( item => { return item.user_info.name !== username; })
sharedItems: this.state.sharedItems.filter(item => { return item.user_info.name !== username; })
});
}).catch(error => {
let errMessage = Utils.getErrorMsg(error);

View File

@@ -51,18 +51,18 @@ class LogsExportExcelDialog extends React.Component {
this.props.toggle();
return systemAdminAPI.queryAsyncOperationExportExcel(task_id);
}).then(res => {
if (res.data.is_finished === true){
if (res.data.is_finished === true) {
location.href = siteRoot + 'sys/log/export-excel/?task_id=' + task_id + '&log_type=' + logType;
} else {
this.timer = setInterval(() => {
systemAdminAPI.queryAsyncOperationExportExcel(task_id).then(res => {
if (res.data.is_finished === true){
if (res.data.is_finished === true) {
this.setState({ isFinished: true });
clearInterval(this.timer);
location.href = siteRoot + 'sys/log/export-excel/?task_id=' + task_id + '&log_type=' + logType;
}
}).catch(err => {
if (this.state.isFinished === false){
if (this.state.isFinished === false) {
clearInterval(this.timer);
toaster.danger(gettext('Failed to export. Please check whether the size of table attachments exceeds the limit.'));
}

View File

@@ -149,7 +149,7 @@ class SysAdminShareToUser extends React.Component {
shareToUser = () => {
let users = [];
let repoID = this.props.repoID;
if (this.state.selectedOption && this.state.selectedOption.length > 0 ) {
if (this.state.selectedOption && this.state.selectedOption.length > 0) {
for (let i = 0; i < this.state.selectedOption.length; i ++) {
users[i] = this.state.selectedOption[i].email;
}
@@ -186,7 +186,7 @@ class SysAdminShareToUser extends React.Component {
let repoID = this.props.repoID;
seafileAPI.sysAdminDeleteRepoSharedItem(repoID, 'user', useremail).then(res => {
this.setState({
sharedItems: this.state.sharedItems.filter( item => { return item.user_email !== useremail; })
sharedItems: this.state.sharedItems.filter(item => { return item.user_email !== useremail; })
});
}).catch(error => {
let errMessage = Utils.getErrorMsg(error);

View File

@@ -49,7 +49,7 @@ class TrashDialog extends React.Component {
getItems2 = (page) => {
repotrashAPI.getRepoFolderTrash2(this.props.repoID, page, this.state.perPage).then((res) => {
const { items, total_count } = res.data;
if (!page){
if (!page) {
page = 1;
}
this.setState({