fix: torrent search (#478) @Anteus

This commit is contained in:
Andreas 2022-09-10 15:52:17 +02:00 committed by GitHub
parent e047467104
commit baba4acda4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 52 additions and 30 deletions

View file

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -7,7 +7,7 @@
<meta name="mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" type="image/png" href="./favicon.ico?s=1">
<link rel="icon" href="./icons/favicon.svg" sizes="any" type="image/svg+xml">
<link rel="icon" href="./img/icons/favicon.svg" sizes="any" type="image/svg+xml">
<title>qBittorrent</title>
</head>
<body>

View file

@ -6,6 +6,7 @@
max-width="500px"
:fullscreen="phoneLayout"
persistent
@keydown.enter.prevent="$refs.addTorrent.click"
>
<div
class="noselect"
@ -22,7 +23,6 @@
@dragleave.prevent="DragLeave"
/>
<v-card
style="height:100%"
:class="showWrapDrag ? 'wrap-drag' : ''"
@drop.prevent="addDropFile"
@dragover.prevent="showWrapDrag = true"
@ -170,6 +170,7 @@
<v-form>
<v-card-actions class="justify-center">
<v-btn
ref="addTorrent"
text
:disabled="!valid"
class="accent white--text mx-0 mt-3"

View file

@ -7,9 +7,6 @@
:style="{ height: phoneLayout ? '100vh' : '' }"
>
<v-card :style="{ height: phoneLayout ? '100vh' : '' }">
<v-card-title class="justify-center">
<h2>{{ $t('modals.search.title') }}</h2>
</v-card-title>
<v-card-text class="pa-0">
<v-form
ref="form"
@ -21,10 +18,11 @@
v-model="searchForm.pattern"
:prepend-inner-icon="mdiMagnify"
label="Search"
:rules="[v => !!v || 'Searchterm is required']"
:rules="[v => !!v || 'Search term is required']"
clearable
style="width: 95%;"
@keydown.enter="$refs.searchButton.click"
autofocus
@keydown.enter.prevent="$refs.searchButton.click"
/>
</v-col>
<v-col class="pa-0 mt-2" cols="3">
@ -47,7 +45,20 @@
:items-per-page="10"
:loading="loading"
:style="{ maxHeight: '60vh'}"
:search="filter"
:custom-filter="customFilter"
:sort-by.sync="sortBy"
:sort-desc.sync="sortDesc"
:mobile-breakpoint="0"
>
<template #top>
<v-text-field
ref="filterRef"
v-model="filter"
label="Filter"
class="mx-4"
/>
</template>
<template #[`item.fileName`]="{ item }">
<a
:href="item.descrLink"
@ -118,7 +129,10 @@ export default {
valid: false,
pattern: ''
},
mdiClose, mdiMagnify, mdiDownload
filter: '',
mdiClose, mdiMagnify, mdiDownload,
sortBy: 'nbSeeders',
sortDesc: true
}
},
computed: {
@ -139,6 +153,7 @@ export default {
this.loading = true
this.search.status = 'Running'
this.search.results = []
this.$refs.filterRef.reset()
const data = await qbit.startSearch(
this.searchForm.pattern,
this.enabledSearchPlugins.map(p => p.name)
@ -175,22 +190,32 @@ export default {
},
close() {
this.dialog = false
},
customFilter(value, search, item) {
const searchArr = search.trim().toLowerCase().split(' ')
return value != null &&
search != null &&
typeof value === 'string' &&
searchArr.every(i => (value.toString().toLowerCase().indexOf(i) !== -1))
}
}
}
</script>
<style lang="scss">
#searchTable {
#searchTable {
.v-data-footer {
justify-content: center;
}
.v-data-footer__pagination {
margin: 0 8px;
}
.v-select__slot {
width: 4em;
min-width: 100%;
}
}
</style>

View file

@ -36,8 +36,11 @@
<span class="body-2">{{ torrent.progress }}</span>
<span class="grey--text caption ml-1">%</span>
<span class="mx-1 grey--text" style="margin-top: 3px"></span>
<span class="grey--text caption"> Ratio: </span>
<span class="grey--text caption"> R: </span>
<span class="body-2 ml-1"> {{ torrent.ratio }} </span>
<span class="mx-1 grey--text" style="margin-top: 3px"></span>
<span class="body-2"> {{ torrent.uploaded | getDataValue }} </span>
<span class="grey--text caption ml-1"> {{ torrent.uploaded | getDataUnit }} </span>
<v-spacer />
<span class="body-2 ml-1"> {{ torrent.eta }} </span>
</v-flex>

View file

@ -109,8 +109,8 @@ const locale = {
size: 'Size',
seeds: 'Seeds',
peers: 'Peers',
search_engine: 'Search_engine',
action: 'Action'
search_engine: 'Site',
action: ''
}
},
settings: {

View file

@ -3,24 +3,6 @@
class="px-1 px-sm-5 pt-4 background noselect"
@click.self="resetSelected"
>
<v-row
no-gutters
class="grey--text"
align="center"
justify="center"
>
<v-col>
<h1 style="font-size: 1.6em !important" class="subtitle-1 ml-2">
Dashboard
</h1>
</v-col>
<v-col class="align-center justify-center">
<span style="float: right; font-size: 0.8em" class="mr-2 text-uppercase">
{{ torrentCountString }}
</span>
</v-col>
</v-row>
<v-row class="ma-0 pa-0" @click.self="resetSelected">
<v-expand-x-transition>
<v-card
@ -103,6 +85,12 @@
</template>
<span>Sort Torrents</span>
</v-tooltip>
<v-col class="align-center justify-center">
<span style="float: right; font-size: 0.8em" class="mr-2 text-uppercase">
{{ torrentCountString }}
</span>
</v-col>
</v-row>
</v-row>
<v-row id="selectAllTorrents" class="ma-0 pa-0">
@ -418,6 +406,11 @@ export default {
return this.createModal('ConfirmDeleteModal')
}
// 'Search new torrent'
if (e.keyCode === 55) {
return this.createModal('SearchModal')
}
}
}
}