fix: 修复 OSS 删除与历史筛选
This commit is contained in:
@@ -78,7 +78,7 @@ describe('HistoryView.vue', () => {
|
||||
expect(wrapper.text()).toContain('等待中')
|
||||
})
|
||||
|
||||
it('按打包类型过滤', async () => {
|
||||
it('版本号筛选为下拉选项', async () => {
|
||||
const router = createMockRouter()
|
||||
const wrapper = mount(HistoryView, {
|
||||
global: { plugins: [router] },
|
||||
@@ -86,7 +86,9 @@ describe('HistoryView.vue', () => {
|
||||
await flushPromises()
|
||||
|
||||
const selects = wrapper.findAll('.filter-select')
|
||||
await selects[2].setValue('Ad_Hoc')
|
||||
expect(selects).toHaveLength(3)
|
||||
expect(wrapper.text()).not.toContain('全部类型')
|
||||
await selects[1].setValue('2.196.0')
|
||||
await wrapper.vm.$nextTick()
|
||||
|
||||
const rows = wrapper.findAll('tbody tr')
|
||||
@@ -101,14 +103,14 @@ describe('HistoryView.vue', () => {
|
||||
await flushPromises()
|
||||
|
||||
const selects = wrapper.findAll('.filter-select')
|
||||
await selects[3].setValue('failed')
|
||||
await selects[2].setValue('failed')
|
||||
await wrapper.vm.$nextTick()
|
||||
|
||||
const rows = wrapper.findAll('tbody tr')
|
||||
expect(rows.length).toBe(1) // App2
|
||||
})
|
||||
|
||||
it('按 App 名称和版本号筛选', async () => {
|
||||
it('按 App 名称和版本号下拉选项筛选', async () => {
|
||||
const router = createMockRouter()
|
||||
const wrapper = mount(HistoryView, {
|
||||
global: { plugins: [router] },
|
||||
@@ -117,7 +119,7 @@ describe('HistoryView.vue', () => {
|
||||
|
||||
const selects = wrapper.findAll('.filter-select')
|
||||
await selects[0].setValue('App1')
|
||||
await wrapper.find('.version-filter').setValue('2.196')
|
||||
await wrapper.find('.version-filter').setValue('2.196.0')
|
||||
await wrapper.vm.$nextTick()
|
||||
|
||||
const rows = wrapper.findAll('tbody tr')
|
||||
|
||||
@@ -8,11 +8,9 @@
|
||||
<option value="">全部 App</option>
|
||||
<option v-for="appName in appNames" :key="appName" :value="appName">{{ appName }}</option>
|
||||
</select>
|
||||
<input v-model.trim="filterVersion" class="filter-select version-filter" type="search" placeholder="筛选 App 版本号">
|
||||
<select v-model="filterBuildType" class="filter-select">
|
||||
<option value="">全部类型</option>
|
||||
<option value="Ad_Hoc">Ad_Hoc</option>
|
||||
<option value="App_Store">App_Store</option>
|
||||
<select v-model="filterVersion" class="filter-select version-filter">
|
||||
<option value="">全部版本</option>
|
||||
<option v-for="version in appVersions" :key="version" :value="version">{{ version }}</option>
|
||||
</select>
|
||||
<select v-model="filterStatus" class="filter-select">
|
||||
<option value="">全部状态</option>
|
||||
@@ -172,7 +170,6 @@ const authFetch = (url, options = {}) => {
|
||||
}
|
||||
return fetch(url, options)
|
||||
}
|
||||
const filterBuildType = ref('')
|
||||
const filterStatus = ref('')
|
||||
const filterAppName = ref('')
|
||||
const filterVersion = ref('')
|
||||
@@ -193,6 +190,9 @@ const getAppVersion = (task) => {
|
||||
}
|
||||
|
||||
const appNames = computed(() => [...new Set(tasks.value.map(task => task.app_name).filter(Boolean))].sort())
|
||||
const appVersions = computed(() => [...new Set(
|
||||
tasks.value.map(task => task.app_version).filter(version => version && version !== '-')
|
||||
)].sort((a, b) => b.localeCompare(a, undefined, { numeric: true })))
|
||||
|
||||
const showQrPreview = (task) => {
|
||||
qrPreview.value = task
|
||||
@@ -203,8 +203,7 @@ const filteredTasks = computed(() => {
|
||||
// 默认隐藏已取消的任务
|
||||
if (!filterStatus.value && task.status === 'cancelled') return false
|
||||
if (filterAppName.value && task.app_name !== filterAppName.value) return false
|
||||
if (filterVersion.value && !task.app_version.toLowerCase().includes(filterVersion.value.toLowerCase())) return false
|
||||
if (filterBuildType.value && task.build_type !== filterBuildType.value) return false
|
||||
if (filterVersion.value && task.app_version !== filterVersion.value) return false
|
||||
if (filterStatus.value && task.status !== filterStatus.value) return false
|
||||
return true
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user