|
|
|
@@ -76,6 +76,10 @@ const moduleOptions = [
|
|
|
|
|
'backups',
|
|
|
|
|
'settings',
|
|
|
|
|
'users',
|
|
|
|
|
'storage',
|
|
|
|
|
'certificates',
|
|
|
|
|
'nodes',
|
|
|
|
|
'blockchain-proofs',
|
|
|
|
|
'upload',
|
|
|
|
|
'download',
|
|
|
|
|
'export',
|
|
|
|
@@ -112,7 +116,7 @@ const columns = computed<DataTableColumns<any>>(() => [
|
|
|
|
|
width: 120,
|
|
|
|
|
align: 'center',
|
|
|
|
|
ellipsis: { tooltip: true },
|
|
|
|
|
render: (row) => actionLabel(row.action),
|
|
|
|
|
render: (row) => actionLabel(effectiveAction(row)),
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: () => renderTableFilterTitle(t('pages.operationLog.result'), query.status, resultOptions, (value) => setFilter('status', value)),
|
|
|
|
@@ -149,6 +153,10 @@ function moduleLabel(value?: string) {
|
|
|
|
|
backups: t('pages.operationLog.modules.backups'),
|
|
|
|
|
settings: t('pages.operationLog.modules.settings'),
|
|
|
|
|
users: t('pages.operationLog.modules.users'),
|
|
|
|
|
storage: t('pages.operationLog.modules.storage'),
|
|
|
|
|
certificates: t('pages.operationLog.modules.certificates'),
|
|
|
|
|
nodes: t('pages.operationLog.modules.nodes'),
|
|
|
|
|
'blockchain-proofs': t('pages.operationLog.modules.blockchainProofs'),
|
|
|
|
|
upload: t('pages.operationLog.modules.upload'),
|
|
|
|
|
download: t('pages.operationLog.modules.download'),
|
|
|
|
|
export: t('pages.operationLog.modules.export'),
|
|
|
|
@@ -177,22 +185,62 @@ function roleLabel(value?: string) {
|
|
|
|
|
return value ? t(`common.role.${value}`) : '-';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function pathLabel(path?: string) {
|
|
|
|
|
function effectiveAction(row: any) {
|
|
|
|
|
const path = String(row.path || '');
|
|
|
|
|
const method = String(row.method || '').toUpperCase();
|
|
|
|
|
const cleanPath = path.split('?')[0];
|
|
|
|
|
const isBackupRoot = /\/backups\/?$/.test(cleanPath);
|
|
|
|
|
if (path.includes('/auth/login')) return 'login';
|
|
|
|
|
if (path.includes('/auth/change-password')) return 'update';
|
|
|
|
|
if (path.includes('/backups/restore/preview')) return 'upload';
|
|
|
|
|
if (path.includes('/backups/restore/commit')) return 'restore';
|
|
|
|
|
if (path.includes('/backups') && path.includes('/download')) return 'download';
|
|
|
|
|
if (path.includes('/backups') && method === 'DELETE') return 'delete';
|
|
|
|
|
if (isBackupRoot && method === 'POST') return 'backup';
|
|
|
|
|
if (path.includes('/trace-codes/batch/delete')) return 'delete';
|
|
|
|
|
if (path.includes('/outbound/import/preview') || /\/outbound\/import\/?$/.test(cleanPath)) return 'upload';
|
|
|
|
|
if (path.includes('/outbound/import-sessions') && path.includes('/commit')) return 'update';
|
|
|
|
|
if (path.includes('/storage/test') || path.includes('/storage/migrate') || path.includes('/storage/confirm')) return 'update';
|
|
|
|
|
if ((path.includes('/blockchain-proofs') && (path.includes('/retry') || path.includes('/confirm'))) || path.includes('/trace-codes') && path.includes('/onchain')) return 'onchain';
|
|
|
|
|
if (path.includes('/export')) return 'export';
|
|
|
|
|
if (path.includes('/download') || path.includes('/template')) return 'download';
|
|
|
|
|
return row.action;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function pathLabel(path?: string, action?: string, method?: string) {
|
|
|
|
|
if (!path) return '';
|
|
|
|
|
const normalizedMethod = String(method || '').toUpperCase();
|
|
|
|
|
const cleanPath = path.split('?')[0];
|
|
|
|
|
const isBackupRoot = /\/backups\/?$/.test(cleanPath);
|
|
|
|
|
if (path.includes('/auth/change-password')) return t('pages.operationLog.paths.changePassword');
|
|
|
|
|
if (path.includes('/auth/login')) return t('pages.operationLog.paths.login');
|
|
|
|
|
if (path.includes('/outbound/import/preview')) return t('pages.operationLog.paths.outboundPreview');
|
|
|
|
|
if (path.includes('/outbound/import-sessions') && path.includes('/commit')) return t('pages.operationLog.paths.outboundCommit');
|
|
|
|
|
if (path.includes('/trace-codes/export')) return t('pages.operationLog.paths.traceExport');
|
|
|
|
|
if (path.includes('/backups/restore')) return t('pages.operationLog.paths.restore');
|
|
|
|
|
if (path.includes('/trace-codes/batch/delete')) return t('pages.operationLog.paths.traceBatchDelete');
|
|
|
|
|
if (path.includes('/outbound/import/template')) return t('pages.operationLog.paths.outboundTemplate');
|
|
|
|
|
if (path.includes('/backups/restore/preview')) return t('pages.operationLog.paths.backupRestorePreview');
|
|
|
|
|
if (path.includes('/backups/restore/commit')) return t('pages.operationLog.paths.restore');
|
|
|
|
|
if (path.includes('/backups') && path.includes('/download')) return t('pages.operationLog.paths.backupDownload');
|
|
|
|
|
if (path.includes('/backups') && (normalizedMethod === 'DELETE' || action === 'delete')) return t('pages.operationLog.paths.backupDelete');
|
|
|
|
|
if (isBackupRoot && (normalizedMethod === 'POST' || action === 'backup')) return t('pages.operationLog.paths.backupCreate');
|
|
|
|
|
if (path.includes('/backups')) return t('pages.operationLog.paths.backup');
|
|
|
|
|
if (path.includes('/storage/test')) return t('pages.operationLog.paths.storageTest');
|
|
|
|
|
if (path.includes('/storage/migrate')) return t('pages.operationLog.paths.storageMigrate');
|
|
|
|
|
if (path.includes('/storage/confirm')) return t('pages.operationLog.paths.storageConfirm');
|
|
|
|
|
if (path.includes('/blockchain-proofs') && path.includes('/retry')) return t('pages.operationLog.paths.blockchainRetry');
|
|
|
|
|
if (path.includes('/blockchain-proofs') && path.includes('/confirm')) return t('pages.operationLog.paths.blockchainConfirm');
|
|
|
|
|
if (path.includes('/trace-codes') && path.includes('/onchain')) return t('pages.operationLog.paths.traceOnchain');
|
|
|
|
|
if (path.includes('/upload')) return t('pages.operationLog.paths.upload');
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function operationSummary(row: any) {
|
|
|
|
|
const readablePath = pathLabel(row.path);
|
|
|
|
|
const action = effectiveAction(row);
|
|
|
|
|
const readablePath = pathLabel(row.path, action, row.method);
|
|
|
|
|
if (readablePath) return readablePath;
|
|
|
|
|
const target = row.targetId ? ` #${row.targetId}` : '';
|
|
|
|
|
return `${actionLabel(row.action)}${moduleLabel(row.module)}${target}`;
|
|
|
|
|
return `${actionLabel(action)}${moduleLabel(row.module)}${target}`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function setFilter(field: 'role' | 'module' | 'action' | 'status', value: string | number | null) {
|
|
|
|
|