1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-03 16:10:26 +00:00

"['dir view'] display file access log in a dialog instead of an independent page (#6673)

- click 'Access Log' in the menu for files in list/grid mode, or
  single-selected file
This commit is contained in:
llj
2024-08-30 07:02:29 +08:00
committed by GitHub
parent 1d785cf824
commit 1495314544
7 changed files with 259 additions and 17 deletions

View File

@@ -18,6 +18,7 @@ import ZipDownloadDialog from '../dialog/zip-download-dialog';
import EditFileTagDialog from '../dialog/edit-filetag-dialog';
import EditFileTagPopover from '../popover/edit-filetag-popover';
import LibSubFolderPermissionDialog from '../dialog/lib-sub-folder-permission-dialog';
import FileAccessLog from '../dialog/file-access-log';
import toaster from '../toast';
import FileTag from './file-tag';
@@ -81,6 +82,7 @@ class DirentListItem extends React.Component {
isOperationShow: false,
highlight: false,
isZipDialogOpen: false,
isFileAccessLogDialogOpen: false,
isMoveDialogShow: false,
isCopyDialogShow: false,
isShareDialogShow: false,
@@ -298,7 +300,7 @@ class DirentListItem extends React.Component {
this.onHistory();
break;
case 'Access Log':
this.onAccessLog();
this.toggleFileAccessLogDialog();
break;
case 'Properties':
this.props.onDirentClick(this.props.dirent);
@@ -415,10 +417,10 @@ class DirentListItem extends React.Component {
location.href = url;
};
onAccessLog = () => {
let filePath = this.getDirentPath(this.props.dirent);
let path = siteRoot + 'repo/file-access/' + this.props.repoID + '/?p=' + encodeURIComponent(filePath) ;
window.open(path);
toggleFileAccessLogDialog = () => {
this.setState({
isFileAccessLogDialogOpen: !this.state.isFileAccessLogDialogOpen
});
};
onOpenViaClient = () => {
@@ -935,6 +937,16 @@ class DirentListItem extends React.Component {
/>
</ModalPortal>
}
{this.state.isFileAccessLogDialogOpen &&
<ModalPortal>
<FileAccessLog
repoID={this.props.repoID}
filePath={direntPath}
fileName={dirent.name}
toggleDialog={this.toggleFileAccessLogDialog}
/>
</ModalPortal>
}
</Fragment>
);
}