| | |
| | | const OPERATION_RESULT_META = { |
| | | 1: { text: '成功', type: 'success' }, |
| | | 0: { text: '失败', type: 'danger' } |
| | | 1: { textKey: 'pages.system.operationRecord.result.success', fallback: 'Success', type: 'success' }, |
| | | 0: { textKey: 'pages.system.operationRecord.result.failed', fallback: 'Failed', type: 'danger' } |
| | | } |
| | | |
| | | export const OPERATION_RECORD_REPORT_TITLE = '操作日志报表' |
| | | export function getOperationRecordReportTitle(t) { |
| | | return typeof t === 'function' ? t('pages.system.operationRecord.reportTitle') : 'Operation Record Report' |
| | | } |
| | | |
| | | export function createOperationRecordSearchState() { |
| | | return { |
| | |
| | | } |
| | | |
| | | export function getOperationResultMeta(value) { |
| | | return OPERATION_RESULT_META[Number(value)] || { text: '-', type: 'info' } |
| | | return ( |
| | | OPERATION_RESULT_META[Number(value)] || { |
| | | textKey: 'common.placeholder.empty', |
| | | fallback: '--', |
| | | type: 'info' |
| | | } |
| | | ) |
| | | } |
| | | |
| | | export function formatOperationTimestamp(value) { |
| | |
| | | userLabel: record['userId$'] || record.userLabel || (record.userId ? String(record.userId) : ''), |
| | | timestampText: formatOperationTimestamp(record.timestamp), |
| | | createTimeText: record['createTime$'] || record.createTime || '', |
| | | resultText: resultMeta.text, |
| | | resultTextKey: resultMeta.textKey, |
| | | resultText: resultMeta.fallback, |
| | | resultType: resultMeta.type |
| | | } |
| | | } |
| | |
| | | }) |
| | | } |
| | | |
| | | export function getOperationRecordReportColumns() { |
| | | export function getOperationRecordReportColumns(t) { |
| | | return [ |
| | | { prop: 'namespace', label: '名称空间' }, |
| | | { prop: 'url', label: '接口地址' }, |
| | | { prop: 'userLabel', label: '操作用户' }, |
| | | { prop: 'clientIp', label: '客户端IP' }, |
| | | { prop: 'spendTimeText', label: '耗时(ms)' }, |
| | | { prop: 'resultText', label: '结果' }, |
| | | { prop: 'timestampText', label: '操作时间' } |
| | | { prop: 'namespace', label: typeof t === 'function' ? t('pages.system.operationRecord.table.namespace') : 'Namespace' }, |
| | | { prop: 'url', label: typeof t === 'function' ? t('pages.system.operationRecord.table.url') : 'API URL' }, |
| | | { prop: 'userLabel', label: typeof t === 'function' ? t('pages.system.operationRecord.table.user') : 'User' }, |
| | | { prop: 'clientIp', label: typeof t === 'function' ? t('pages.system.operationRecord.table.clientIp') : 'Client IP' }, |
| | | { prop: 'spendTimeText', label: typeof t === 'function' ? t('pages.system.operationRecord.table.spendTime') : 'Latency (ms)' }, |
| | | { prop: 'resultText', label: typeof t === 'function' ? t('pages.system.operationRecord.table.result') : 'Result' }, |
| | | { prop: 'timestampText', label: typeof t === 'function' ? t('pages.system.operationRecord.table.timestamp') : 'Operation Time' } |
| | | ] |
| | | } |
| | | |