Commit 39812bfa authored by gj4210's avatar gj4210 👽 Committed by janis.streib
Browse files

FIX: Paginator & PaginatorList attributes not passed through

+ enabled simple replacement of b-pagination by adding value prop
parent db2a38b7
......@@ -19,6 +19,11 @@
export default {
name: 'Paginator',
props: {
value: {
default() {
return null
}
},
currentPage: {
default() {
return 1
......@@ -58,9 +63,10 @@ export default {
computed: {
current_page_mutable: {
get() {
return this.currentPage
return this.value || this.currentPage
},
set(val) {
this.$emit('input', val)
this.$emit('current-page', val)
}
},
......
<template>
<div class="paginator">
<FilterInput v-model="filterValue"></FilterInput>
<Paginator currentPage="current_page" perPage="items_per_page" @current-page="current_page = $event"
@per-page="items_per_page = $event" totalRows="filtered_and_sorted_items.length" :block="block"
<Paginator :current-page="current_page" :per-page="items_per_page" @current-page="current_page = $event"
@per-page="items_per_page = $event" :total-rows="filtered_and_sorted_items.length" :block="block"
:per-page-options="itemsPerPageOptions"
v-if="filtered_and_sorted_items.length > 0"/>
......@@ -17,8 +17,8 @@
<span class="font-italic">{{ noItemsText }}</span><br/>
</div>
<Paginator currentPage="current_page" perPage="items_per_page" @current-page="current_page = $event"
@per-page="items_per_page = $event" totalRows="filtered_and_sorted_items.length" :block="block"
<Paginator :current-page="current_page" :per-page="items_per_page" @current-page="current_page = $event"
@per-page="items_per_page = $event" :total-rows="filtered_and_sorted_items.length" :block="block"
:per-page-options="itemsPerPageOptions"
v-if="filtered_and_sorted_items.length > 0"/>
</div>
......@@ -53,11 +53,12 @@ export default {
itemsPerPageOptions: {
default() {
return [
{ value: 25, text: 25 },
{ value: 50, text: 50 },
{ value: 100, text: 100 },
{ value: 500, text: 500 },
{ value: null, text: 'Alle' }
5,
25,
50,
100,
500,
{ value: 0, text: 'Alle' }
]
}
},
......@@ -104,7 +105,7 @@ export default {
},
sliced_items() {
if (this.items_per_page === 0) {
return this.sorted_items()
return this.filtered_and_sorted_items()
}
return this.filtered_and_sorted_items.slice((this.current_page - 1) * this.items_per_page, Math.min(this.items.length, this.current_page * this.items_per_page))
}
......
......@@ -22,7 +22,7 @@
variant="success" placement="bottom">
Neue Gruppe anlegen
</b-tooltip>
<PaginatorList v-if="entry" :items="groups" items_per_page="25">
<PaginatorList v-if="entry" :items="groups">
<template v-slot:item="data">
<GroupCard
v-bind:key="data.item.name"
......
......@@ -8,7 +8,7 @@
<b-checkbox :value="true" :unchecked-value="false" v-model="only_own" switch>Nur eigene BCDs anzeigen
</b-checkbox>
<Loading :data="clients_by_bcd">
<PaginatorList items_per_page="25" :items="bcds">
<PaginatorList :items="bcds">
<template v-slot:item="card_data">
<b-card no-body :key="'card-bcd-' + card_data.item.name" class="mb-4 shadow">
<template v-slot:header>
......@@ -122,7 +122,8 @@
:non_optionals_order="['bcd_name', 'mac_addr', 'description', 'do_refresh_wpa_key']"
:object_title="db_editor_object_title"
></DBEditor>
<b-modal ok-only id="macauth-show-qr" v-if="qr_item" centered :title="'WiFi-QR-Code für Client \''+qr_item.mac_addr+'\''">
<b-modal ok-only id="macauth-show-qr" v-if="qr_item" centered
:title="'WiFi-QR-Code für Client \''+qr_item.mac_addr+'\''">
<p class="text-center">
<qrcode-vue v-if="qr_item" :value="'WIFI:S:KIT-IoT;T:WPA;P:'+encodeQr(qr_item.wpa_key)+';;'"></qrcode-vue>
</p>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment