From 9656e6d2ae079485a4c737866b66360c4fb27beb Mon Sep 17 00:00:00 2001 From: Lan Date: Wed, 3 Jun 2026 10:24:07 +0800 Subject: [PATCH] refactor: remove admin recommendation summaries --- src/composables/useAdminFiles.ts | 156 +---------------- src/composables/useDashboardStats.ts | 248 +++++---------------------- src/i18n/locales/en-US.ts | 243 -------------------------- src/i18n/locales/zh-CN.ts | 208 ---------------------- src/services/stats.ts | 7 +- src/types/dashboard.ts | 114 ------------ src/types/file.ts | 64 ------- src/views/manage/DashboardView.vue | 229 +------------------------ src/views/manage/FileManageView.vue | 180 +------------------ 9 files changed, 48 insertions(+), 1401 deletions(-) diff --git a/src/composables/useAdminFiles.ts b/src/composables/useAdminFiles.ts index 77ff751..91a3b1e 100644 --- a/src/composables/useAdminFiles.ts +++ b/src/composables/useAdminFiles.ts @@ -22,10 +22,6 @@ import type { AdminFileStatusFilter, AdminFileSummary, AdminFileTypeFilter, - AdminFileViewSummary, - AdminFileViewSummaryItem, - AdminFileViewSummaryViewData, - AdminFileViewSummaryViewItem, AdminFileViewPreset, AdminFileViewPresetParams, AdminFileViewPresetRequest, @@ -62,18 +58,6 @@ const emptySummary = (): AdminFileSummary => ({ usedCount: 0 }) -const emptyViewSummary = (): AdminFileViewSummaryViewData => ({ - total: 0, - filteredTotal: 0, - allTotal: 0, - activeFilterCount: 0, - hasFilters: false, - strongestSeverity: 'success', - summary: emptySummary(), - cards: [], - actions: [] -}) - const normalizeCount = (value: number | string | null | undefined) => Number(value || 0) const isExpiredByDate = (value: string | null | undefined) => { @@ -228,7 +212,6 @@ export function useAdminFiles() { const isLoading = ref(false) const isSaving = ref(false) const summary = ref(emptySummary()) - const viewSummary = ref(emptyViewSummary()) const params = ref({ page: 1, size: 10, @@ -540,7 +523,7 @@ export function useAdminFiles() { } const normalizeInsightSeverity = ( - severity: AdminFileInsightSeverity | string | undefined + severity: AdminFileInsightSeverity | undefined ): AdminFileInsightSeverity => { if (severity === 'success' || severity === 'warning' || severity === 'danger') { return severity @@ -551,131 +534,6 @@ export function useAdminFiles() { return 'neutral' } - const normalizeViewSummaryItems = ( - items: AdminFileViewSummaryItem[] = [] - ): AdminFileViewSummaryViewItem[] => - items - .filter((item) => item && item.key) - .map((item) => { - const actionTypeValue = item.actionType ?? item.action_type ?? 'filter' - const sourceKeyValue = item.sourceKey ?? item.source_key ?? item.key - const suggestedActionValue = item.suggestedAction ?? item.suggested_action ?? sourceKeyValue - const targetHealthValue = item.targetHealth ?? item.target_health ?? item.health ?? 'all' - - return { - ...item, - count: normalizeCount(item.count), - priority: normalizeCount(item.priority), - severity: normalizeInsightSeverity(item.severity), - actionTypeValue, - sourceKeyValue, - suggestedActionValue, - targetHealthValue - } - }) - - const buildFallbackViewSummary = ( - files: AdminFileViewItem[], - total: number, - rawSummary?: Partial - ): AdminFileViewSummaryViewData => { - const normalizedSummary = normalizeSummary(rawSummary, files, total) - const cards: AdminFileViewSummaryItem[] = [ - { - key: 'storage_issue', - severity: 'danger', - priority: 100, - count: normalizedSummary.storageIssueCount, - targetHealth: 'storage_issue' - }, - { - key: 'expired', - severity: normalizedSummary.expiredCount >= 10 ? 'danger' : 'warning', - priority: 90, - count: normalizedSummary.expiredCount, - targetHealth: 'expired' - }, - { - key: 'expiring_soon', - severity: 'warning', - priority: 80, - count: normalizedSummary.expiringSoonCount, - targetHealth: 'expiring_soon' - }, - { - key: 'never_retrieved', - severity: 'neutral', - priority: 60, - count: normalizedSummary.neverRetrievedCount, - targetHealth: 'never_retrieved' - } - ].filter((item) => item.count > 0) - - if (cards.length === 0) { - cards.push({ - key: normalizedSummary.totalFiles > 0 ? 'healthy' : 'empty', - severity: normalizedSummary.totalFiles > 0 ? 'success' : 'neutral', - priority: 10, - count: normalizedSummary.totalFiles, - targetHealth: normalizedSummary.totalFiles > 0 ? 'healthy' : 'all' - }) - } - - const normalizedCards = normalizeViewSummaryItems(cards) - return { - total, - filteredTotal: total, - allTotal: summary.value.totalFiles || total, - activeFilterCount: hasActiveFilters.value ? 1 : 0, - hasFilters: hasActiveFilters.value, - strongestSeverity: normalizedCards[0]?.severity ?? 'success', - summary: normalizedSummary, - cards: normalizedCards, - actions: normalizedCards.filter((item) => item.severity !== 'success') - } - } - - const normalizeViewSummary = ( - rawViewSummary: AdminFileViewSummary | undefined, - files: AdminFileViewItem[], - total: number, - rawSummary?: Partial - ): AdminFileViewSummaryViewData => { - if (!rawViewSummary) { - return buildFallbackViewSummary(files, total, rawSummary) - } - - const cards = normalizeViewSummaryItems(rawViewSummary.cards ?? rawViewSummary.items ?? []) - const actions = normalizeViewSummaryItems(rawViewSummary.actions ?? []) - const rawSummarySource = - rawViewSummary.summary ?? - rawViewSummary.healthSummary ?? - rawViewSummary.health_summary ?? - rawSummary - const filteredTotal = rawViewSummary.filteredTotal ?? rawViewSummary.filtered_total ?? total - const allTotal = rawViewSummary.allTotal ?? rawViewSummary.all_total ?? summary.value.totalFiles - const strongestSeverity = - rawViewSummary.strongestSeverity ?? - rawViewSummary.strongest_severity ?? - cards[0]?.severity ?? - 'success' - const normalizedSummary = normalizeSummary(rawSummarySource, files, total) - - return { - total: normalizeCount(rawViewSummary.total ?? total), - filteredTotal: normalizeCount(filteredTotal), - allTotal: normalizeCount(allTotal), - activeFilterCount: normalizeCount( - rawViewSummary.activeFilterCount ?? rawViewSummary.active_filter_count - ), - hasFilters: Boolean(rawViewSummary.hasFilters ?? rawViewSummary.has_filters), - strongestSeverity: normalizeInsightSeverity(strongestSeverity), - summary: normalizedSummary, - cards: cards.length > 0 ? cards : buildFallbackViewSummary(files, total, rawSummary).cards, - actions - } - } - const createFileViewItem = (file: FileListItem): AdminFileViewItem => { const isTextFile = inferIsText(file) const isExpiredFile = inferIsExpired(file) @@ -1242,17 +1100,6 @@ export function useAdminFiles() { tableData.value = res.detail.data.map(createFileViewItem) params.value.total = res.detail.total summary.value = normalizeSummary(res.detail.summary, tableData.value, res.detail.total) - viewSummary.value = normalizeViewSummary( - res.detail.viewSummary ?? - res.detail.view_summary ?? - res.detail.currentViewSummary ?? - res.detail.current_view_summary ?? - res.detail.actionSummary ?? - res.detail.action_summary, - tableData.value, - res.detail.total, - res.detail.summary - ) syncSelectedFilesWithCurrentPage() } catch (error) { hasLoadError.value = true @@ -1820,7 +1667,6 @@ export function useAdminFiles() { selectedViewPresetId, storageUsedText, summary, - viewSummary, showBatchEditModal, showEditModal, showFileDetailModal, diff --git a/src/composables/useDashboardStats.ts b/src/composables/useDashboardStats.ts index ded52d0..8b42d87 100644 --- a/src/composables/useDashboardStats.ts +++ b/src/composables/useDashboardStats.ts @@ -7,13 +7,6 @@ import type { DashboardActivityViewItem, DashboardData, DashboardHealthSummary, - DashboardInsightSeverity, - DashboardMaintenanceQueue, - DashboardMaintenanceQueueItem, - DashboardMaintenanceQueueSummary, - DashboardMaintenanceQueueViewItem, - DashboardOperationalInsight, - DashboardOperationalInsightViewItem, DashboardViewData } from '@/types' import { formatFileSize, getErrorMessage } from '@/utils/common' @@ -25,54 +18,49 @@ type UseDashboardStatsOptions = { const activityTimelineLimit = 40 -function emptyDashboardData(): DashboardViewData { - return { - hasExtendedStats: false, - totalFiles: 0, - storageUsed: 0, - yesterdayCount: 0, - todayCount: 0, - yesterdaySize: 0, - todaySize: 0, - sysUptime: null, - activeCount: 0, - expiredCount: 0, - textCount: 0, - fileCount: 0, - chunkedCount: 0, - usedCount: 0, - storageBackend: '-', - uploadSizeLimit: 0, - openUpload: 0, - enableChunk: 0, - maxSaveSeconds: 0, - healthAttentionCount: 0, - healthDangerCount: 0, - healthWarningCount: 0, - expiringSoonCount: 0, - storageIssueCount: 0, - neverRetrievedCount: 0, - healthyCount: 0, - permanentCount: 0, - topSuffixes: [], - recentFiles: [], - recentActivities: [], - operationalInsights: [], - maintenanceItems: [], - maintenanceSummary: emptyMaintenanceSummary(), - storageUsedText: '0 Bytes', - yesterdaySizeText: '0 Bytes', - todaySizeText: '0 Bytes', - uploadSizeLimitText: '0 Bytes', - sysUptimeText: '-', - activeRatio: 0, - textRatio: 0, - fileRatio: 0, - healthyRatio: 0, - healthAttentionRatio: 0, - todaySizeRatio: 0 - } -} +const emptyDashboardData = (): DashboardViewData => ({ + hasExtendedStats: false, + totalFiles: 0, + storageUsed: 0, + yesterdayCount: 0, + todayCount: 0, + yesterdaySize: 0, + todaySize: 0, + sysUptime: null, + activeCount: 0, + expiredCount: 0, + textCount: 0, + fileCount: 0, + chunkedCount: 0, + usedCount: 0, + storageBackend: '-', + uploadSizeLimit: 0, + openUpload: 0, + enableChunk: 0, + maxSaveSeconds: 0, + healthAttentionCount: 0, + healthDangerCount: 0, + healthWarningCount: 0, + expiringSoonCount: 0, + storageIssueCount: 0, + neverRetrievedCount: 0, + healthyCount: 0, + permanentCount: 0, + topSuffixes: [], + recentFiles: [], + recentActivities: [], + storageUsedText: '0 Bytes', + yesterdaySizeText: '0 Bytes', + todaySizeText: '0 Bytes', + uploadSizeLimitText: '0 Bytes', + sysUptimeText: '-', + activeRatio: 0, + textRatio: 0, + fileRatio: 0, + healthyRatio: 0, + healthAttentionRatio: 0, + todaySizeRatio: 0 +}) const toNumber = (value: number | string | null | undefined) => Number(value || 0) @@ -121,150 +109,6 @@ const normalizeActivityOptions = ( count: toNumber(option.count) })) -const insightSeverities: DashboardInsightSeverity[] = ['danger', 'warning', 'success', 'neutral'] - -const normalizeInsightSeverity = (severity: string | undefined): DashboardInsightSeverity => - insightSeverities.includes(severity as DashboardInsightSeverity) - ? (severity as DashboardInsightSeverity) - : 'neutral' - -const normalizeOperationalInsights = ( - insights: DashboardOperationalInsight[] = [] -): DashboardOperationalInsightViewItem[] => - insights - .filter((insight) => insight && insight.key) - .map((insight) => { - const action = insight.action && typeof insight.action === 'object' ? insight.action : {} - const actionTypeValue = - insight.actionType ?? - insight.action_type ?? - action.actionType ?? - action.action_type ?? - action.type ?? - 'file_queue' - const targetHealthValue = - insight.targetHealth ?? - insight.target_health ?? - action.targetHealth ?? - action.target_health ?? - action.health ?? - null - - return { - ...insight, - count: toNumber(insight.count), - priority: toNumber(insight.priority), - severity: normalizeInsightSeverity(insight.severity), - actionTypeValue, - targetHealthValue - } - }) - -function emptyMaintenanceSummary(): DashboardMaintenanceQueueSummary { - return { - total: 0, - actionableCount: 0, - dangerCount: 0, - warningCount: 0, - successCount: 0, - neutralCount: 0, - fileQueueCount: 0, - settingsCount: 0, - strongestSeverity: 'success' - } -} - -const normalizeMaintenanceQueueItems = ( - items: DashboardMaintenanceQueueItem[] = [] -): DashboardMaintenanceQueueViewItem[] => - items - .filter((item) => item && item.key) - .map((item) => { - const action = item.action && typeof item.action === 'object' ? item.action : {} - const actionTypeValue = - item.actionType ?? - item.action_type ?? - action.actionType ?? - action.action_type ?? - action.type ?? - 'file_queue' - const targetHealthValue = - item.targetHealth ?? - item.target_health ?? - action.targetHealth ?? - action.target_health ?? - action.health ?? - null - const suggestedActionValue = - item.suggestedAction ?? - item.suggested_action ?? - action.suggestedAction ?? - action.suggested_action ?? - 'monitor' - - return { - ...item, - count: toNumber(item.count), - priority: toNumber(item.priority), - severity: normalizeInsightSeverity(item.severity), - actionTypeValue, - suggestedActionValue, - targetHealthValue - } - }) - -const normalizeMaintenanceSummary = ( - summary: Partial | undefined, - items: DashboardMaintenanceQueueViewItem[] -): DashboardMaintenanceQueueSummary => ({ - total: toNumber(summary?.total ?? items.length), - actionableCount: toNumber(summary?.actionableCount ?? summary?.actionable_count), - actionable_count: toNumber(summary?.actionableCount ?? summary?.actionable_count), - dangerCount: toNumber(summary?.dangerCount ?? summary?.danger_count), - danger_count: toNumber(summary?.dangerCount ?? summary?.danger_count), - warningCount: toNumber(summary?.warningCount ?? summary?.warning_count), - warning_count: toNumber(summary?.warningCount ?? summary?.warning_count), - successCount: toNumber(summary?.successCount ?? summary?.success_count), - success_count: toNumber(summary?.successCount ?? summary?.success_count), - neutralCount: toNumber(summary?.neutralCount ?? summary?.neutral_count), - neutral_count: toNumber(summary?.neutralCount ?? summary?.neutral_count), - fileQueueCount: toNumber(summary?.fileQueueCount ?? summary?.file_queue_count), - file_queue_count: toNumber(summary?.fileQueueCount ?? summary?.file_queue_count), - settingsCount: toNumber(summary?.settingsCount ?? summary?.settings_count), - settings_count: toNumber(summary?.settingsCount ?? summary?.settings_count), - strongestSeverity: normalizeInsightSeverity( - summary?.strongestSeverity ?? summary?.strongest_severity - ), - strongest_severity: normalizeInsightSeverity( - summary?.strongestSeverity ?? summary?.strongest_severity - ) -}) - -const normalizeMaintenanceQueue = ( - detail: DashboardData | DashboardMaintenanceQueue -): Pick => { - const source = detail as DashboardData & DashboardMaintenanceQueue - const queue = source.maintenanceQueue ?? source.maintenance_queue ?? source - const items = normalizeMaintenanceQueueItems( - queue?.items ?? - queue?.maintenanceItems ?? - queue?.maintenance_items ?? - source.maintenanceItems ?? - source.maintenance_items ?? - [] - ) - const rawSummary = - queue?.summary ?? - queue?.maintenanceSummary ?? - queue?.maintenance_summary ?? - source.maintenanceSummary ?? - source.maintenance_summary - return { - maintenanceItems: items, - maintenanceSummary: normalizeMaintenanceSummary(rawSummary, items) - } -} - const healthSummaryKeys: (keyof DashboardHealthSummary)[] = [ 'healthAttentionCount', 'healthDangerCount', @@ -366,12 +210,6 @@ export function useDashboardStats(options: UseDashboardStatsOptions = {}) { dashboardData.recentActivities = normalizeRecentActivities( detail.recentActivities ?? detail.recent_activities ?? [] ) - dashboardData.operationalInsights = normalizeOperationalInsights( - detail.operationalInsights ?? detail.operational_insights ?? detail.insights ?? [] - ) - const maintenanceQueue = normalizeMaintenanceQueue(detail) - dashboardData.maintenanceItems = maintenanceQueue.maintenanceItems - dashboardData.maintenanceSummary = maintenanceQueue.maintenanceSummary dashboardData.storageUsedText = formatFileSize(dashboardData.storageUsed) dashboardData.yesterdaySizeText = formatFileSize(dashboardData.yesterdaySize) diff --git a/src/i18n/locales/en-US.ts b/src/i18n/locales/en-US.ts index 5b50aab..290b92a 100644 --- a/src/i18n/locales/en-US.ts +++ b/src/i18n/locales/en-US.ts @@ -90,65 +90,6 @@ export default { textType: 'Text', recentActivities: 'Recent Activity', recentActivitiesDesc: 'Key admin changes for quick operational traceability.', - operationalInsightsTitle: 'Operational Insights', - operationalInsightsDesc: - 'Suggested next actions generated from file health, upload policy, and recent capacity.', - operationalInsightActionSettings: 'Adjust settings', - operationalInsightActionFileQueue: 'View queue', - operationalInsightSeverity: { - danger: 'High risk', - warning: 'Action needed', - success: 'Stable', - neutral: 'Suggestion' - }, - maintenanceQueueTitle: 'Maintenance Queue', - maintenanceQueueDesc: - 'Groups file health, retention policy, and upload settings into actionable queues. Click an item to open the related view.', - maintenanceActionable: 'Actionable', - maintenanceFileQueue: 'File queue', - maintenanceSettings: 'Settings', - maintenanceQueueActionSettings: 'Adjust settings', - maintenanceQueueActionFileQueue: 'View queue', - maintenanceQueueItems: { - storage_issue: { - title: '{count} storage issues', - description: - 'Review records missing download metadata and verify storage settings and file details.' - }, - expired_cleanup: { - title: '{count} expired items', - description: - 'Review expired shares, delete stale records, or extend files that should stay available.' - }, - expiring_soon: { - title: '{count} expiring soon', - description: 'These shares will expire soon. Extend them early or notify recipients.' - }, - never_retrieved: { - title: '{count} never retrieved', - description: - 'Review shares that have not been retrieved to identify ineffective uploads or follow-up gaps.' - }, - permanent_review: { - title: '{count} permanent shares', - description: - 'Periodically review long-retention shares to prevent unbounded historical growth.' - }, - guest_upload_retention: { - title: 'Guest uploads lack retention limits', - description: - 'Guest uploads are enabled without a maximum retention period. Add a default retention policy.' - }, - chunking_disabled: { - title: 'Large-file experience can improve', - description: - "Today's capacity is near the single-file limit. Enable chunked upload for better reliability." - }, - healthy: { - title: 'Maintenance queue is stable', - description: 'No maintenance item needs priority attention right now.' - } - }, viewAllActivities: 'View all', activityTimelineTitle: 'Activity Timeline', activityTimelineFiltered: 'Current Results', @@ -191,43 +132,6 @@ export default { local_file: 'Local file', system: 'System' }, - operationalInsights: { - storage_issue: { - title: 'Fix {count} storage issues', - description: - 'Some records are missing download metadata. Review storage settings and file details first.' - }, - expired_cleanup: { - title: 'Clean up {count} expired files', - description: - 'Expired records add management noise. Delete them in bulk or extend the files that should remain available.' - }, - expiring_soon: { - title: '{count} files expiring soon', - description: - 'These shares will become unavailable soon. Extend them early or notify the recipients.' - }, - never_retrieved: { - title: '{count} files never retrieved', - description: - 'Shares that were never retrieved can reveal ineffective uploads or follow-up gaps.' - }, - guest_upload_retention: { - title: 'Guest uploads lack retention limits', - description: - 'Guest upload is enabled with unlimited retention. Set a default retention window to reduce storage pressure.' - }, - chunking_disabled: { - title: 'Consider enabling chunked upload', - description: - "Today's added capacity is near the single-file limit. Chunked upload can improve large-file reliability." - }, - healthy: { - title: 'Operations look stable', - description: - 'No high-priority operational risk was detected. Keep watching the file health trend.' - } - }, recentFiles: 'Recent Shares', recentFilesDesc: 'Recently created share records for quick status checks.', available: 'Available', @@ -576,57 +480,6 @@ export default { viewPresetDeleteSuccess: 'View deleted', viewPresetDeleteFailed: 'Failed to delete view', viewPresetLoadFailed: 'Failed to load saved views; using built-in views', - viewSummary: { - title: 'Current View Action Summary', - description: - 'Groups risks and next actions from the current filters. Click an item to open its queue.', - filteredTotal: 'Current results', - allTotal: 'All records', - activeFilters: 'Filters', - action: 'View queue', - reset: 'Clear filters', - severity: { - success: 'Stable', - warning: 'Action needed', - danger: 'High risk', - info: 'Info', - neutral: 'Watch' - }, - items: { - storage_issue: { - title: '{count} storage issues', - description: - 'Review records missing download metadata and verify storage paths, file names, and settings.' - }, - expired: { - title: '{count} expired items', - description: - 'Handle unavailable shares by deleting stale records or extending files that should remain available.' - }, - expiring_soon: { - title: '{count} expiring soon', - description: - 'These shares expire within 24 hours. Extend them early or notify recipients.' - }, - never_retrieved: { - title: '{count} never retrieved', - description: - 'Review shares that have not been retrieved to identify ineffective uploads or follow-up gaps.' - }, - permanent: { - title: '{count} permanent shares', - description: 'Review long-retention shares to prevent unbounded historical growth.' - }, - healthy: { - title: 'Current view is stable', - description: 'No file in the current filters needs priority handling.' - }, - empty: { - title: 'No results in this view', - description: 'Adjust or clear filters to inspect other file queues.' - } - } - }, all: 'All', active: 'Available', expired: 'Expired', @@ -1081,65 +934,6 @@ export default { textType: 'Text', recentActivities: 'Recent Activity', recentActivitiesDesc: 'Key admin changes for quick operational traceability.', - operationalInsightsTitle: 'Operational Insights', - operationalInsightsDesc: - 'Suggested next actions generated from file health, upload policy, and recent capacity.', - operationalInsightActionSettings: 'Adjust settings', - operationalInsightActionFileQueue: 'View queue', - operationalInsightSeverity: { - danger: 'High risk', - warning: 'Action needed', - success: 'Stable', - neutral: 'Suggestion' - }, - maintenanceQueueTitle: 'Maintenance Queue', - maintenanceQueueDesc: - 'Groups file health, retention policy, and upload settings into actionable queues. Click an item to open the related view.', - maintenanceActionable: 'Actionable', - maintenanceFileQueue: 'File queue', - maintenanceSettings: 'Settings', - maintenanceQueueActionSettings: 'Adjust settings', - maintenanceQueueActionFileQueue: 'View queue', - maintenanceQueueItems: { - storage_issue: { - title: '{count} storage issues', - description: - 'Review records missing download metadata and verify storage settings and file details.' - }, - expired_cleanup: { - title: '{count} expired items', - description: - 'Review expired shares, delete stale records, or extend files that should stay available.' - }, - expiring_soon: { - title: '{count} expiring soon', - description: 'These shares will expire soon. Extend them early or notify recipients.' - }, - never_retrieved: { - title: '{count} never retrieved', - description: - 'Review shares that have not been retrieved to identify ineffective uploads or follow-up gaps.' - }, - permanent_review: { - title: '{count} permanent shares', - description: - 'Periodically review long-retention shares to prevent unbounded historical growth.' - }, - guest_upload_retention: { - title: 'Guest uploads lack retention limits', - description: - 'Guest uploads are enabled without a maximum retention period. Add a default retention policy.' - }, - chunking_disabled: { - title: 'Large-file experience can improve', - description: - "Today's capacity is near the single-file limit. Enable chunked upload for better reliability." - }, - healthy: { - title: 'Maintenance queue is stable', - description: 'No maintenance item needs priority attention right now.' - } - }, viewAllActivities: 'View all', activityTimelineTitle: 'Activity Timeline', activityTimelineFiltered: 'Current Results', @@ -1182,43 +976,6 @@ export default { local_file: 'Local file', system: 'System' }, - operationalInsights: { - storage_issue: { - title: 'Fix {count} storage issues', - description: - 'Some records are missing download metadata. Review storage settings and file details first.' - }, - expired_cleanup: { - title: 'Clean up {count} expired files', - description: - 'Expired records add management noise. Delete them in bulk or extend the files that should remain available.' - }, - expiring_soon: { - title: '{count} files expiring soon', - description: - 'These shares will become unavailable soon. Extend them early or notify the recipients.' - }, - never_retrieved: { - title: '{count} files never retrieved', - description: - 'Shares that were never retrieved can reveal ineffective uploads or follow-up gaps.' - }, - guest_upload_retention: { - title: 'Guest uploads lack retention limits', - description: - 'Guest upload is enabled with unlimited retention. Set a default retention window to reduce storage pressure.' - }, - chunking_disabled: { - title: 'Consider enabling chunked upload', - description: - "Today's added capacity is near the single-file limit. Chunked upload can improve large-file reliability." - }, - healthy: { - title: 'Operations look stable', - description: - 'No high-priority operational risk was detected. Keep watching the file health trend.' - } - }, recentFiles: 'Recent Shares', recentFilesDesc: 'Recently created share records for quick status checks.', available: 'Available', diff --git a/src/i18n/locales/zh-CN.ts b/src/i18n/locales/zh-CN.ts index f753dc1..ae67be5 100644 --- a/src/i18n/locales/zh-CN.ts +++ b/src/i18n/locales/zh-CN.ts @@ -90,57 +90,6 @@ export default { textType: '文本', recentActivities: '最近操作', recentActivitiesDesc: '记录管理员最近的关键改动,便于回溯处理链路。', - operationalInsightsTitle: '运营建议', - operationalInsightsDesc: '根据文件健康、上传策略和近期容量自动生成下一步动作。', - operationalInsightActionSettings: '调整设置', - operationalInsightActionFileQueue: '查看队列', - operationalInsightSeverity: { - danger: '高风险', - warning: '需处理', - success: '稳定', - neutral: '建议' - }, - maintenanceQueueTitle: '维护队列', - maintenanceQueueDesc: '把文件健康、保留策略和上传配置聚合成可处理队列,点击进入对应视图。', - maintenanceActionable: '待处理', - maintenanceFileQueue: '文件队列', - maintenanceSettings: '配置项', - maintenanceQueueActionSettings: '调整设置', - maintenanceQueueActionFileQueue: '查看队列', - maintenanceQueueItems: { - storage_issue: { - title: '存储异常 {count} 项', - description: '优先核对缺少下载元数据的记录,确认存储配置和文件详情。' - }, - expired_cleanup: { - title: '已过期 {count} 项', - description: '集中检查过期分享,删除无效记录或续期仍需保留的文件。' - }, - expiring_soon: { - title: '即将过期 {count} 项', - description: '这些分享将在短时间内失效,适合提前续期或通知使用方。' - }, - never_retrieved: { - title: '未取件 {count} 项', - description: '查看创建后尚未被取件的分享,用于识别无效上传或触达缺口。' - }, - permanent_review: { - title: '永久有效 {count} 项', - description: '定期复核长期保留的分享,避免历史文件无限增长。' - }, - guest_upload_retention: { - title: '游客上传缺少保留上限', - description: '游客上传已开启且没有最长保存时间,建议补充默认保留策略。' - }, - chunking_disabled: { - title: '大文件体验可优化', - description: '今日容量接近单文件上限,开启分片上传可提升上传稳定性。' - }, - healthy: { - title: '维护队列稳定', - description: '当前未发现需要优先处理的维护事项。' - } - }, viewAllActivities: '查看全部', activityTimelineTitle: '操作时间线', activityTimelineFiltered: '当前结果', @@ -183,36 +132,6 @@ export default { local_file: '本地文件', system: '系统' }, - operationalInsights: { - storage_issue: { - title: '修复 {count} 个存储异常', - description: '部分记录缺少下载元数据,建议优先核对存储配置和文件详情。' - }, - expired_cleanup: { - title: '清理 {count} 个已过期文件', - description: '已过期记录会占用管理视野,建议批量删除或续期仍需保留的文件。' - }, - expiring_soon: { - title: '{count} 个文件即将过期', - description: '这些分享将在短时间内失效,适合提前续期或通知使用方。' - }, - never_retrieved: { - title: '{count} 个文件未被取件', - description: '创建后长期无人取件的分享可用于判断无效上传或触达效果。' - }, - guest_upload_retention: { - title: '游客上传缺少保留上限', - description: '游客上传已开启且保存时间不受限,建议设置默认保留期降低存储压力。' - }, - chunking_disabled: { - title: '建议开启分片上传', - description: '今日新增容量已接近单文件上限,开启分片上传可提升大文件体验。' - }, - healthy: { - title: '运行状态稳定', - description: '当前未发现优先级较高的运营风险,可继续观察文件健康趋势。' - } - }, recentFiles: '最近分享', recentFilesDesc: '最近创建的分享记录,便于快速核对状态。', available: '可取件', @@ -559,52 +478,6 @@ export default { viewPresetDeleteSuccess: '视图已删除', viewPresetDeleteFailed: '视图删除失败', viewPresetLoadFailed: '视图预设加载失败,已使用内置视图', - viewSummary: { - title: '当前视图处置摘要', - description: '基于当前筛选结果聚合风险和下一步动作,点击可切换到对应队列。', - filteredTotal: '当前结果', - allTotal: '全部记录', - activeFilters: '筛选条件', - action: '查看队列', - reset: '清空筛选', - severity: { - success: '稳定', - warning: '需处理', - danger: '高风险', - info: '提示', - neutral: '观察' - }, - items: { - storage_issue: { - title: '存储异常 {count} 项', - description: '优先检查缺少下载元数据的记录,确认存储路径、文件名和配置。' - }, - expired: { - title: '已过期 {count} 项', - description: '集中处理已不可取件的分享,删除无效记录或续期仍需保留的文件。' - }, - expiring_soon: { - title: '即将过期 {count} 项', - description: '这些分享将在 24 小时内失效,适合提前续期或提醒使用方。' - }, - never_retrieved: { - title: '未取件 {count} 项', - description: '查看创建后尚未被取件的分享,用于识别无效上传或触达缺口。' - }, - permanent: { - title: '永久有效 {count} 项', - description: '复核长期保留的分享,避免历史文件无限增长。' - }, - healthy: { - title: '当前视图稳定', - description: '当前筛选结果未发现需要优先处理的文件。' - }, - empty: { - title: '当前视图无结果', - description: '调整筛选条件或清空筛选,查看其他文件队列。' - } - } - }, all: '全部', active: '可取件', expired: '已过期', @@ -1015,57 +888,6 @@ export default { textType: '文本', recentActivities: '最近操作', recentActivitiesDesc: '记录管理员最近的关键改动,便于回溯处理链路。', - operationalInsightsTitle: '运营建议', - operationalInsightsDesc: '根据文件健康、上传策略和近期容量自动生成下一步动作。', - operationalInsightActionSettings: '调整设置', - operationalInsightActionFileQueue: '查看队列', - operationalInsightSeverity: { - danger: '高风险', - warning: '需处理', - success: '稳定', - neutral: '建议' - }, - maintenanceQueueTitle: '维护队列', - maintenanceQueueDesc: '把文件健康、保留策略和上传配置聚合成可处理队列,点击进入对应视图。', - maintenanceActionable: '待处理', - maintenanceFileQueue: '文件队列', - maintenanceSettings: '配置项', - maintenanceQueueActionSettings: '调整设置', - maintenanceQueueActionFileQueue: '查看队列', - maintenanceQueueItems: { - storage_issue: { - title: '存储异常 {count} 项', - description: '优先核对缺少下载元数据的记录,确认存储配置和文件详情。' - }, - expired_cleanup: { - title: '已过期 {count} 项', - description: '集中检查过期分享,删除无效记录或续期仍需保留的文件。' - }, - expiring_soon: { - title: '即将过期 {count} 项', - description: '这些分享将在短时间内失效,适合提前续期或通知使用方。' - }, - never_retrieved: { - title: '未取件 {count} 项', - description: '查看创建后尚未被取件的分享,用于识别无效上传或触达缺口。' - }, - permanent_review: { - title: '永久有效 {count} 项', - description: '定期复核长期保留的分享,避免历史文件无限增长。' - }, - guest_upload_retention: { - title: '游客上传缺少保留上限', - description: '游客上传已开启且没有最长保存时间,建议补充默认保留策略。' - }, - chunking_disabled: { - title: '大文件体验可优化', - description: '今日容量接近单文件上限,开启分片上传可提升上传稳定性。' - }, - healthy: { - title: '维护队列稳定', - description: '当前未发现需要优先处理的维护事项。' - } - }, viewAllActivities: '查看全部', activityTimelineTitle: '操作时间线', activityTimelineFiltered: '当前结果', @@ -1108,36 +930,6 @@ export default { local_file: '本地文件', system: '系统' }, - operationalInsights: { - storage_issue: { - title: '修复 {count} 个存储异常', - description: '部分记录缺少下载元数据,建议优先核对存储配置和文件详情。' - }, - expired_cleanup: { - title: '清理 {count} 个已过期文件', - description: '已过期记录会占用管理视野,建议批量删除或续期仍需保留的文件。' - }, - expiring_soon: { - title: '{count} 个文件即将过期', - description: '这些分享将在短时间内失效,适合提前续期或通知使用方。' - }, - never_retrieved: { - title: '{count} 个文件未被取件', - description: '创建后长期无人取件的分享可用于判断无效上传或触达效果。' - }, - guest_upload_retention: { - title: '游客上传缺少保留上限', - description: '游客上传已开启且保存时间不受限,建议设置默认保留期降低存储压力。' - }, - chunking_disabled: { - title: '建议开启分片上传', - description: '今日新增容量已接近单文件上限,开启分片上传可提升大文件体验。' - }, - healthy: { - title: '运行状态稳定', - description: '当前未发现优先级较高的运营风险,可继续观察文件健康趋势。' - } - }, recentFiles: '最近分享', recentFilesDesc: '最近创建的分享记录,便于快速核对状态。', available: '可取件', diff --git a/src/services/stats.ts b/src/services/stats.ts index 8b2b6ab..0eabfd6 100644 --- a/src/services/stats.ts +++ b/src/services/stats.ts @@ -3,8 +3,7 @@ import type { ApiResponse, DashboardActivitiesParams, DashboardActivitiesResponse, - DashboardData, - DashboardMaintenanceQueue + DashboardData } from '@/types' export class StatsService { @@ -12,10 +11,6 @@ export class StatsService { return api.get('/admin/dashboard') } - static async getMaintenanceQueue(): Promise> { - return api.get('/admin/dashboard/maintenance-queue') - } - static async getActivities( params: DashboardActivitiesParams ): Promise> { diff --git a/src/types/dashboard.ts b/src/types/dashboard.ts index ea3dc5a..e472ab3 100644 --- a/src/types/dashboard.ts +++ b/src/types/dashboard.ts @@ -43,15 +43,6 @@ export interface DashboardData { recentFiles?: DashboardRecentFile[] recentActivities?: DashboardActivity[] recent_activities?: DashboardActivity[] - operationalInsights?: DashboardOperationalInsight[] - operational_insights?: DashboardOperationalInsight[] - insights?: DashboardOperationalInsight[] - maintenanceQueue?: DashboardMaintenanceQueue - maintenance_queue?: DashboardMaintenanceQueue - maintenanceItems?: DashboardMaintenanceQueueItem[] - maintenance_items?: DashboardMaintenanceQueueItem[] - maintenanceSummary?: Partial - maintenance_summary?: Partial } export interface DashboardSuffixStat { @@ -129,99 +120,6 @@ export interface DashboardActivitiesResponse { target_type_options?: DashboardActivityOption[] } -export type DashboardInsightSeverity = 'danger' | 'warning' | 'success' | 'neutral' - -export interface DashboardMaintenanceQueueAction { - type?: string - actionType?: string - action_type?: string - health?: AdminFileHealthFilter | string | null - targetHealth?: AdminFileHealthFilter | string | null - target_health?: AdminFileHealthFilter | string | null - suggestedAction?: string - suggested_action?: string -} - -export interface DashboardMaintenanceQueueItem { - key: string - severity: DashboardInsightSeverity | string - category?: string - priority?: number - count: number - action?: DashboardMaintenanceQueueAction - actionType?: string - action_type?: string - suggestedAction?: string - suggested_action?: string - targetHealth?: AdminFileHealthFilter | string | null - target_health?: AdminFileHealthFilter | string | null -} - -export interface DashboardMaintenanceQueueSummary { - total: number - actionableCount: number - actionable_count?: number - dangerCount: number - danger_count?: number - warningCount: number - warning_count?: number - successCount: number - success_count?: number - neutralCount: number - neutral_count?: number - fileQueueCount: number - file_queue_count?: number - settingsCount: number - settings_count?: number - strongestSeverity: DashboardInsightSeverity - strongest_severity?: DashboardInsightSeverity -} - -export interface DashboardMaintenanceQueue { - items?: DashboardMaintenanceQueueItem[] - maintenanceItems?: DashboardMaintenanceQueueItem[] - maintenance_items?: DashboardMaintenanceQueueItem[] - summary?: Partial - maintenanceSummary?: Partial - maintenance_summary?: Partial -} - -export interface DashboardMaintenanceQueueViewItem extends DashboardMaintenanceQueueItem { - severity: DashboardInsightSeverity - priority: number - actionTypeValue: string - suggestedActionValue: string - targetHealthValue: AdminFileHealthFilter | string | null -} - -export interface DashboardOperationalInsightAction { - type?: string - actionType?: string - action_type?: string - health?: AdminFileHealthFilter | string | null - targetHealth?: AdminFileHealthFilter | string | null - target_health?: AdminFileHealthFilter | string | null -} - -export interface DashboardOperationalInsight { - key: string - severity: DashboardInsightSeverity | string - priority?: number - count: number - action?: DashboardOperationalInsightAction - actionType?: string - action_type?: string - targetHealth?: AdminFileHealthFilter | string | null - target_health?: AdminFileHealthFilter | string | null -} - -export interface DashboardOperationalInsightViewItem extends DashboardOperationalInsight { - severity: DashboardInsightSeverity - priority: number - actionTypeValue: string - targetHealthValue: AdminFileHealthFilter | string | null -} - export type DashboardViewData = Omit< DashboardData, | keyof DashboardHealthSummary @@ -240,15 +138,6 @@ export type DashboardViewData = Omit< | 'recentFiles' | 'recentActivities' | 'recent_activities' - | 'operationalInsights' - | 'operational_insights' - | 'insights' - | 'maintenanceQueue' - | 'maintenance_queue' - | 'maintenanceItems' - | 'maintenance_items' - | 'maintenanceSummary' - | 'maintenance_summary' | 'storageUsed' | 'yesterdaySize' | 'todaySize' @@ -269,9 +158,6 @@ export type DashboardViewData = Omit< topSuffixes: DashboardSuffixStat[] recentFiles: DashboardRecentFile[] recentActivities: DashboardActivityViewItem[] - operationalInsights: DashboardOperationalInsightViewItem[] - maintenanceItems: DashboardMaintenanceQueueViewItem[] - maintenanceSummary: DashboardMaintenanceQueueSummary storageUsed: number yesterdaySize: number todaySize: number diff --git a/src/types/file.ts b/src/types/file.ts index 92bde02..50fc5a4 100644 --- a/src/types/file.ts +++ b/src/types/file.ts @@ -102,64 +102,6 @@ export interface AdminFileListParams { sortOrder?: AdminFileSortOrder } -export interface AdminFileViewSummaryItem { - key: string - severity: AdminFileInsightSeverity | string - priority?: number - count: number - actionType?: string - action_type?: string - health?: AdminFileHealthFilter | string - targetHealth?: AdminFileHealthFilter | string - target_health?: AdminFileHealthFilter | string - suggestedAction?: string - suggested_action?: string - sourceKey?: string - source_key?: string -} - -export interface AdminFileViewSummary { - total?: number - filteredTotal?: number - filtered_total?: number - allTotal?: number - all_total?: number - activeFilterCount?: number - active_filter_count?: number - hasFilters?: boolean - has_filters?: boolean - strongestSeverity?: AdminFileInsightSeverity | string - strongest_severity?: AdminFileInsightSeverity | string - filters?: Record - summary?: Partial - healthSummary?: Partial - health_summary?: Partial - cards?: AdminFileViewSummaryItem[] - items?: AdminFileViewSummaryItem[] - actions?: AdminFileViewSummaryItem[] -} - -export interface AdminFileViewSummaryViewItem extends AdminFileViewSummaryItem { - severity: AdminFileInsightSeverity - priority: number - actionTypeValue: string - sourceKeyValue: string - suggestedActionValue: string - targetHealthValue: AdminFileHealthFilter | string -} - -export interface AdminFileViewSummaryViewData { - total: number - filteredTotal: number - allTotal: number - activeFilterCount: number - hasFilters: boolean - strongestSeverity: AdminFileInsightSeverity - summary: AdminFileSummary - cards: AdminFileViewSummaryViewItem[] - actions: AdminFileViewSummaryViewItem[] -} - export interface AdminFileViewPresetParams { keyword: string status: AdminFileStatusFilter @@ -247,12 +189,6 @@ export interface FileListResponse { page: number size: number summary?: AdminFileSummary - viewSummary?: AdminFileViewSummary - view_summary?: AdminFileViewSummary - currentViewSummary?: AdminFileViewSummary - current_view_summary?: AdminFileViewSummary - actionSummary?: AdminFileViewSummary - action_summary?: AdminFileViewSummary } export interface AdminFilePreviewResponse { diff --git a/src/views/manage/DashboardView.vue b/src/views/manage/DashboardView.vue index b1c7c09..12842d7 100644 --- a/src/views/manage/DashboardView.vue +++ b/src/views/manage/DashboardView.vue @@ -84,130 +84,6 @@ -
-
-
-

- {{ t('admin.dashboard.operationalInsightsTitle') }} -

-

- {{ t('admin.dashboard.operationalInsightsDesc') }} -

-
-
- -
- -
-
- -
-
-
-

- {{ t('admin.dashboard.maintenanceQueueTitle') }} -

-

- {{ t('admin.dashboard.maintenanceQueueDesc') }} -

-
- -
-
-

- {{ t('admin.dashboard.maintenanceActionable') }} -

- - {{ dashboardData.maintenanceSummary.actionableCount }} - -
-
-

- {{ t('admin.dashboard.maintenanceFileQueue') }} -

- - {{ dashboardData.maintenanceSummary.fileQueueCount }} - -
-
-

- {{ t('admin.dashboard.maintenanceSettings') }} -

- - {{ dashboardData.maintenanceSummary.settingsCount }} - -
-
-
- -
- -
-
-
@@ -793,7 +669,6 @@ import { FileTextIcon, HardDriveIcon, HistoryIcon, - LightbulbIcon, ListFilterIcon, PencilIcon, RefreshCwIcon, @@ -809,13 +684,7 @@ import { useDashboardStats, useInjectedDarkMode } from '@/composables' import { useI18n } from 'vue-i18n' import { formatFileSize, formatTimestamp } from '@/utils/common' import { ROUTES } from '@/constants' -import type { - DashboardActivityViewItem, - DashboardHealthAction, - DashboardInsightSeverity, - DashboardMaintenanceQueueViewItem, - DashboardOperationalInsightViewItem -} from '@/types' +import type { DashboardActivityViewItem, DashboardHealthAction } from '@/types' const isDarkMode = useInjectedDarkMode() const { t } = useI18n() @@ -927,102 +796,6 @@ const healthActions = computed(() => [ const getSuffixRatio = (count: number) => Math.round((count / maxSuffixCount.value) * 100) -const operationalInsightIconMap: Record = { - danger: AlertTriangleIcon, - warning: ClockIcon, - success: CheckCircleIcon, - neutral: ShieldCheckIcon -} - -const getOperationalInsightIcon = (severity: DashboardInsightSeverity) => - operationalInsightIconMap[severity] - -const getOperationalInsightClass = (severity: DashboardInsightSeverity) => { - const darkClasses: Record = { - danger: 'border-red-500/25 bg-red-500/10 text-red-100 hover:border-red-400/60', - warning: 'border-amber-500/25 bg-amber-500/10 text-amber-100 hover:border-amber-400/60', - success: 'border-emerald-500/25 bg-emerald-500/10 text-emerald-100 hover:border-emerald-400/60', - neutral: 'border-gray-700 bg-gray-800/70 text-gray-100 hover:border-indigo-500/50' - } - const lightClasses: Record = { - danger: 'border-red-100 bg-red-50 text-red-800 hover:border-red-300', - warning: 'border-amber-100 bg-amber-50 text-amber-800 hover:border-amber-300', - success: 'border-emerald-100 bg-emerald-50 text-emerald-800 hover:border-emerald-300', - neutral: 'border-gray-100 bg-white text-gray-800 shadow-sm hover:border-indigo-200' - } - - return isDarkMode.value ? darkClasses[severity] : lightClasses[severity] -} - -const getOperationalInsightSeverityLabel = (severity: DashboardInsightSeverity) => - t(`admin.dashboard.operationalInsightSeverity.${severity}`) - -const getOperationalInsightTitle = (insight: DashboardOperationalInsightViewItem) => { - const key = `admin.dashboard.operationalInsights.${insight.key}.title` - const title = t(key, { count: insight.count }) - return title === key ? insight.key : title -} - -const getOperationalInsightDescription = (insight: DashboardOperationalInsightViewItem) => { - const key = `admin.dashboard.operationalInsights.${insight.key}.description` - const description = t(key, { count: insight.count }) - return description === key ? insight.key : description -} - -const getOperationalInsightActionLabel = (insight: DashboardOperationalInsightViewItem) => - insight.actionTypeValue === 'settings' - ? t('admin.dashboard.operationalInsightActionSettings') - : t('admin.dashboard.operationalInsightActionFileQueue') - -const openOperationalInsight = (insight: DashboardOperationalInsightViewItem) => { - if (insight.actionTypeValue === 'settings') { - void router.push({ path: ROUTES.SETTINGS }) - return - } - - const health = insight.targetHealthValue - void router.push({ - path: ROUTES.FILE_MANAGE, - query: health ? { health } : {} - }) -} - -const getMaintenanceQueueIcon = (severity: DashboardInsightSeverity) => - operationalInsightIconMap[severity] - -const getMaintenanceQueueClass = (severity: DashboardInsightSeverity) => - getOperationalInsightClass(severity) - -const getMaintenanceQueueTitle = (item: DashboardMaintenanceQueueViewItem) => { - const key = `admin.dashboard.maintenanceQueueItems.${item.key}.title` - const title = t(key, { count: item.count }) - return title === key ? item.key : title -} - -const getMaintenanceQueueDescription = (item: DashboardMaintenanceQueueViewItem) => { - const key = `admin.dashboard.maintenanceQueueItems.${item.key}.description` - const description = t(key, { count: item.count }) - return description === key ? item.key : description -} - -const getMaintenanceQueueActionLabel = (item: DashboardMaintenanceQueueViewItem) => - item.actionTypeValue === 'settings' - ? t('admin.dashboard.maintenanceQueueActionSettings') - : t('admin.dashboard.maintenanceQueueActionFileQueue') - -const openMaintenanceQueueItem = (item: DashboardMaintenanceQueueViewItem) => { - if (item.actionTypeValue === 'settings') { - void router.push({ path: ROUTES.SETTINGS }) - return - } - - const health = item.targetHealthValue - void router.push({ - path: ROUTES.FILE_MANAGE, - query: health ? { health } : {} - }) -} - const formatCreatedAt = (value: string | null) => { if (!value) return '-' return formatTimestamp(value, 'datetime') diff --git a/src/views/manage/FileManageView.vue b/src/views/manage/FileManageView.vue index 74ed785..2fad4c3 100644 --- a/src/views/manage/FileManageView.vue +++ b/src/views/manage/FileManageView.vue @@ -51,83 +51,6 @@
-
-
-
-
-
- -
-
-

- {{ t('fileManage.viewSummary.title') }} -

-

- {{ t('fileManage.viewSummary.description') }} -

-
-
-
- -
-
-

{{ metric.label }}

-

- {{ metric.value }} -

-
-
-
- -
- -
-
-
@@ -1250,16 +1173,12 @@ import type { AdminFileSortOrder, AdminFileStatusFilter, AdminFileTypeFilter, - AdminFileViewSummaryViewItem, AdminFileViewItem } from '@/types' import { ActivityIcon, - AlertTriangleIcon, ArchiveIcon, CheckIcon, - CheckCircleIcon, - ChevronRightIcon, ClockIcon, CopyIcon, DownloadIcon, @@ -1273,7 +1192,6 @@ import { RefreshCwIcon, RotateCcwIcon, SearchIcon, - ShieldCheckIcon, TrashIcon, XIcon } from 'lucide-vue-next' @@ -1337,7 +1255,6 @@ const { selectedViewPresetId, storageUsedText, summary, - viewSummary, showBatchEditModal, showEditModal, showFileDetailModal, @@ -1567,21 +1484,6 @@ const summaryCards = computed(() => [ } ]) -const viewSummaryMetrics = computed(() => [ - { - label: t('fileManage.viewSummary.filteredTotal'), - value: viewSummary.value.filteredTotal - }, - { - label: t('fileManage.viewSummary.allTotal'), - value: viewSummary.value.allTotal - }, - { - label: t('fileManage.viewSummary.activeFilters'), - value: viewSummary.value.activeFilterCount - } -]) - const statusFilterOptions = computed<{ value: AdminFileStatusFilter; label: string }[]>(() => [ { value: 'all', label: t('fileManage.all') }, { value: 'active', label: t('fileManage.active') }, @@ -1622,78 +1524,10 @@ const healthFilterValues: AdminFileHealthFilter[] = [ 'permanent' ] -const isHealthFilterValue = (value: string): value is AdminFileHealthFilter => - healthFilterValues.includes(value as AdminFileHealthFilter) - -const getViewSummaryItemKey = (item: AdminFileViewSummaryViewItem) => - item.sourceKeyValue || item.key - -const getViewSummaryTitle = (item: AdminFileViewSummaryViewItem) => - t(`fileManage.viewSummary.items.${getViewSummaryItemKey(item)}.title`, { - count: item.count - }) - -const getViewSummaryDescription = (item: AdminFileViewSummaryViewItem) => - t(`fileManage.viewSummary.items.${getViewSummaryItemKey(item)}.description`, { - count: item.count - }) - -const getViewSummaryActionLabel = (item: AdminFileViewSummaryViewItem) => - item.targetHealthValue === 'all' - ? t('fileManage.viewSummary.reset') - : t('fileManage.viewSummary.action') - -const getViewSummarySeverityLabel = (item: AdminFileViewSummaryViewItem) => - t(`fileManage.viewSummary.severity.${item.severity}`) - -const getViewSummaryIcon = (item: AdminFileViewSummaryViewItem) => { - if (item.severity === 'success') return CheckCircleIcon - if (item.severity === 'danger' || item.severity === 'warning') return AlertTriangleIcon - return ShieldCheckIcon -} - -const getViewSummaryItemClass = (item: AdminFileViewSummaryViewItem) => { - const darkClasses: Record = { - success: 'border-emerald-500/20 bg-emerald-500/10 hover:border-emerald-500/40', - warning: 'border-amber-500/20 bg-amber-500/10 hover:border-amber-500/40', - danger: 'border-red-500/20 bg-red-500/10 hover:border-red-500/40', - info: 'border-blue-500/20 bg-blue-500/10 hover:border-blue-500/40', - neutral: 'border-gray-700 bg-gray-700/30 hover:border-gray-600' - } - const lightClasses: Record = { - success: 'border-emerald-100 bg-emerald-50 hover:border-emerald-200', - warning: 'border-amber-100 bg-amber-50 hover:border-amber-200', - danger: 'border-red-100 bg-red-50 hover:border-red-200', - info: 'border-blue-100 bg-blue-50 hover:border-blue-200', - neutral: 'border-gray-200 bg-gray-50 hover:border-gray-300' - } - - return isDarkMode.value ? darkClasses[item.severity] : lightClasses[item.severity] -} - -const getViewSummaryIconClass = (item: AdminFileViewSummaryViewItem) => { - const darkClasses: Record = { - success: 'bg-emerald-900/40 text-emerald-200', - warning: 'bg-amber-900/40 text-amber-200', - danger: 'bg-red-900/40 text-red-200', - info: 'bg-blue-900/40 text-blue-200', - neutral: 'bg-gray-800 text-gray-300' - } - const lightClasses: Record = { - success: 'bg-emerald-100 text-emerald-700', - warning: 'bg-amber-100 text-amber-700', - danger: 'bg-red-100 text-red-700', - info: 'bg-blue-100 text-blue-700', - neutral: 'bg-gray-100 text-gray-700' - } - - return isDarkMode.value ? darkClasses[item.severity] : lightClasses[item.severity] -} - const getRouteHealthFilter = (): AdminFileHealthFilter => { const health = route.query.health - if (typeof health === 'string' && isHealthFilterValue(health)) { - return health + if (typeof health === 'string' && healthFilterValues.includes(health as AdminFileHealthFilter)) { + return health as AdminFileHealthFilter } return 'all' } @@ -1718,16 +1552,6 @@ const handleResetFilters = async () => { await syncHealthFilterQuery('all') } -const openViewSummaryItem = async (item: AdminFileViewSummaryViewItem) => { - const health = String(item.targetHealthValue || 'all') - if (health !== 'all' && isHealthFilterValue(health)) { - await handleHealthFilterChange(health) - return - } - - await handleResetFilters() -} - const handleViewPresetChange = async (event: Event) => { const target = event.target as HTMLSelectElement if (!target.value) {