1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-09 10:50:24 +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

@@ -21,6 +21,7 @@ import CreateFile from '../dialog/create-file-dialog';
import CreateFolder from '../dialog/create-folder-dialog';
import LibSubFolderPermissionDialog from '../dialog/lib-sub-folder-permission-dialog';
import toaster from '../toast';
import FileAccessLog from '../dialog/file-access-log';
import '../../css/grid-view.css';
@@ -72,6 +73,7 @@ class DirentGridView extends React.Component {
imageItems: [],
imageIndex: 0,
// onmenuClick
isFileAccessLogDialogOpen: false,
isShareDialogShow: false,
isMoveDialogShow: false,
isCopyDialogShow: false,
@@ -377,7 +379,7 @@ class DirentGridView extends React.Component {
this.onCreateFileToggle('.sdoc');
break;
case 'Access Log':
this.onAccessLog(currentObject);
this.toggleFileAccessLogDialog();
break;
case 'Properties':
this.props.showDirentDetail('info');
@@ -526,10 +528,10 @@ class DirentGridView extends React.Component {
location.href = url;
};
onAccessLog = (currentObject) => {
let filePath = this.getDirentPath(currentObject);
let path = siteRoot + 'repo/file-access/' + this.props.repoID + '/?p=' + encodeURIComponent(filePath) ;
window.open(path);
toggleFileAccessLogDialog = () => {
this.setState({
isFileAccessLogDialogOpen: !this.state.isFileAccessLogDialogOpen
});
};
onOpenViaClient = (currentObject) => {
@@ -905,6 +907,16 @@ class DirentGridView extends React.Component {
/>
</ModalPortal>
)}
{this.state.isFileAccessLogDialogOpen &&
<ModalPortal>
<FileAccessLog
repoID={this.props.repoID}
filePath={direntPath}
fileName={dirent.name}
toggleDialog={this.toggleFileAccessLogDialog}
/>
</ModalPortal>
}
</Fragment>
);
}