mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-04 16:31:13 +00:00
add access log menu item (#3550)
This commit is contained in:
@@ -298,9 +298,11 @@ class DirentListItem extends React.Component {
|
|||||||
let url = URLDecorator.getUrl({type: 'file_revisions', repoID: repoID, filePath: filePath});
|
let url = URLDecorator.getUrl({type: 'file_revisions', repoID: repoID, filePath: filePath});
|
||||||
location.href = url;
|
location.href = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
onAccessLog = () => {
|
onAccessLog = () => {
|
||||||
|
let filePath = this.getDirentPath(this.props.dirent);
|
||||||
|
let path = siteRoot + 'repo/file-access/' + this.props.repoID + '/?p=' + encodeURIComponent(filePath) ;
|
||||||
|
window.open(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
onOpenViaClient = () => {
|
onOpenViaClient = () => {
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import React, { Fragment } from 'react';
|
import React, { Fragment } from 'react';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { Button, ButtonGroup } from 'reactstrap';
|
import { Button, ButtonGroup } from 'reactstrap';
|
||||||
import { gettext, canGenerateShareLink, isPro } from '../../utils/constants';
|
import { gettext, siteRoot, canGenerateShareLink, isPro, fileAuditEnabled } 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 URLDecorator from '../../utils/url-decorator';
|
import URLDecorator from '../../utils/url-decorator';
|
||||||
@@ -91,7 +91,7 @@ class MutipleDirOperationToolbar extends React.Component {
|
|||||||
let menuList = [];
|
let menuList = [];
|
||||||
let currentRepoInfo = this.props.currentRepoInfo;
|
let currentRepoInfo = this.props.currentRepoInfo;
|
||||||
|
|
||||||
const { SHARE, TAGS, RELATED_FILES, HISTORY, OPEN_VIA_CLIENT, LOCK, UNLOCK } = TextTranslation;
|
const { SHARE, TAGS, RELATED_FILES, HISTORY, ACCESS_LOG, OPEN_VIA_CLIENT, LOCK, UNLOCK } = TextTranslation;
|
||||||
|
|
||||||
|
|
||||||
if (dirent.type === 'dir') {
|
if (dirent.type === 'dir') {
|
||||||
@@ -103,9 +103,16 @@ class MutipleDirOperationToolbar extends React.Component {
|
|||||||
if (dirent.type === 'file') {
|
if (dirent.type === 'file') {
|
||||||
let shareBtn = (this.props.showShareBtn && canGenerateShareLink) ? [SHARE] : [];
|
let shareBtn = (this.props.showShareBtn && canGenerateShareLink) ? [SHARE] : [];
|
||||||
|
|
||||||
menuList = [...shareBtn, TAGS, RELATED_FILES, 'Divider', HISTORY, 'Divider', OPEN_VIA_CLIENT];
|
menuList = [...shareBtn, TAGS, RELATED_FILES, 'Divider', HISTORY, ACCESS_LOG, 'Divider', OPEN_VIA_CLIENT];
|
||||||
if (!Utils.isMarkdownFile(dirent.name)) {
|
if (!Utils.isMarkdownFile(dirent.name)) {
|
||||||
menuList.splice(2, 1);
|
menuList = menuList.filter(menu => {
|
||||||
|
return menu !== RELATED_FILES;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (!fileAuditEnabled) {
|
||||||
|
menuList = menuList.filter(menu => {
|
||||||
|
return menu !== ACCESS_LOG;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (isPro) {
|
if (isPro) {
|
||||||
if (dirent.is_locked) {
|
if (dirent.is_locked) {
|
||||||
@@ -145,6 +152,9 @@ class MutipleDirOperationToolbar extends React.Component {
|
|||||||
case 'History':
|
case 'History':
|
||||||
this.onHistory(dirent);
|
this.onHistory(dirent);
|
||||||
break;
|
break;
|
||||||
|
case 'Access Log':
|
||||||
|
this.onAccessLog(dirent);
|
||||||
|
break;
|
||||||
case 'Open via Client':
|
case 'Open via Client':
|
||||||
this.onOpenViaClient(dirent);
|
this.onOpenViaClient(dirent);
|
||||||
break;
|
break;
|
||||||
@@ -196,6 +206,12 @@ class MutipleDirOperationToolbar extends React.Component {
|
|||||||
location.href = url;
|
location.href = url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onAccessLog = (dirent) => {
|
||||||
|
let filePath = this.getDirentPath(dirent);
|
||||||
|
let path = siteRoot + 'repo/file-access/' + this.props.repoID + '/?p=' + encodeURIComponent(filePath) ;
|
||||||
|
window.open(path);
|
||||||
|
}
|
||||||
|
|
||||||
openRelatedFilesDialog = (dirent) => {
|
openRelatedFilesDialog = (dirent) => {
|
||||||
let filePath = this.getDirentPath(dirent);
|
let filePath = this.getDirentPath(dirent);
|
||||||
seafileAPI.listRelatedFiles(this.props.repoID, filePath).then(res => {
|
seafileAPI.listRelatedFiles(this.props.repoID, filePath).then(res => {
|
||||||
|
@@ -1242,6 +1242,7 @@ def react_fake_view(request, **kwargs):
|
|||||||
'is_email_configured': IS_EMAIL_CONFIGURED,
|
'is_email_configured': IS_EMAIL_CONFIGURED,
|
||||||
'can_add_public_repo': request.user.permissions.can_add_public_repo(),
|
'can_add_public_repo': request.user.permissions.can_add_public_repo(),
|
||||||
'folder_perm_enabled': folder_perm_enabled,
|
'folder_perm_enabled': folder_perm_enabled,
|
||||||
|
'file_audit_enabled' : FILE_AUDIT_ENABLED
|
||||||
})
|
})
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
Reference in New Issue
Block a user