1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-28 08:06:56 +00:00

Fix system admin export log bug (#8093)

* fix system admin export log bug

* change system logs image size

* fix some typo
This commit is contained in:
Michael An
2025-07-31 20:25:45 +08:00
committed by GitHub
parent 343f9f4d17
commit 1c3d9942ec
5 changed files with 23 additions and 23 deletions

View File

@@ -29,16 +29,16 @@ class LogsExportExcelDialog extends React.Component {
return; return;
} }
switch (this.props.logType) { switch (this.props.logType) {
case 'login': case 'loginLogs':
this.sysExportLogs('loginadmin'); this.sysExportLogs('loginadmin');
break; break;
case 'file-access': case 'fileAccessLogs':
this.sysExportLogs('fileaudit'); this.sysExportLogs('fileaudit');
break; break;
case 'file-update': case 'fileUpdateLogs':
this.sysExportLogs('fileupdate'); this.sysExportLogs('fileupdate');
break; break;
case 'share-permission': case 'sharePermissionLogs':
this.sysExportLogs('permaudit'); this.sysExportLogs('permaudit');
break; break;
} }
@@ -52,7 +52,6 @@ class LogsExportExcelDialog extends React.Component {
}); });
this.props.toggle(); this.props.toggle();
location.href = siteRoot + 'sys/log/export-excel/?task_id=' + task_id + '&log_type=' + logType; location.href = siteRoot + 'sys/log/export-excel/?task_id=' + task_id + '&log_type=' + logType;
} else { } else {
setTimeout(() => { setTimeout(() => {
this.queryIOStatus(task_id, logType); this.queryIOStatus(task_id, logType);
@@ -109,18 +108,16 @@ class LogsExportExcelDialog extends React.Component {
}; };
isValidDateStr = () => { isValidDateStr = () => {
let { startDateStr, endDateStr } = this.state; const { startDateStr, endDateStr } = this.state;
if (dayjs(startDateStr, 'YYYY-MM-DD', true).isValid() && const startDate = dayjs(startDateStr, 'YYYY-MM-DD', true);
dayjs(endDateStr, 'YYYY-MM-DD', true).isValid() && const endDate = dayjs(endDateStr, 'YYYY-MM-DD', true);
dayjs(startDateStr).isBefore(endDateStr) if (!startDate.isValid() || !endDate.isValid() || !startDate.isBefore(endDate)) {
) {
return true;
} else {
this.setState({ this.setState({
errMsg: gettext('Date Invalid.') errMsg: gettext('Date Invalid.')
}); });
return false; return false;
} }
return true;
}; };
handleStartChange = (e) => { handleStartChange = (e) => {
@@ -180,7 +177,6 @@ class LogsExportExcelDialog extends React.Component {
<Button color="secondary" onClick={this.props.toggle}>{gettext('Cancel')}</Button> <Button color="secondary" onClick={this.props.toggle}>{gettext('Cancel')}</Button>
<Button color="primary" onClick={this.downloadExcel}>{gettext('Submit')}</Button> <Button color="primary" onClick={this.downloadExcel}>{gettext('Submit')}</Button>
</ModalFooter> </ModalFooter>
</Modal> </Modal>
} }
{this.state.isShowIODialog && {this.state.isShowIODialog &&

View File

@@ -109,7 +109,7 @@ class LibContentView extends React.Component {
currentDirent: null, currentDirent: null,
}; };
this.oldonpopstate = window.onpopstate; this.oldOnpopstate = window.onpopstate;
window.onpopstate = this.onpopstate; window.onpopstate = this.onpopstate;
this.lastModifyTime = new Date(); this.lastModifyTime = new Date();
this.isNeedUpdateHistoryState = true; // Load, refresh page, switch mode for the first time, no need to set historyState this.isNeedUpdateHistoryState = true; // Load, refresh page, switch mode for the first time, no need to set historyState
@@ -169,7 +169,7 @@ class LibContentView extends React.Component {
/** /**
* noticeData structure: * noticeData structure:
* { * {
* type: 'file-lock-changed', // opertaion type * type: 'file-lock-changed', // operation type
* content: {} * content: {}
* } * }
*/ */
@@ -323,7 +323,7 @@ class LibContentView extends React.Component {
}; };
componentWillUnmount() { componentWillUnmount() {
window.onpopstate = this.oldonpopstate; window.onpopstate = this.oldOnpopstate;
this.unsubscribeEvent(); this.unsubscribeEvent();
this.unsubscribeOpenTreePanel(); this.unsubscribeOpenTreePanel();
this.unsubscribeEventBus && this.unsubscribeEventBus(); this.unsubscribeEventBus && this.unsubscribeEventBus();
@@ -993,7 +993,7 @@ class LibContentView extends React.Component {
let dirNames = this.getSelectedDirentNames(); let dirNames = this.getSelectedDirentNames();
this.setState({ currentDirent: null }); this.setState({ currentDirent: null });
seafileAPI.deleteMutipleDirents(repoID, this.state.path, dirNames).then(res => { seafileAPI.deleteMultipleDirents(repoID, this.state.path, dirNames).then(res => {
this.deleteItemsAjaxCallback(direntPaths, dirNames); this.deleteItemsAjaxCallback(direntPaths, dirNames);
let msg = ''; let msg = '';
@@ -1812,14 +1812,14 @@ class LibContentView extends React.Component {
this.recalculateSelectedDirents([name], direntList); this.recalculateSelectedDirents([name], direntList);
this.setState({ direntList: direntList }); this.setState({ direntList: direntList });
} else if (Utils.isAncestorPath(direntPath, this.state.path)) { } else if (Utils.isAncestorPath(direntPath, this.state.path)) {
// the deleted item is ancester of the current item // the deleted item is ancestor of the current item
let parentPath = Utils.getDirName(direntPath); let parentPath = Utils.getDirName(direntPath);
this.showDir(parentPath); this.showDir(parentPath);
} }
// else do nothing // else do nothing
} }
// only one scence: The deleted items are inside current path // only one scene: The deleted items are inside current path
deleteDirents = (direntNames) => { deleteDirents = (direntNames) => {
let direntList = this.state.direntList.filter(item => { let direntList = this.state.direntList.filter(item => {
return direntNames.indexOf(item.name) === -1; return direntNames.indexOf(item.name) === -1;
@@ -1841,7 +1841,7 @@ class LibContentView extends React.Component {
this.setState({ direntList: direntList }); this.setState({ direntList: direntList });
}; };
// only one scence: The moved items are inside current path // only one scene: The moved items are inside current path
moveDirents = (direntNames) => { moveDirents = (direntNames) => {
let direntList = this.state.direntList.filter(item => { let direntList = this.state.direntList.filter(item => {
return direntNames.indexOf(item.name) === -1; return direntNames.indexOf(item.name) === -1;

View File

@@ -1,4 +1,4 @@
import React, { Fragment, useState } from 'react'; import React, { useState } from 'react';
import MainPanelTopbar from '../main-panel-topbar'; import MainPanelTopbar from '../main-panel-topbar';
import { Button } from 'reactstrap'; import { Button } from 'reactstrap';
import { gettext } from '../../../utils/constants'; import { gettext } from '../../../utils/constants';
@@ -6,6 +6,7 @@ import LogsNav from '../logs-page/logs-nav';
import { useLocation } from '@gatsbyjs/reach-router'; import { useLocation } from '@gatsbyjs/reach-router';
import ModalPortal from '../../../components/modal-portal'; import ModalPortal from '../../../components/modal-portal';
import LogsExportExcelDialog from '../../../components/dialog/sysadmin-dialog/sysadmin-logs-export-excel-dialog'; import LogsExportExcelDialog from '../../../components/dialog/sysadmin-dialog/sysadmin-logs-export-excel-dialog';
import './logs.css';
const LOG_PATH_NAME_MAP = { const LOG_PATH_NAME_MAP = {
'login': 'loginLogs', 'login': 'loginLogs',
@@ -37,7 +38,7 @@ const Logs = ({ children, ...commonProps }) => {
</MainPanelTopbar> </MainPanelTopbar>
)} )}
<LogsNav currentItem={curTab} {...commonProps} /> <LogsNav currentItem={curTab} {...commonProps} />
<div className="h-100 d-flex overflow-auto">{children}</div> <div className="system-admin-logs h-100 w-100 d-flex overflow-auto">{children}</div>
{isExportExcelDialogOpen && {isExportExcelDialogOpen &&
<ModalPortal> <ModalPortal>
<LogsExportExcelDialog <LogsExportExcelDialog

View File

@@ -0,0 +1,3 @@
.system-admin-logs>div {
width: 100%;
}

View File

@@ -986,7 +986,7 @@ class SeafileAPI {
return this.req.delete(url, { data: params }); return this.req.delete(url, { data: params });
} }
deleteMutipleDirents(repoID, parentDir, direntNames) { deleteMultipleDirents(repoID, parentDir, direntNames) {
const url = this.server + '/api/v2.1/repos/batch-delete-item/'; const url = this.server + '/api/v2.1/repos/batch-delete-item/';
let operation = { let operation = {
'repo_id': repoID, 'repo_id': repoID,