Fix item count (#500)

* Use item count instead of total count in header indicator

* Fix duplicate export
This commit is contained in:
Rijk van Zanten
2020-04-29 09:31:42 -04:00
committed by GitHub
parent ce7f173230
commit fcbe0af502
2 changed files with 18 additions and 25 deletions

View File

@@ -52,7 +52,7 @@
<portal to="actions:prepend">
<transition name="fade">
<span class="item-count" v-if="totalCount">{{ showingCount }}</span>
<span class="item-count" v-if="itemCount">{{ showingCount }}</span>
</transition>
</portal>
@@ -230,7 +230,7 @@ export default defineComponent({
const { size, icon, imageSource, title, subtitle, imageFit } = useViewOptions();
const { sort, limit, page, fields } = useViewQuery();
const { items, loading, error, totalPages, itemCount, totalCount } = useItems(collection, {
const { items, loading, error, totalPages, itemCount } = useItems(collection, {
sort,
limit,
page,
@@ -251,8 +251,8 @@ export default defineComponent({
const showingCount = computed(() => {
return i18n.t('start_end_of_count_items', {
start: i18n.n((+page.value - 1) * limit.value + 1),
end: i18n.n(Math.min(page.value * limit.value, totalCount.value || 0)),
count: i18n.n(totalCount.value || 0),
end: i18n.n(Math.min(page.value * limit.value, itemCount.value || 0)),
count: i18n.n(itemCount.value || 0),
});
});
@@ -282,7 +282,6 @@ export default defineComponent({
newLink,
info,
clearFilters,
totalCount,
showingCount,
};

View File

@@ -53,7 +53,7 @@
<portal to="actions:prepend">
<transition name="fade">
<span class="item-count" v-if="totalCount">
<span class="item-count" v-if="itemCount">
{{ showingCount }}
</span>
</transition>
@@ -226,22 +226,17 @@ export default defineComponent({
const { sort, limit, page, fields } = useItemOptions();
const {
items,
loading,
error,
totalPages,
itemCount,
totalCount,
changeManualSort,
} = useItems(collection, {
sort,
limit,
page,
fields,
filters: _filters,
searchQuery,
});
const { items, loading, error, totalPages, itemCount, changeManualSort } = useItems(
collection,
{
sort,
limit,
page,
fields,
filters: _filters,
searchQuery,
}
);
const {
tableSort,
@@ -265,8 +260,8 @@ export default defineComponent({
const showingCount = computed(() => {
return i18n.t('start_end_of_count_items', {
start: i18n.n((+page.value - 1) * limit.value + 1),
end: i18n.n(Math.min(page.value * limit.value, totalCount.value || 0)),
count: i18n.n(totalCount.value || 0),
end: i18n.n(Math.min(page.value * limit.value, itemCount.value || 0)),
count: i18n.n(itemCount.value || 0),
});
});
@@ -295,7 +290,6 @@ export default defineComponent({
info,
newLink,
clearFilters,
totalCount,
showingCount,
sortField,
changeManualSort,