added 'exact search' to filtering
This commit is contained in:
@@ -36,11 +36,15 @@
|
||||
variant="outlined"></v-select>
|
||||
</v-col>
|
||||
|
||||
<v-col class="v-col-12 v-col-sm-4 v-col-lg-2 mt-n6 mt-sm-0">
|
||||
<v-switch v-model="enableExact" label="Exact search" color="primary"></v-switch>
|
||||
</v-col>
|
||||
|
||||
<v-col :class="mobile ? 'mt-n6' : ''" :cols="mobile ? 12 : 'auto'" class="ms-auto">
|
||||
<v-pagination
|
||||
v-model="page"
|
||||
:length="pagesMax"
|
||||
:total-visible="mobile ? undefined : 7"
|
||||
:total-visible="mobile ? undefined : 6"
|
||||
active-color="primary"
|
||||
density="comfortable"
|
||||
start="1"
|
||||
@@ -189,6 +193,7 @@ const selectStatusItems = [
|
||||
{ title: 'Signing', value: 'signing' },
|
||||
{ title: 'Unknown', value: 'unknown' }
|
||||
]
|
||||
const enableExact = ref(false)
|
||||
|
||||
const page = ref(1)
|
||||
const pagesMax = ref(1)
|
||||
@@ -207,6 +212,12 @@ const searchPackages = (offset: number) => {
|
||||
if (selectRepo.value.value !== 'any') params.append('repo', selectRepo.value.value)
|
||||
if (selectStatus.value.value !== 'any') params.append('status', selectStatus.value.value)
|
||||
|
||||
if (enableExact.value) {
|
||||
params.append('exact', '')
|
||||
} else {
|
||||
params.delete('exact')
|
||||
}
|
||||
|
||||
fetch('https://api.alhp.dev/packages?' + params, {
|
||||
method: 'GET'
|
||||
})
|
||||
@@ -364,6 +375,7 @@ window.addEventListener('load', () => {
|
||||
.toLowerCase()
|
||||
: 'Status (any)'
|
||||
}
|
||||
enableExact.value = url.searchParams.has('exact')
|
||||
|
||||
searchPackages(0)
|
||||
})
|
||||
@@ -375,6 +387,16 @@ watch(
|
||||
}
|
||||
)
|
||||
|
||||
watch(() => enableExact.value, () => {
|
||||
if (enableExact.value) {
|
||||
url.searchParams.set('exact', '')
|
||||
} else {
|
||||
url.searchParams.delete('exact', '')
|
||||
}
|
||||
window.history.pushState(null, '', url.toString())
|
||||
searchPackages(0)
|
||||
})
|
||||
|
||||
// @ts-ignore
|
||||
let delayTimer = null
|
||||
watch(
|
||||
|
Reference in New Issue
Block a user