Skip to content
Snippets Groups Projects
Commit 297bc766 authored by schneider210's avatar schneider210
Browse files

chore: merge develop into working branch

parents 2d31b77c 7e623d78
No related branches found
No related tags found
1 merge request!50hits per sheet optimisation
Pipeline #219827 passed
...@@ -85,13 +85,29 @@ ...@@ -85,13 +85,29 @@
cols="12" cols="12"
> >
<!-- TODO: provide translation --> <!-- TODO: provide translation -->
© {{ new Date().getFullYear() }} – Ahiqar - The syriac and arabic Ahiqar Texts © {{ new Date().getFullYear() }} – Ahiqar - The syriac and arabic Ahiqar Texts (<a href="https://gitlab.gwdg.de/subugoe/ahiqar/website/-/blob/main/CHANGELOG.md" class="grey--text text--lighten-3 text-decoration-none" target="_blank">v{{ version }}</a>)
</v-col> </v-col>
</v-row> </v-row>
</v-container> </v-container>
</v-footer> </v-footer>
</template> </template>
<script>
import { version } from '../../../package.json';
export default {
data() {
return {
version: '',
}
},
created() {
this.version = version;
}
}
</script>
<style lang="scss" scoped> <style lang="scss" scoped>
.v-tab { .v-tab {
font-size: 75%; font-size: 75%;
......
...@@ -2,16 +2,25 @@ ...@@ -2,16 +2,25 @@
<div> <div>
<SearchInput @search="onSearchInput" /> <SearchInput @search="onSearchInput" />
<!-- #TODO: add translation --> <!-- #TODO: add translation -->
<p <p v-if="total > 0">
v-if="total > 0" Found a total of <code class="font-weight-black">{{ total }}</code>
class=""
>Found a total of <code class="font-weight-black">{{ total }}</code>
{{ 'Hit' | numerus(total) }} for <code class="font-weight-black">{{ query }}</code> {{ 'Hit' | numerus(total) }} for <code class="font-weight-black">{{ query }}</code>
in <code class="font-weight-black">{{ uniqueSheets }}</code> {{ 'Sheet' | numerus(uniqueSheets) }} in <code class="font-weight-black">{{ uniqueSheets }}</code> {{ 'Sheet' | numerus(uniqueSheets) }}
and <code class="font-weight-black">{{ uniqueManuscripts }}</code> {{ 'Manuscript' | numerus(uniqueManuscripts) }}. and <code class="font-weight-black">{{ uniqueManuscripts }}</code> {{ 'Manuscript' | numerus(uniqueManuscripts) }}.
</p> </p>
<SearchResultList :hit-counter="hitCounter" :items="items" /> <div
v-if="loading"
class="loading-wrapper py-10"
>
<v-progress-circular
color="primary"
size="50"
indeterminate
/>
</div>
<SearchResultList v-else :hit-counter="hitCounter" :items="items" />
<div <div
class="text-center" class="text-center"
...@@ -39,12 +48,13 @@ export default { ...@@ -39,12 +48,13 @@ export default {
}, },
data() { data() {
return { return {
query: '',
hitCounter: 0, hitCounter: 0,
items: [], items: [],
loading: false,
page: 1,
query: '',
size: 20, size: 20,
total: 0, total: 0,
page: 1,
}; };
}, },
watch: { watch: {
...@@ -59,7 +69,8 @@ export default { ...@@ -59,7 +69,8 @@ export default {
page: function() { page: function() {
const from = this.size * (this.page - 1); const from = this.size * (this.page - 1);
this.search(this.query, from, this.size); this.search(this.query, from, this.size);
}, this.loading = true;
}
}, },
computed: { computed: {
pagesAmount() { pagesAmount() {
...@@ -90,19 +101,30 @@ export default { ...@@ -90,19 +101,30 @@ export default {
onSearchInput(query) { onSearchInput(query) {
this.query = query; this.query = query;
this.page = 1; this.page = 1;
this.search(this.query, 0, this.size) this.search(this.query, 0, this.size)
}, },
async search(value, from, size) { async search(value, from, size) {
this.hitCounter = from + 1; this.hitCounter = from + 1;
const searchResponse = await apiService.search(value, from, size); try {
this.items = [];
this.total = 0;
if (searchResponse) { this.loading = true;
const searchResponse = await apiService.search(value, from, size);
const items = searchResponse.hits?.hits; const items = searchResponse.hits?.hits;
if (items) { if (items) {
this.total = searchResponse.hits?.total?.value || 0; this.total = searchResponse.hits?.total?.value || 0;
this.items = items.map(x => ({...x, searchTerm: value})); this.items = items.map(x => ({ ...x, searchTerm: value }));
} }
} catch(error) {
this.items = [];
this.total = 0;
} finally {
this.loading = false;
} }
}, },
scrollUp() { scrollUp() {
...@@ -115,3 +137,9 @@ export default { ...@@ -115,3 +137,9 @@ export default {
}, },
}; };
</script> </script>
<style lang="scss" scoped>
.loading-wrapper {
text-align: center;
}
</style>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment