2018-12-08 03:53:45 +00:00
|
|
|
import React, { Fragment } from 'react';
|
2018-12-08 00:37:18 +00:00
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import moment from 'moment';
|
2018-12-08 03:53:45 +00:00
|
|
|
import { Dropdown, DropdownMenu, DropdownToggle, DropdownItem } from 'reactstrap';
|
2022-12-29 04:21:47 +00:00
|
|
|
import { Link, navigate } from '@gatsbyjs/reach-router';
|
2018-12-08 00:37:18 +00:00
|
|
|
import { Utils } from '../../utils/utils';
|
2023-12-29 04:20:32 +00:00
|
|
|
import { gettext, siteRoot, isPro, username, folderPermEnabled, isSystemStaff, enableResetEncryptedRepoPassword, isEmailConfigured, enableRepoAutoDel, enableSeaTableIntegration } from '../../utils/constants';
|
2019-05-15 06:04:29 +00:00
|
|
|
import ModalPortal from '../../components/modal-portal';
|
2018-12-14 08:34:10 +00:00
|
|
|
import ShareDialog from '../../components/dialog/share-dialog';
|
2019-05-15 06:04:29 +00:00
|
|
|
import LibSubFolderPermissionDialog from '../../components/dialog/lib-sub-folder-permission-dialog';
|
2019-06-18 14:17:50 +00:00
|
|
|
import DeleteRepoDialog from '../../components/dialog/delete-repo-dialog';
|
2020-09-19 12:48:02 +00:00
|
|
|
import ChangeRepoPasswordDialog from '../../components/dialog/change-repo-password-dialog';
|
|
|
|
import ResetEncryptedRepoPasswordDialog from '../../components/dialog/reset-encrypted-repo-password-dialog';
|
2023-10-17 13:08:07 +00:00
|
|
|
import LibOldFilesAutoDelDialog from '../../components/dialog/lib-old-files-auto-del-dialog';
|
2023-12-29 04:20:32 +00:00
|
|
|
import RepoSeaTableIntegrationDialog from '../../components/dialog/repo-seatable-integration-dialog';
|
2019-02-11 07:22:42 +00:00
|
|
|
import Rename from '../rename';
|
2019-02-26 06:14:00 +00:00
|
|
|
import { seafileAPI } from '../../utils/seafile-api';
|
2019-06-28 02:29:03 +00:00
|
|
|
import LibHistorySettingDialog from '../dialog/lib-history-setting-dialog';
|
2019-07-16 02:01:09 +00:00
|
|
|
import toaster from '../toast';
|
2020-03-11 03:10:48 +00:00
|
|
|
import RepoAPITokenDialog from '../dialog/repo-api-token-dialog';
|
2023-08-24 02:18:40 +00:00
|
|
|
import RepoShareAdminDialog from '../dialog/repo-share-admin-dialog';
|
2023-02-11 09:40:43 +00:00
|
|
|
import RepoMonitoredIcon from '../../components/repo-monitored-icon';
|
2018-12-08 00:37:18 +00:00
|
|
|
|
|
|
|
const propTypes = {
|
2024-06-17 01:32:05 +00:00
|
|
|
currentViewMode: PropTypes.string,
|
2018-12-08 08:35:00 +00:00
|
|
|
currentGroup: PropTypes.object,
|
2018-12-21 07:40:59 +00:00
|
|
|
libraryType: PropTypes.string,
|
2018-12-08 00:37:18 +00:00
|
|
|
repo: PropTypes.object.isRequired,
|
|
|
|
isItemFreezed: PropTypes.bool.isRequired,
|
2018-12-10 01:01:05 +00:00
|
|
|
onFreezedItem: PropTypes.func.isRequired,
|
2019-02-11 07:22:42 +00:00
|
|
|
onUnfreezedItem: PropTypes.func.isRequired,
|
2018-12-10 10:37:59 +00:00
|
|
|
onItemUnshare: PropTypes.func.isRequired,
|
2019-02-11 07:22:42 +00:00
|
|
|
onItemRename: PropTypes.func,
|
2019-05-15 06:56:46 +00:00
|
|
|
onItemDelete: PropTypes.func,
|
2023-02-11 09:40:43 +00:00
|
|
|
onMonitorRepo: PropTypes.func
|
2018-12-08 00:37:18 +00:00
|
|
|
};
|
|
|
|
|
2018-12-10 03:52:44 +00:00
|
|
|
class SharedRepoListItem extends React.Component {
|
2018-12-08 00:37:18 +00:00
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
super(props);
|
|
|
|
this.state = {
|
|
|
|
highlight: false,
|
|
|
|
isOperationShow: false,
|
|
|
|
isItemMenuShow: false,
|
2023-10-17 13:08:07 +00:00
|
|
|
isAdvancedMenuShown: false,
|
2018-12-14 08:34:10 +00:00
|
|
|
isShowSharedDialog: false,
|
2019-02-11 07:22:42 +00:00
|
|
|
isRenaming: false,
|
2019-02-26 06:14:00 +00:00
|
|
|
isStarred: this.props.repo.starred,
|
2019-06-18 14:17:50 +00:00
|
|
|
isFolderPermissionDialogOpen: false,
|
2019-06-28 02:29:03 +00:00
|
|
|
isHistorySettingDialogShow: false,
|
|
|
|
isDeleteDialogShow: false,
|
2019-11-07 06:10:37 +00:00
|
|
|
isAPITokenDialogShow: false,
|
2023-08-24 02:18:40 +00:00
|
|
|
isRepoShareAdminDialogOpen: false,
|
2020-07-27 03:06:59 +00:00
|
|
|
isRepoDeleted: false,
|
2020-09-19 12:48:02 +00:00
|
|
|
isChangePasswordDialogShow: false,
|
2023-10-17 13:08:07 +00:00
|
|
|
isResetPasswordDialogShow: false,
|
|
|
|
isOldFilesAutoDelDialogOpen: false,
|
2023-12-29 04:20:32 +00:00
|
|
|
isSeaTableIntegrationShow: false,
|
2018-12-08 00:37:18 +00:00
|
|
|
};
|
2019-07-02 03:48:34 +00:00
|
|
|
this.isDeparementOnwerGroupMember = false;
|
2018-12-08 00:37:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
onMouseEnter = () => {
|
2018-12-10 01:01:05 +00:00
|
|
|
if (!this.props.isItemFreezed) {
|
|
|
|
this.setState({
|
|
|
|
highlight: true,
|
|
|
|
isOperationShow: true,
|
|
|
|
});
|
|
|
|
}
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2018-12-10 09:59:26 +00:00
|
|
|
|
|
|
|
onMouseOver = () => {
|
|
|
|
if (!this.props.isItemFreezed) {
|
|
|
|
this.setState({
|
|
|
|
highlight: true,
|
|
|
|
isOperationShow: true,
|
|
|
|
});
|
|
|
|
}
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2020-11-02 05:56:35 +00:00
|
|
|
|
2018-12-08 00:37:18 +00:00
|
|
|
onMouseLeave = () => {
|
2018-12-10 01:01:05 +00:00
|
|
|
if (!this.props.isItemFreezed) {
|
|
|
|
this.setState({
|
|
|
|
highlight: false,
|
|
|
|
isOperationShow: false,
|
|
|
|
});
|
|
|
|
}
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2018-12-10 01:01:05 +00:00
|
|
|
|
|
|
|
clickOperationMenuToggle = (e) => {
|
2019-02-11 07:22:42 +00:00
|
|
|
this.toggleOperationMenu(e);
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2018-12-08 03:53:45 +00:00
|
|
|
|
2021-09-23 07:42:45 +00:00
|
|
|
onDropdownToggleKeyDown = (e) => {
|
|
|
|
if (e.key == 'Enter' || e.key == 'Space') {
|
|
|
|
this.clickOperationMenuToggle(e);
|
|
|
|
}
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2021-09-23 07:42:45 +00:00
|
|
|
|
2019-02-11 07:22:42 +00:00
|
|
|
toggleOperationMenu = (e) => {
|
|
|
|
let dataset = e.target ? e.target.dataset : null;
|
|
|
|
if (dataset && dataset.toggle && dataset.toggle === 'Rename') {
|
|
|
|
this.setState({isItemMenuShow: !this.state.isItemMenuShow});
|
|
|
|
return;
|
2018-12-10 01:01:05 +00:00
|
|
|
}
|
2020-11-02 05:56:35 +00:00
|
|
|
|
2019-02-11 07:22:42 +00:00
|
|
|
this.setState(
|
|
|
|
{isItemMenuShow: !this.state.isItemMenuShow},
|
|
|
|
() => {
|
|
|
|
if (this.state.isItemMenuShow) {
|
|
|
|
this.props.onFreezedItem();
|
|
|
|
} else {
|
|
|
|
this.props.onUnfreezedItem();
|
|
|
|
this.setState({
|
|
|
|
highlight: false,
|
|
|
|
isOperationShow: false,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
);
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2018-12-08 00:37:18 +00:00
|
|
|
|
2023-10-17 13:08:07 +00:00
|
|
|
toggleAdvancedMenuShown = (e) => {
|
|
|
|
this.setState({ isAdvancedMenuShown: true });
|
|
|
|
};
|
|
|
|
|
|
|
|
toggleAdvancedMenu = (e) => {
|
|
|
|
e.stopPropagation();
|
|
|
|
this.setState({ isAdvancedMenuShown: !this.state.isAdvancedMenuShown }, () => {
|
|
|
|
this.toggleOperationMenu(e);
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
onDropDownMouseMove = (e) => {
|
|
|
|
if (this.state.isAdvancedMenuShown && e.target && e.target.className === 'dropdown-item') {
|
|
|
|
this.setState({
|
|
|
|
isAdvancedMenuShown: false
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2018-12-08 00:37:18 +00:00
|
|
|
getRepoComputeParams = () => {
|
2024-06-17 01:32:05 +00:00
|
|
|
const { repo, currentViewMode } = this.props;
|
2020-11-02 05:56:35 +00:00
|
|
|
|
2024-06-17 01:32:05 +00:00
|
|
|
const useBigLibaryIcon = currentViewMode == 'grid';
|
|
|
|
const iconUrl = Utils.getLibIconUrl(repo, useBigLibaryIcon);
|
2019-01-29 07:22:02 +00:00
|
|
|
let iconTitle = Utils.getLibIconTitle(repo);
|
2018-12-13 03:05:47 +00:00
|
|
|
let libPath = `${siteRoot}library/${repo.repo_id}/${Utils.encodePath(repo.repo_name)}/`;
|
2018-12-08 00:37:18 +00:00
|
|
|
|
|
|
|
return { iconUrl, iconTitle, libPath };
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2018-12-08 00:37:18 +00:00
|
|
|
|
2021-09-23 07:42:45 +00:00
|
|
|
onMenuItemKeyDown = (e) => {
|
|
|
|
if (e.key == 'Enter' || e.key == 'Space') {
|
|
|
|
this.onMenuItemClick(e);
|
|
|
|
}
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2021-09-23 07:42:45 +00:00
|
|
|
|
2018-12-10 01:01:05 +00:00
|
|
|
onMenuItemClick = (e) => {
|
|
|
|
let operation = e.target.dataset.toggle;
|
|
|
|
switch(operation) {
|
|
|
|
case 'Rename':
|
2019-02-11 07:22:42 +00:00
|
|
|
this.onItemRenameToggle();
|
2018-12-10 01:01:05 +00:00
|
|
|
break;
|
|
|
|
case 'Folder Permission':
|
2019-05-15 06:04:29 +00:00
|
|
|
this.onItemFolderPermissionToggle();
|
2018-12-10 01:01:05 +00:00
|
|
|
break;
|
|
|
|
case 'Share':
|
2018-12-14 08:34:10 +00:00
|
|
|
this.onItemShare();
|
2018-12-10 01:01:05 +00:00
|
|
|
break;
|
|
|
|
case 'Unshare':
|
2018-12-10 10:37:59 +00:00
|
|
|
this.onItemUnshare();
|
2018-12-10 01:01:05 +00:00
|
|
|
break;
|
2019-06-28 02:29:03 +00:00
|
|
|
case 'History Setting':
|
|
|
|
this.onHistorySettingToggle();
|
|
|
|
break;
|
2019-11-07 06:10:37 +00:00
|
|
|
case 'API Token':
|
|
|
|
this.onAPITokenToggle();
|
|
|
|
break;
|
2023-08-24 02:18:40 +00:00
|
|
|
case 'Share Admin':
|
|
|
|
this.toggleRepoShareAdminDialog();
|
2020-03-11 03:10:48 +00:00
|
|
|
break;
|
2020-09-19 12:48:02 +00:00
|
|
|
case 'Change Password':
|
|
|
|
this.onChangePasswordToggle();
|
|
|
|
break;
|
|
|
|
case 'Reset Password':
|
|
|
|
this.onResetPasswordToggle();
|
|
|
|
break;
|
2023-02-11 09:40:43 +00:00
|
|
|
case 'Watch File Changes':
|
|
|
|
this.watchFileChanges();
|
|
|
|
break;
|
|
|
|
case 'Unwatch File Changes':
|
|
|
|
this.unwatchFileChanges();
|
2018-12-10 01:01:05 +00:00
|
|
|
break;
|
2023-10-17 13:08:07 +00:00
|
|
|
case 'Old Files Auto Delete':
|
|
|
|
this.toggleOldFilesAutoDelDialog();
|
|
|
|
break;
|
2023-12-29 04:20:32 +00:00
|
|
|
case 'SeaTable integration':
|
|
|
|
this.onSeaTableIntegrationToggle();
|
|
|
|
break;
|
2023-02-11 09:40:43 +00:00
|
|
|
// no default
|
2018-12-08 03:53:45 +00:00
|
|
|
}
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2018-12-08 03:53:45 +00:00
|
|
|
|
2023-02-11 09:40:43 +00:00
|
|
|
watchFileChanges = () => {
|
|
|
|
const { repo } = this.props;
|
|
|
|
seafileAPI.monitorRepo(repo.repo_id).then(() => {
|
|
|
|
this.props.onMonitorRepo(repo, true);
|
|
|
|
}).catch(error => {
|
|
|
|
let errMessage = Utils.getErrorMsg(error);
|
|
|
|
toaster.danger(errMessage);
|
|
|
|
});
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2023-02-11 09:40:43 +00:00
|
|
|
|
|
|
|
unwatchFileChanges = () => {
|
|
|
|
const { repo } = this.props;
|
|
|
|
seafileAPI.unMonitorRepo(repo.repo_id).then(() => {
|
|
|
|
this.props.onMonitorRepo(repo, false);
|
|
|
|
}).catch(error => {
|
|
|
|
let errMessage = Utils.getErrorMsg(error);
|
|
|
|
toaster.danger(errMessage);
|
|
|
|
});
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2023-02-11 09:40:43 +00:00
|
|
|
|
2019-02-11 07:22:42 +00:00
|
|
|
onItemRenameToggle = () => {
|
|
|
|
this.props.onFreezedItem();
|
|
|
|
this.setState({
|
|
|
|
isRenaming: !this.state.isRenaming,
|
|
|
|
isOperationShow: !this.state.isOperationShow
|
|
|
|
});
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2019-02-11 07:22:42 +00:00
|
|
|
|
|
|
|
onRenameConfirm = (name) => {
|
|
|
|
this.props.onItemRename(this.props.repo, name);
|
|
|
|
this.onRenameCancel();
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2020-11-02 05:56:35 +00:00
|
|
|
|
2019-02-11 07:22:42 +00:00
|
|
|
onRenameCancel = () => {
|
|
|
|
this.props.onUnfreezedItem();
|
|
|
|
this.setState({isRenaming: !this.state.isRenaming});
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2018-12-08 03:53:45 +00:00
|
|
|
|
2019-05-15 06:04:29 +00:00
|
|
|
onItemFolderPermissionToggle = () => {
|
|
|
|
this.setState({isFolderPermissionDialogOpen: !this.state.isFolderPermissionDialogOpen});
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2018-12-10 01:01:05 +00:00
|
|
|
|
2019-06-28 02:29:03 +00:00
|
|
|
onHistorySettingToggle = () => {
|
|
|
|
this.setState({isHistorySettingDialogShow: !this.state.isHistorySettingDialogShow});
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2019-06-28 02:29:03 +00:00
|
|
|
|
2021-09-23 06:46:49 +00:00
|
|
|
onItemShare = (e) => {
|
|
|
|
e.preventDefault();
|
2018-12-14 08:34:10 +00:00
|
|
|
this.setState({isShowSharedDialog: true});
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2018-12-10 01:01:05 +00:00
|
|
|
|
2021-09-23 06:46:49 +00:00
|
|
|
onItemUnshare = (e) => {
|
|
|
|
e.preventDefault();
|
2018-12-10 10:37:59 +00:00
|
|
|
this.props.onItemUnshare(this.props.repo);
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2018-12-08 03:53:45 +00:00
|
|
|
|
2021-09-23 06:46:49 +00:00
|
|
|
onItemDeleteToggle = (e) => {
|
|
|
|
e.preventDefault();
|
2019-06-24 07:44:22 +00:00
|
|
|
this.setState({isDeleteDialogShow: !this.state.isDeleteDialogShow});
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2018-12-08 03:53:45 +00:00
|
|
|
|
2020-07-27 03:06:59 +00:00
|
|
|
onItemDelete = () => {
|
|
|
|
const { currentGroup, repo } = this.props;
|
|
|
|
if (!currentGroup) { // repo can not be deleted in share all module
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const groupID = currentGroup.id;
|
|
|
|
|
|
|
|
seafileAPI.deleteGroupOwnedLibrary(groupID, repo.repo_id).then(() => {
|
2020-11-02 05:56:35 +00:00
|
|
|
|
2020-07-27 03:06:59 +00:00
|
|
|
this.setState({
|
|
|
|
isRepoDeleted: true,
|
|
|
|
isDeleteDialogShow: false,
|
|
|
|
});
|
2020-11-02 05:56:35 +00:00
|
|
|
|
2020-07-27 03:06:59 +00:00
|
|
|
this.props.onItemDelete(repo);
|
|
|
|
let name = repo.repo_name;
|
|
|
|
var msg = gettext('Successfully deleted {name}.').replace('{name}', name);
|
|
|
|
toaster.success(msg);
|
|
|
|
}).catch((error) => {
|
|
|
|
let errMessage = Utils.getErrorMsg(error);
|
|
|
|
if (errMessage === gettext('Error')) {
|
|
|
|
let name = repo.repo_name;
|
|
|
|
errMessage = gettext('Failed to delete {name}.').replace('{name}', name);
|
|
|
|
}
|
|
|
|
toaster.danger(errMessage);
|
|
|
|
|
|
|
|
this.setState({isRepoDeleted: false});
|
|
|
|
});
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2020-07-27 03:06:59 +00:00
|
|
|
|
2018-12-14 08:34:10 +00:00
|
|
|
toggleShareDialog = () => {
|
|
|
|
this.setState({isShowSharedDialog: false});
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2018-12-14 08:34:10 +00:00
|
|
|
|
2023-08-24 02:18:40 +00:00
|
|
|
toggleRepoShareAdminDialog = () => {
|
|
|
|
this.setState({isRepoShareAdminDialogOpen: !this.state.isRepoShareAdminDialogOpen});
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2020-03-11 03:10:48 +00:00
|
|
|
|
2023-10-17 13:08:07 +00:00
|
|
|
toggleOldFilesAutoDelDialog = () => {
|
|
|
|
this.setState({isOldFilesAutoDelDialogOpen: !this.state.isOldFilesAutoDelDialogOpen});
|
|
|
|
};
|
|
|
|
|
2023-12-29 04:20:32 +00:00
|
|
|
onSeaTableIntegrationToggle = () => {
|
|
|
|
this.setState({isSeaTableIntegrationShow: !this.state.isSeaTableIntegrationShow});
|
|
|
|
};
|
|
|
|
|
2019-11-07 06:10:37 +00:00
|
|
|
onAPITokenToggle = () => {
|
|
|
|
this.setState({isAPITokenDialogShow: !this.state.isAPITokenDialogShow});
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2019-11-07 06:10:37 +00:00
|
|
|
|
2020-09-19 12:48:02 +00:00
|
|
|
onChangePasswordToggle = () => {
|
|
|
|
this.setState({isChangePasswordDialogShow: !this.state.isChangePasswordDialogShow});
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2020-09-19 12:48:02 +00:00
|
|
|
|
|
|
|
onResetPasswordToggle = () => {
|
|
|
|
this.setState({isResetPasswordDialogShow: !this.state.isResetPasswordDialogShow});
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2020-09-19 12:48:02 +00:00
|
|
|
|
2019-01-28 08:32:32 +00:00
|
|
|
translateMenuItem = (menuItem) => {
|
|
|
|
let translateResult = '';
|
|
|
|
switch(menuItem) {
|
|
|
|
case 'Rename':
|
|
|
|
translateResult = gettext('Rename');
|
|
|
|
break;
|
|
|
|
case 'Folder Permission':
|
2020-01-13 10:52:44 +00:00
|
|
|
translateResult = gettext('Folder Permission');
|
2019-01-28 08:32:32 +00:00
|
|
|
break;
|
|
|
|
case 'Unshare':
|
|
|
|
translateResult = gettext('Unshare');
|
|
|
|
break;
|
|
|
|
case 'Share':
|
|
|
|
translateResult = gettext('Share');
|
|
|
|
break;
|
2019-06-28 02:29:03 +00:00
|
|
|
case 'History Setting':
|
|
|
|
translateResult = gettext('History Setting');
|
|
|
|
break;
|
2023-08-24 02:18:40 +00:00
|
|
|
case 'Share Admin':
|
|
|
|
translateResult = gettext('Share Admin');
|
2020-03-11 03:10:48 +00:00
|
|
|
break;
|
2020-09-19 12:48:02 +00:00
|
|
|
case 'Change Password':
|
|
|
|
translateResult = gettext('Change Password');
|
|
|
|
break;
|
|
|
|
case 'Reset Password':
|
|
|
|
translateResult = gettext('Reset Password');
|
|
|
|
break;
|
2023-02-11 09:40:43 +00:00
|
|
|
case 'Watch File Changes':
|
|
|
|
translateResult = gettext('Watch File Changes');
|
|
|
|
break;
|
|
|
|
case 'Unwatch File Changes':
|
|
|
|
translateResult = gettext('Unwatch File Changes');
|
|
|
|
break;
|
2023-10-17 13:08:07 +00:00
|
|
|
case 'Old Files Auto Delete':
|
|
|
|
translateResult = gettext('Auto Deletion Setting');
|
|
|
|
break;
|
2019-11-07 06:10:37 +00:00
|
|
|
case 'API Token':
|
2019-11-29 07:17:00 +00:00
|
|
|
translateResult = 'API Token'; // translation is not needed here
|
2019-11-07 06:10:37 +00:00
|
|
|
break;
|
2023-10-17 13:08:07 +00:00
|
|
|
case 'Advanced':
|
|
|
|
translateResult = gettext('Advanced');
|
|
|
|
break;
|
2023-12-29 04:20:32 +00:00
|
|
|
case 'SeaTable integration':
|
|
|
|
translateResult = gettext('SeaTable integration');
|
|
|
|
break;
|
2019-01-28 08:32:32 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return translateResult;
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2019-01-28 08:32:32 +00:00
|
|
|
|
2023-10-17 13:08:07 +00:00
|
|
|
getAdvancedOperations = () => {
|
|
|
|
const operations = [];
|
|
|
|
operations.push('API Token');
|
|
|
|
if (enableRepoAutoDel) {
|
|
|
|
operations.push('Old Files Auto Delete');
|
|
|
|
}
|
2023-12-29 04:20:32 +00:00
|
|
|
if (enableSeaTableIntegration) {
|
|
|
|
operations.push('SeaTable integration');
|
|
|
|
}
|
2023-10-17 13:08:07 +00:00
|
|
|
return operations;
|
|
|
|
};
|
|
|
|
|
2018-12-10 01:01:05 +00:00
|
|
|
generatorOperations = () => {
|
|
|
|
let { repo, currentGroup } = this.props;
|
2018-12-10 03:52:44 +00:00
|
|
|
//todo this have a bug; use current api is not return admins param;
|
2018-12-21 07:40:59 +00:00
|
|
|
let isStaff = currentGroup && currentGroup.admins && currentGroup.admins.indexOf(username) > -1; //for group repolist;
|
2018-12-10 01:01:05 +00:00
|
|
|
let isRepoOwner = repo.owner_email === username;
|
|
|
|
let isAdmin = repo.is_admin;
|
|
|
|
let operations = [];
|
2018-12-08 03:53:45 +00:00
|
|
|
if (isPro) {
|
2020-03-11 03:10:48 +00:00
|
|
|
if (repo.owner_email.indexOf('@seafile_group') != -1) {
|
2024-01-03 13:59:44 +00:00
|
|
|
// is group admin
|
2020-03-11 03:10:48 +00:00
|
|
|
if (isStaff) {
|
|
|
|
if (repo.owner_email == currentGroup.id + '@seafile_group') {
|
|
|
|
this.isDeparementOnwerGroupMember = true;
|
|
|
|
operations = ['Rename'];
|
|
|
|
if (folderPermEnabled) {
|
|
|
|
operations.push('Folder Permission');
|
|
|
|
}
|
2023-10-17 13:08:07 +00:00
|
|
|
operations.push('Share Admin', 'Divider');
|
2020-09-19 12:48:02 +00:00
|
|
|
if (repo.encrypted) {
|
|
|
|
operations.push('Change Password');
|
2020-11-02 05:56:35 +00:00
|
|
|
}
|
2020-09-19 12:48:02 +00:00
|
|
|
if (repo.encrypted && enableResetEncryptedRepoPassword && isEmailConfigured) {
|
|
|
|
operations.push('Reset Password');
|
2020-11-02 05:56:35 +00:00
|
|
|
}
|
2023-10-17 13:08:07 +00:00
|
|
|
if (repo.permission == 'r' || repo.permission == 'rw') {
|
|
|
|
const monitorOp = repo.monitored ? 'Unwatch File Changes' : 'Watch File Changes';
|
|
|
|
operations.push(monitorOp);
|
|
|
|
}
|
2024-04-19 06:51:41 +00:00
|
|
|
operations.push('Divider', 'History Setting');
|
2023-10-17 13:08:07 +00:00
|
|
|
if (Utils.isDesktop()) {
|
|
|
|
operations.push('Advanced');
|
|
|
|
}
|
|
|
|
return operations;
|
2018-12-08 03:53:45 +00:00
|
|
|
} else {
|
2020-03-11 03:10:48 +00:00
|
|
|
operations.push('Unshare');
|
2018-12-08 03:53:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2018-12-10 01:01:05 +00:00
|
|
|
if (isRepoOwner || isAdmin) {
|
|
|
|
operations.push('Share');
|
|
|
|
}
|
|
|
|
if (isStaff || isRepoOwner || isAdmin) {
|
|
|
|
operations.push('Unshare');
|
|
|
|
}
|
2018-12-08 03:53:45 +00:00
|
|
|
}
|
2023-02-11 09:40:43 +00:00
|
|
|
if (repo.permission == 'r' || repo.permission == 'rw') {
|
|
|
|
const monitorOp = repo.monitored ? 'Unwatch File Changes' : 'Watch File Changes';
|
|
|
|
operations.push(monitorOp);
|
|
|
|
}
|
2018-12-08 03:53:45 +00:00
|
|
|
} else {
|
2018-12-10 01:01:05 +00:00
|
|
|
if (isRepoOwner) {
|
2019-01-28 08:32:32 +00:00
|
|
|
operations.push('Share');
|
2018-12-10 01:01:05 +00:00
|
|
|
}
|
|
|
|
if (isStaff || isRepoOwner) {
|
|
|
|
operations.push('Unshare');
|
|
|
|
}
|
2018-12-08 03:53:45 +00:00
|
|
|
}
|
2018-12-10 01:01:05 +00:00
|
|
|
return operations;
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2018-12-08 03:53:45 +00:00
|
|
|
|
2018-12-10 01:01:05 +00:00
|
|
|
generatorMobileMenu = () => {
|
2018-12-21 07:40:59 +00:00
|
|
|
let operations = [];
|
|
|
|
if (this.props.libraryType && this.props.libraryType === 'public') {
|
|
|
|
let isRepoOwner = this.props.repo.owner_email === username;
|
|
|
|
if (isSystemStaff || isRepoOwner) {
|
2019-01-28 08:32:32 +00:00
|
|
|
operations.push('Unshare');
|
2018-12-21 07:40:59 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
operations = this.generatorOperations();
|
2019-07-02 03:48:34 +00:00
|
|
|
if (this.isDeparementOnwerGroupMember) {
|
2019-01-28 08:32:32 +00:00
|
|
|
operations.unshift('Unshare');
|
|
|
|
operations.unshift('Share');
|
2018-12-21 07:40:59 +00:00
|
|
|
}
|
2018-12-10 01:01:05 +00:00
|
|
|
}
|
2020-03-23 09:52:21 +00:00
|
|
|
|
|
|
|
if (!operations.length) {
|
|
|
|
return null;
|
|
|
|
}
|
2018-12-10 01:01:05 +00:00
|
|
|
return (
|
2018-12-08 04:12:05 +00:00
|
|
|
<Dropdown isOpen={this.state.isItemMenuShow} toggle={this.toggleOperationMenu}>
|
2020-11-02 05:56:35 +00:00
|
|
|
<DropdownToggle
|
|
|
|
tag="i"
|
2019-07-18 12:21:50 +00:00
|
|
|
className="sf-dropdown-toggle fa fa-ellipsis-v ml-0"
|
2024-01-03 10:08:24 +00:00
|
|
|
title={gettext('More operations')}
|
|
|
|
aria-label={gettext('More operations')}
|
2020-11-02 05:56:35 +00:00
|
|
|
data-toggle="dropdown"
|
2018-12-10 01:01:05 +00:00
|
|
|
aria-expanded={this.state.isItemMenuShow}
|
|
|
|
onClick={this.clickOperationMenuToggle}
|
|
|
|
/>
|
2018-12-08 03:53:45 +00:00
|
|
|
<div className={`${this.state.isItemMenuShow?'':'d-none'}`} onClick={this.toggleOperationMenu}>
|
|
|
|
<div className="mobile-operation-menu-bg-layer"></div>
|
|
|
|
<div className="mobile-operation-menu">
|
2018-12-10 01:01:05 +00:00
|
|
|
{operations.map((item, index) => {
|
|
|
|
return (
|
2019-01-28 08:32:32 +00:00
|
|
|
<DropdownItem key={index} data-toggle={item} onClick={this.onMenuItemClick}>{this.translateMenuItem(item)}</DropdownItem>
|
2018-12-10 01:01:05 +00:00
|
|
|
);
|
|
|
|
})}
|
2018-12-08 03:53:45 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</Dropdown>
|
|
|
|
);
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2018-12-10 01:01:05 +00:00
|
|
|
|
|
|
|
generatorPCMenu = () => {
|
2018-12-21 07:40:59 +00:00
|
|
|
let operations = [];
|
|
|
|
if (this.props.libraryType && this.props.libraryType === 'public') {
|
|
|
|
let isRepoOwner = this.props.repo.owner_email === username;
|
|
|
|
if (isSystemStaff || isRepoOwner) {
|
2019-06-27 04:43:25 +00:00
|
|
|
operations.push('Unshare');
|
2018-12-21 07:40:59 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
operations = this.generatorOperations();
|
|
|
|
}
|
2024-05-25 07:09:24 +00:00
|
|
|
const shareOperation = <a href="#" className="op-icon sf3-font-share sf3-font" title={gettext('Share')} role="button" aria-label={gettext('Share')} onClick={this.onItemShare}></a>;
|
2021-09-23 06:46:49 +00:00
|
|
|
const unshareOperation = <a href="#" className="op-icon sf2-icon-x3" title={gettext('Unshare')} role="button" aria-label={gettext('Unshare')} onClick={this.onItemUnshare}></a>;
|
2024-05-25 07:09:24 +00:00
|
|
|
const deleteOperation = <a href="#" className="op-icon sf3-font-delete1 sf3-font" title={gettext('Delete')} role="button" aria-label={gettext('Delete')} onClick={this.onItemDeleteToggle}></a>;
|
2020-11-02 05:56:35 +00:00
|
|
|
|
2019-07-02 03:48:34 +00:00
|
|
|
if (this.isDeparementOnwerGroupMember) {
|
2023-10-17 13:08:07 +00:00
|
|
|
const advancedOperations = this.getAdvancedOperations();
|
2018-12-10 01:01:05 +00:00
|
|
|
return (
|
|
|
|
<Fragment>
|
|
|
|
{shareOperation}
|
|
|
|
{deleteOperation}
|
|
|
|
<Dropdown isOpen={this.state.isItemMenuShow} toggle={this.toggleOperationMenu}>
|
2020-11-02 05:56:35 +00:00
|
|
|
<DropdownToggle
|
2024-05-23 04:09:54 +00:00
|
|
|
tag="i"
|
|
|
|
role="button"
|
|
|
|
tabIndex="0"
|
|
|
|
className="sf-dropdown-toggle sf3-font-more sf3-font"
|
2024-01-03 10:08:24 +00:00
|
|
|
title={gettext('More operations')}
|
|
|
|
aria-label={gettext('More operations')}
|
2020-11-02 05:56:35 +00:00
|
|
|
data-toggle="dropdown"
|
2018-12-10 01:01:05 +00:00
|
|
|
aria-expanded={this.state.isItemMenuShow}
|
2021-09-23 07:42:45 +00:00
|
|
|
aria-haspopup={true}
|
|
|
|
style={{'minWidth': '0'}}
|
2018-12-10 01:01:05 +00:00
|
|
|
onClick={this.clickOperationMenuToggle}
|
2021-09-23 07:42:45 +00:00
|
|
|
onKeyDown={this.onDropdownToggleKeyDown}
|
2018-12-10 01:01:05 +00:00
|
|
|
/>
|
2023-10-17 13:08:07 +00:00
|
|
|
<DropdownMenu onMouseMove={this.onDropDownMouseMove}>
|
|
|
|
{operations.map((item, index)=> {
|
|
|
|
if (item == 'Divider') {
|
|
|
|
return <DropdownItem key={index} divider />;
|
|
|
|
} else if (item == 'Advanced') {
|
|
|
|
return (
|
|
|
|
<Dropdown
|
|
|
|
key={index}
|
|
|
|
direction="right"
|
|
|
|
className="w-100"
|
|
|
|
isOpen={this.state.isAdvancedMenuShown}
|
|
|
|
toggle={this.toggleAdvancedMenu}
|
|
|
|
onMouseMove={(e) => {e.stopPropagation();}}
|
|
|
|
>
|
|
|
|
<DropdownToggle
|
2023-10-18 08:58:10 +00:00
|
|
|
className="dropdown-item font-weight-normal rounded-0 d-flex justify-content-between align-items-center pr-2"
|
2023-10-17 13:08:07 +00:00
|
|
|
onMouseEnter={this.toggleAdvancedMenuShown}
|
|
|
|
>
|
|
|
|
{this.translateMenuItem(item)}
|
2024-06-21 04:07:58 +00:00
|
|
|
<i className="sf3-font-down sf3-font rotate-270"></i>
|
2023-10-17 13:08:07 +00:00
|
|
|
</DropdownToggle>
|
|
|
|
<DropdownMenu>
|
|
|
|
{advancedOperations.map((item, index)=> {
|
|
|
|
return (<DropdownItem key={index} data-toggle={item} onClick={this.onMenuItemClick} onKeyDown={this.onMenuItemKeyDown}>{this.translateMenuItem(item)}</DropdownItem>);
|
|
|
|
})}
|
|
|
|
</DropdownMenu>
|
|
|
|
</Dropdown>
|
|
|
|
);
|
|
|
|
} else {
|
|
|
|
return (<DropdownItem key={index} data-toggle={item} onClick={this.onMenuItemClick} onKeyDown={this.onMenuItemKeyDown}>{this.translateMenuItem(item)}</DropdownItem>);
|
|
|
|
}
|
2018-12-10 01:01:05 +00:00
|
|
|
})}
|
|
|
|
</DropdownMenu>
|
|
|
|
</Dropdown>
|
|
|
|
</Fragment>
|
|
|
|
);
|
|
|
|
} else {
|
2023-02-11 09:40:43 +00:00
|
|
|
return (
|
|
|
|
<Fragment>
|
|
|
|
{operations.map(item => {
|
|
|
|
switch (item) {
|
|
|
|
case 'Share':
|
|
|
|
return <Fragment key={item}>{shareOperation}</Fragment>;
|
|
|
|
case 'Unshare':
|
|
|
|
return <Fragment key={item}>{unshareOperation}</Fragment>;
|
|
|
|
case 'Watch File Changes':
|
|
|
|
case 'Unwatch File Changes':
|
|
|
|
return (
|
|
|
|
<Dropdown isOpen={this.state.isItemMenuShow} toggle={this.toggleOperationMenu} key={item}>
|
|
|
|
<DropdownToggle
|
2024-05-23 04:09:54 +00:00
|
|
|
tag="i"
|
|
|
|
role="button"
|
|
|
|
tabIndex="0"
|
|
|
|
className="sf-dropdown-toggle sf3-font-more sf3-font"
|
2024-01-03 10:08:24 +00:00
|
|
|
title={gettext('More operations')}
|
|
|
|
aria-label={gettext('More operations')}
|
2023-02-11 09:40:43 +00:00
|
|
|
data-toggle="dropdown"
|
|
|
|
aria-expanded={this.state.isItemMenuShow}
|
|
|
|
aria-haspopup={true}
|
|
|
|
style={{'minWidth': '0'}}
|
|
|
|
onClick={this.clickOperationMenuToggle}
|
|
|
|
onKeyDown={this.onDropdownToggleKeyDown}
|
|
|
|
/>
|
|
|
|
<DropdownMenu>
|
|
|
|
{[item].map((item, index) => {
|
|
|
|
return <DropdownItem key={index} data-toggle={item} onClick={this.onMenuItemClick} onKeyDown={this.onMenuItemKeyDown}>{this.translateMenuItem(item)}</DropdownItem>;
|
|
|
|
})}
|
|
|
|
</DropdownMenu>
|
|
|
|
</Dropdown>
|
|
|
|
);
|
|
|
|
// no default
|
2023-09-13 00:40:50 +00:00
|
|
|
default:
|
|
|
|
return null;
|
2023-02-11 09:40:43 +00:00
|
|
|
}
|
|
|
|
})}
|
|
|
|
</Fragment>
|
|
|
|
);
|
2018-12-10 01:01:05 +00:00
|
|
|
}
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2018-12-08 00:37:18 +00:00
|
|
|
|
2021-09-23 06:46:49 +00:00
|
|
|
onToggleStarRepo = (e) => {
|
|
|
|
e.preventDefault();
|
2021-09-23 07:42:45 +00:00
|
|
|
const { repo_name: repoName } = this.props.repo;
|
2019-02-26 06:14:00 +00:00
|
|
|
if (this.state.isStarred) {
|
2019-03-27 03:28:00 +00:00
|
|
|
seafileAPI.unstarItem(this.props.repo.repo_id, '/').then(() => {
|
2019-02-26 06:14:00 +00:00
|
|
|
this.setState({isStarred: !this.state.isStarred});
|
2021-09-23 07:42:45 +00:00
|
|
|
const msg = gettext('Successfully unstarred {library_name_placeholder}.')
|
|
|
|
.replace('{library_name_placeholder}', repoName);
|
|
|
|
toaster.success(msg);
|
2019-07-16 02:01:09 +00:00
|
|
|
}).catch(error => {
|
|
|
|
let errMessage = Utils.getErrorMsg(error);
|
|
|
|
toaster.danger(errMessage);
|
2019-02-26 06:14:00 +00:00
|
|
|
});
|
|
|
|
} else {
|
|
|
|
seafileAPI.starItem(this.props.repo.repo_id, '/').then(() => {
|
|
|
|
this.setState({isStarred: !this.state.isStarred});
|
2021-09-23 07:42:45 +00:00
|
|
|
const msg = gettext('Successfully starred {library_name_placeholder}.')
|
|
|
|
.replace('{library_name_placeholder}', repoName);
|
|
|
|
toaster.success(msg);
|
2019-07-16 02:01:09 +00:00
|
|
|
}).catch(error => {
|
|
|
|
let errMessage = Utils.getErrorMsg(error);
|
|
|
|
toaster.danger(errMessage);
|
2019-05-15 06:56:46 +00:00
|
|
|
});
|
2019-02-26 06:14:00 +00:00
|
|
|
}
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2019-02-26 06:14:00 +00:00
|
|
|
|
2018-12-08 00:37:18 +00:00
|
|
|
renderPCUI = () => {
|
2024-06-20 07:22:47 +00:00
|
|
|
const { isStarred } = this.state;
|
2018-12-08 00:37:18 +00:00
|
|
|
let { iconUrl, iconTitle, libPath } = this.getRepoComputeParams();
|
2024-06-17 01:32:05 +00:00
|
|
|
const { repo, currentViewMode } = this.props;
|
|
|
|
return currentViewMode == 'list' ? (
|
2024-06-18 06:51:34 +00:00
|
|
|
<tr
|
|
|
|
className={this.state.highlight ? 'tr-highlight' : ''}
|
|
|
|
onMouseEnter={this.onMouseEnter}
|
|
|
|
onMouseOver={this.onMouseOver}
|
|
|
|
onMouseLeave={this.onMouseLeave}
|
|
|
|
onFocus={this.onMouseEnter}
|
|
|
|
>
|
2024-06-17 01:32:05 +00:00
|
|
|
<td className="text-center">
|
|
|
|
<i
|
|
|
|
role="button"
|
|
|
|
title={this.state.isStarred ? gettext('Unstar') : gettext('Star')}
|
|
|
|
aria-label={this.state.isStarred ? gettext('Unstar') : gettext('Star')}
|
|
|
|
onClick={this.onToggleStarRepo}
|
|
|
|
className={`op-icon m-0 ${this.state.isStarred ? 'sf3-font-star' : 'sf3-font-star-empty'} sf3-font`}
|
|
|
|
>
|
|
|
|
</i>
|
|
|
|
</td>
|
|
|
|
<td><img src={iconUrl} title={iconTitle} alt={iconTitle} width="24" /></td>
|
|
|
|
<td>
|
|
|
|
{this.state.isRenaming ?
|
|
|
|
<Rename name={repo.repo_name} onRenameConfirm={this.onRenameConfirm} onRenameCancel={this.onRenameCancel}/> :
|
|
|
|
<Fragment>
|
|
|
|
<Link to={libPath}>{repo.repo_name}</Link>
|
|
|
|
{repo.monitored && <RepoMonitoredIcon repoID={repo.repo_id} className="ml-1 op-icon" />}
|
|
|
|
</Fragment>
|
|
|
|
}
|
|
|
|
</td>
|
|
|
|
<td>{this.state.isOperationShow && this.generatorPCMenu()}</td>
|
|
|
|
<td>{repo.size}</td>
|
|
|
|
<td title={moment(repo.last_modified).format('llll')}>{moment(repo.last_modified).fromNow()}</td>
|
|
|
|
<td title={repo.owner_contact_email}>{repo.owner_name}</td>
|
|
|
|
</tr>
|
|
|
|
) : (
|
|
|
|
<div
|
|
|
|
className="library-grid-item px-3 d-flex justify-content-between align-items-center"
|
|
|
|
onMouseEnter={this.onMouseEnter}
|
|
|
|
onMouseLeave={this.onMouseLeave}
|
|
|
|
onFocus={this.onMouseEnter}
|
|
|
|
>
|
2024-06-18 06:51:34 +00:00
|
|
|
<div className="d-flex align-items-center text-truncate">
|
2024-06-17 01:32:05 +00:00
|
|
|
<img src={iconUrl} title={iconTitle} alt={iconTitle} width="36" className="mr-2" />
|
|
|
|
{this.state.isRenaming ?
|
2024-06-18 06:51:34 +00:00
|
|
|
<Rename name={repo.repo_name} onRenameConfirm={this.onRenameConfirm} onRenameCancel={this.onRenameCancel} /> :
|
2024-06-17 01:32:05 +00:00
|
|
|
<Fragment>
|
2024-06-20 05:47:57 +00:00
|
|
|
<Link to={libPath} className="library-name text-truncate" title={repo.repo_name}>{repo.repo_name}</Link>
|
2024-06-20 07:22:47 +00:00
|
|
|
{isStarred &&
|
|
|
|
<i
|
|
|
|
role="button"
|
|
|
|
title={gettext('Unstar')}
|
|
|
|
aria-label={gettext('Unstar')}
|
|
|
|
onClick={this.onToggleStarRepo}
|
|
|
|
className='op-icon library-grid-item-icon sf3-font-star sf3-font'
|
|
|
|
>
|
|
|
|
</i>
|
|
|
|
}
|
2024-06-17 01:32:05 +00:00
|
|
|
{repo.monitored && <RepoMonitoredIcon repoID={repo.repo_id} className="op-icon library-grid-item-icon" />}
|
|
|
|
</Fragment>
|
|
|
|
}
|
|
|
|
</div>
|
2024-06-18 06:51:34 +00:00
|
|
|
<div className="flex-shrink-0">
|
2024-06-17 01:32:05 +00:00
|
|
|
{this.state.isOperationShow && this.generatorPCMenu()}
|
|
|
|
</div>
|
|
|
|
</div>
|
2020-03-23 09:52:21 +00:00
|
|
|
);
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2020-11-02 05:56:35 +00:00
|
|
|
|
2021-01-09 10:36:26 +00:00
|
|
|
visitRepo = () => {
|
|
|
|
if (!this.state.isRenaming) {
|
|
|
|
navigate(this.repoURL);
|
|
|
|
}
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2023-02-11 09:40:43 +00:00
|
|
|
|
2020-03-23 09:52:21 +00:00
|
|
|
renderMobileUI = () => {
|
|
|
|
let { iconUrl, iconTitle, libPath } = this.getRepoComputeParams();
|
|
|
|
let { repo } = this.props;
|
2021-01-09 10:36:26 +00:00
|
|
|
this.repoURL = libPath;
|
2020-03-23 09:52:21 +00:00
|
|
|
return (
|
|
|
|
<Fragment>
|
|
|
|
<tr className={this.state.highlight ? 'tr-highlight' : ''} onMouseEnter={this.onMouseEnter} onMouseOver={this.onMouseOver} onMouseLeave={this.onMouseLeave}>
|
2021-01-09 10:36:26 +00:00
|
|
|
<td onClick={this.visitRepo}><img src={iconUrl} title={iconTitle} width="24" alt={iconTitle}/></td>
|
|
|
|
<td onClick={this.visitRepo}>
|
2020-11-02 05:56:35 +00:00
|
|
|
{this.state.isRenaming ?
|
2020-03-23 09:52:21 +00:00
|
|
|
<Rename name={repo.repo_name} onRenameConfirm={this.onRenameConfirm} onRenameCancel={this.onRenameCancel} /> :
|
2023-02-11 09:40:43 +00:00
|
|
|
<Fragment>
|
|
|
|
<Link to={libPath}>{repo.repo_name}</Link>
|
2024-06-17 01:32:05 +00:00
|
|
|
{repo.monitored && <RepoMonitoredIcon repoID={repo.repo_id} className="ml-1 op-icon" />}
|
2023-02-11 09:40:43 +00:00
|
|
|
</Fragment>
|
2020-03-23 09:52:21 +00:00
|
|
|
}
|
|
|
|
<br />
|
|
|
|
<span className="item-meta-info" title={repo.owner_contact_email}>{repo.owner_name}</span>
|
|
|
|
<span className="item-meta-info">{repo.size}</span>
|
|
|
|
<span className="item-meta-info" title={moment(repo.last_modified).format('llll')}>{moment(repo.last_modified).fromNow()}</span>
|
|
|
|
</td>
|
|
|
|
<td>{this.generatorMobileMenu()}</td>
|
|
|
|
</tr>
|
|
|
|
</Fragment>
|
|
|
|
);
|
2023-09-13 00:40:50 +00:00
|
|
|
};
|
2020-03-23 09:52:21 +00:00
|
|
|
|
|
|
|
render() {
|
|
|
|
let { repo } = this.props;
|
|
|
|
let isGroupOwnedRepo = repo.owner_email.indexOf('@seafile_group') > -1;
|
|
|
|
return (
|
|
|
|
<Fragment>
|
|
|
|
{Utils.isDesktop() ? this.renderPCUI() : this.renderMobileUI()}
|
2018-12-14 08:34:10 +00:00
|
|
|
{this.state.isShowSharedDialog && (
|
2019-05-15 06:04:29 +00:00
|
|
|
<ModalPortal>
|
2020-11-02 05:56:35 +00:00
|
|
|
<ShareDialog
|
2018-12-14 08:34:10 +00:00
|
|
|
itemType={'library'}
|
|
|
|
itemName={repo.repo_name}
|
|
|
|
itemPath={'/'}
|
|
|
|
repoID={repo.repo_id}
|
2019-01-29 02:06:26 +00:00
|
|
|
repoEncrypted={repo.encrypted}
|
|
|
|
enableDirPrivateShare={true}
|
|
|
|
userPerm={repo.permission}
|
|
|
|
isAdmin={repo.is_admin}
|
2018-12-14 13:39:17 +00:00
|
|
|
isGroupOwnedRepo={isGroupOwnedRepo}
|
2018-12-14 08:34:10 +00:00
|
|
|
toggleDialog={this.toggleShareDialog}
|
|
|
|
/>
|
2019-05-15 06:04:29 +00:00
|
|
|
</ModalPortal>
|
|
|
|
)}
|
|
|
|
{this.state.isFolderPermissionDialogOpen && (
|
|
|
|
<ModalPortal>
|
|
|
|
<LibSubFolderPermissionDialog
|
|
|
|
toggleDialog={this.onItemFolderPermissionToggle}
|
|
|
|
repoID={repo.repo_id}
|
|
|
|
repoName={repo.repo_name}
|
|
|
|
isDepartmentRepo={true}
|
|
|
|
/>
|
|
|
|
</ModalPortal>
|
2018-12-14 08:34:10 +00:00
|
|
|
)}
|
2020-11-02 05:56:35 +00:00
|
|
|
{this.state.isDeleteDialogShow &&
|
2019-06-28 02:29:03 +00:00
|
|
|
<ModalPortal>
|
|
|
|
<DeleteRepoDialog
|
|
|
|
repo={this.props.repo}
|
2020-07-27 03:06:59 +00:00
|
|
|
isRepoDeleted={this.state.isRepoDeleted}
|
|
|
|
onDeleteRepo={this.onItemDelete}
|
2019-06-28 02:29:03 +00:00
|
|
|
toggle={this.onItemDeleteToggle}
|
|
|
|
/>
|
2019-06-19 01:56:14 +00:00
|
|
|
</ModalPortal>
|
|
|
|
}
|
2019-06-28 02:29:03 +00:00
|
|
|
{this.state.isHistorySettingDialogShow && (
|
|
|
|
<ModalPortal>
|
|
|
|
<LibHistorySettingDialog
|
|
|
|
repoID={repo.repo_id}
|
|
|
|
itemName={repo.repo_name}
|
|
|
|
toggleDialog={this.onHistorySettingToggle}
|
|
|
|
/>
|
|
|
|
</ModalPortal>
|
|
|
|
)}
|
2019-11-07 06:10:37 +00:00
|
|
|
{this.state.isAPITokenDialogShow && (
|
|
|
|
<ModalPortal>
|
|
|
|
<RepoAPITokenDialog
|
|
|
|
repo={repo}
|
|
|
|
onRepoAPITokenToggle={this.onAPITokenToggle}
|
|
|
|
/>
|
|
|
|
</ModalPortal>
|
|
|
|
)}
|
2023-08-24 02:18:40 +00:00
|
|
|
{this.state.isRepoShareAdminDialogOpen && (
|
2020-03-11 03:10:48 +00:00
|
|
|
<ModalPortal>
|
2023-08-24 02:18:40 +00:00
|
|
|
<RepoShareAdminDialog
|
2020-03-11 03:10:48 +00:00
|
|
|
repo={repo}
|
2023-08-24 02:18:40 +00:00
|
|
|
toggleDialog={this.toggleRepoShareAdminDialog}
|
2020-03-11 03:10:48 +00:00
|
|
|
/>
|
|
|
|
</ModalPortal>
|
|
|
|
)}
|
2020-09-19 12:48:02 +00:00
|
|
|
{this.state.isChangePasswordDialogShow && (
|
|
|
|
<ModalPortal>
|
|
|
|
<ChangeRepoPasswordDialog
|
|
|
|
repoID={repo.repo_id}
|
|
|
|
repoName={repo.repo_name}
|
|
|
|
toggleDialog={this.onChangePasswordToggle}
|
|
|
|
/>
|
|
|
|
</ModalPortal>
|
|
|
|
)}
|
|
|
|
{this.state.isResetPasswordDialogShow && (
|
|
|
|
<ModalPortal>
|
|
|
|
<ResetEncryptedRepoPasswordDialog
|
|
|
|
repoID={repo.repo_id}
|
|
|
|
toggleDialog={this.onResetPasswordToggle}
|
|
|
|
/>
|
|
|
|
</ModalPortal>
|
|
|
|
)}
|
2023-10-17 13:08:07 +00:00
|
|
|
{this.state.isOldFilesAutoDelDialogOpen && (
|
|
|
|
<ModalPortal>
|
|
|
|
<LibOldFilesAutoDelDialog
|
|
|
|
repoID={repo.repo_id}
|
|
|
|
toggleDialog={this.toggleOldFilesAutoDelDialog}
|
|
|
|
/>
|
|
|
|
</ModalPortal>
|
|
|
|
)}
|
2023-12-29 04:20:32 +00:00
|
|
|
{this.state.isSeaTableIntegrationShow && (
|
|
|
|
<ModalPortal>
|
|
|
|
<RepoSeaTableIntegrationDialog
|
|
|
|
repo={repo}
|
|
|
|
onSeaTableIntegrationToggle={this.onSeaTableIntegrationToggle}
|
|
|
|
/>
|
|
|
|
</ModalPortal>
|
|
|
|
)}
|
|
|
|
|
2023-10-17 13:08:07 +00:00
|
|
|
|
2018-12-14 08:34:10 +00:00
|
|
|
</Fragment>
|
2018-12-08 00:37:18 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-12-10 03:52:44 +00:00
|
|
|
SharedRepoListItem.propTypes = propTypes;
|
2018-12-08 00:37:18 +00:00
|
|
|
|
2018-12-10 03:52:44 +00:00
|
|
|
export default SharedRepoListItem;
|