优化缓存管理页面

This commit is contained in:
jxxghp
2025-05-29 22:56:40 +08:00
parent 52b5fdf383
commit a473f356c9
4 changed files with 71 additions and 9 deletions
+5 -3
View File
@@ -1395,9 +1395,11 @@ export default {
settingsSaveFailed: 'Failed to save subscription basic settings!', settingsSaveFailed: 'Failed to save subscription basic settings!',
}, },
cache: { cache: {
title: 'Cache', title: 'Cache Management',
description: 'Site cache and media recognition data cache management', subtitle: 'Manage torrent cache data',
subtitle: 'Manage cached site resources', filterByTitle: 'Filter by Title',
filterBySite: 'Filter by Site',
selectSite: 'Select Site',
refresh: 'Refresh Cache', refresh: 'Refresh Cache',
deleteSelected: 'Delete Selected', deleteSelected: 'Delete Selected',
clearAll: 'Clear All Cache', clearAll: 'Clear All Cache',
+4 -2
View File
@@ -1375,9 +1375,11 @@ export default {
settingsSaveFailed: '订阅基础设置保存失败!', settingsSaveFailed: '订阅基础设置保存失败!',
}, },
cache: { cache: {
title: '缓存', title: '缓存管理',
description: '种子缓存、图片文件缓存管理',
subtitle: '管理缓存的站点资源', subtitle: '管理缓存的站点资源',
filterByTitle: '按标题筛选',
filterBySite: '按站点筛选',
selectSite: '选择站点',
refresh: '刷新缓存', refresh: '刷新缓存',
deleteSelected: '删除选中', deleteSelected: '删除选中',
clearAll: '清空缓存', clearAll: '清空缓存',
+3
View File
@@ -1379,6 +1379,9 @@ export default {
title: '緩存', title: '緩存',
description: '種子緩存、圖片文件緩存管理', description: '種子緩存、圖片文件緩存管理',
subtitle: '管理緩存的站點資源', subtitle: '管理緩存的站點資源',
filterByTitle: '按標題篩選',
filterBySite: '按站點篩選',
selectSite: '選擇站點',
refresh: '刷新緩存', refresh: '刷新緩存',
deleteSelected: '刪除選中', deleteSelected: '刪除選中',
clearAll: '清空緩存', clearAll: '清空緩存',
+59 -4
View File
@@ -29,6 +29,30 @@ const cacheData = ref<TorrentCacheData>({
data: [], data: [],
}) })
// 筛选条件
const titleFilter = ref('')
const siteFilter = ref('')
// 获取所有站点选项
const siteOptions = computed(() => {
const sites = new Set<string>()
cacheData.value.data.forEach(item => {
if (item.site_name) {
sites.add(item.site_name)
}
})
return Array.from(sites).sort()
})
// 筛选后的数据
const filteredData = computed(() => {
return cacheData.value.data.filter(item => {
const titleMatch = item.title.toLowerCase().includes(titleFilter.value.toLowerCase())
const siteMatch = !siteFilter.value || item.site_name === siteFilter.value
return titleMatch && siteMatch
})
})
// 选中的缓存项 // 选中的缓存项
const selectedItems = ref<string[]>([]) const selectedItems = ref<string[]>([])
@@ -43,8 +67,8 @@ const doubanId = ref<string | undefined>()
const tableStyle = computed(() => { const tableStyle = computed(() => {
return appMode return appMode
? 'height: calc(100vh - 17rem - env(safe-area-inset-bottom) - 6.5rem)' ? 'height: calc(100vh - 20rem - env(safe-area-inset-bottom) - 6.5rem)'
: 'height: calc(100vh - 17rem - env(safe-area-inset-bottom)' : 'height: calc(100vh - 20rem - env(safe-area-inset-bottom)'
}) })
// 调用API加载缓存数据 // 调用API加载缓存数据
@@ -197,6 +221,11 @@ function getMediaTypeColor(type: string): string {
} }
} }
// 打开详情页面
function openPageUrl(url: string) {
window.open(url, '_blank')
}
onMounted(() => { onMounted(() => {
loadCacheData() loadCacheData()
}) })
@@ -236,6 +265,32 @@ onMounted(() => {
</template> </template>
</VCardItem> </VCardItem>
<!-- 筛选框 -->
<VCardText>
<VRow>
<VCol cols="12" md="6">
<VTextField
v-model="titleFilter"
:label="t('setting.cache.filterByTitle')"
prepend-inner-icon="mdi-magnify"
clearable
density="compact"
/>
</VCol>
<VCol cols="12" md="6">
<VSelect
v-model="siteFilter"
:label="t('setting.cache.filterBySite')"
:items="siteOptions"
prepend-inner-icon="mdi-web"
clearable
density="compact"
:placeholder="t('setting.cache.selectSite')"
/>
</VCol>
</VRow>
</VCardText>
<!-- 缓存列表 --> <!-- 缓存列表 -->
<VDataTable <VDataTable
v-model="selectedItems" v-model="selectedItems"
@@ -249,7 +304,7 @@ onMounted(() => {
{ title: t('setting.cache.recognitionResult'), key: 'media_info', sortable: false, width: '200px' }, { title: t('setting.cache.recognitionResult'), key: 'media_info', sortable: false, width: '200px' },
{ title: t('setting.cache.actions'), key: 'actions', sortable: false, width: '150px' }, { title: t('setting.cache.actions'), key: 'actions', sortable: false, width: '150px' },
]" ]"
:items="cacheData.data" :items="filteredData"
:loading="loading" :loading="loading"
item-value="hash" item-value="hash"
show-select show-select
@@ -345,7 +400,7 @@ onMounted(() => {
size="small" size="small"
color="info" color="info"
variant="text" variant="text"
:href="item.page_url" @click="openPageUrl(item.page_url || '')"
target="_blank" target="_blank"
> >
<VIcon size="16">mdi-open-in-new</VIcon> <VIcon size="16">mdi-open-in-new</VIcon>