Resolve bug for pagination not being updated
- Bug: When a user filters a page, the pagination does not change.
- Solution: When a user filters a page, the pagination will be updated based on
the filtered results.
- This patchset will also add pagination in dumps page.
Signed-off-by: Sukanya Pandey <sukapan1@in.ibm.com>
Change-Id: I189d27b5489c42ac85f25c0a1a4cdb7cf7eae5c2
diff --git a/src/views/Logs/Dumps/Dumps.vue b/src/views/Logs/Dumps/Dumps.vue
index 4538b30..00bbf7f 100644
--- a/src/views/Logs/Dumps/Dumps.vue
+++ b/src/views/Logs/Dumps/Dumps.vue
@@ -105,6 +105,32 @@
</page-section>
</b-col>
</b-row>
+ <!-- Table pagination -->
+ <b-row>
+ <b-col sm="6" xl="5">
+ <b-form-group
+ class="table-pagination-select"
+ :label="$t('global.table.itemsPerPage')"
+ label-for="pagination-items-per-page"
+ >
+ <b-form-select
+ id="pagination-items-per-page"
+ v-model="perPage"
+ :options="itemsPerPageOptions"
+ />
+ </b-form-group>
+ </b-col>
+ <b-col sm="6" xl="5">
+ <b-pagination
+ v-model="currentPage"
+ first-number
+ last-number
+ :per-page="perPage"
+ :total-rows="getTotalRowCount(filteredItemCount)"
+ aria-controls="table-dump-entries"
+ />
+ </b-col>
+ </b-row>
</b-container>
</template>
@@ -127,6 +153,11 @@
tableHeaderCheckboxIndeterminate,
} from '@/components/Mixins/BVTableSelectableMixin';
import BVToastMixin from '@/components/Mixins/BVToastMixin';
+import BVPaginationMixin, {
+ currentPage,
+ perPage,
+ itemsPerPageOptions,
+} from '@/components/Mixins/BVPaginationMixin';
import LoadingBarMixin from '@/components/Mixins/LoadingBarMixin';
import SearchFilterMixin, {
searchFilter,
@@ -149,6 +180,7 @@
mixins: [
BVTableSelectableMixin,
BVToastMixin,
+ BVPaginationMixin,
LoadingBarMixin,
SearchFilterMixin,
TableFilterMixin,
@@ -199,8 +231,11 @@
label: this.$t('global.action.delete'),
},
],
+ currentPage: currentPage,
filterEndDate: null,
filterStartDate: null,
+ itemsPerPageOptions: itemsPerPageOptions,
+ perPage: perPage,
searchFilter,
searchFilteredItemsCount: 0,
selectedRows,
diff --git a/src/views/Logs/EventLogs/EventLogs.vue b/src/views/Logs/EventLogs/EventLogs.vue
index fa3f43c..a841f3e 100644
--- a/src/views/Logs/EventLogs/EventLogs.vue
+++ b/src/views/Logs/EventLogs/EventLogs.vue
@@ -230,7 +230,7 @@
first-number
last-number
:per-page="perPage"
- :total-rows="getTotalRowCount(filteredLogs.length)"
+ :total-rows="getTotalRowCount(filteredRows)"
aria-controls="table-event-logs"
/>
</b-col>
diff --git a/src/views/Logs/PostCodeLogs/PostCodeLogs.vue b/src/views/Logs/PostCodeLogs/PostCodeLogs.vue
index a6892fb..87fd965 100644
--- a/src/views/Logs/PostCodeLogs/PostCodeLogs.vue
+++ b/src/views/Logs/PostCodeLogs/PostCodeLogs.vue
@@ -138,7 +138,7 @@
first-number
last-number
:per-page="perPage"
- :total-rows="getTotalRowCount(filteredLogs.length)"
+ :total-rows="getTotalRowCount(filteredRows)"
aria-controls="table-post-code-logs"
/>
</b-col>
diff --git a/src/views/SecurityAndAccess/Sessions/Sessions.vue b/src/views/SecurityAndAccess/Sessions/Sessions.vue
index bd4c06a..9782e7f 100644
--- a/src/views/SecurityAndAccess/Sessions/Sessions.vue
+++ b/src/views/SecurityAndAccess/Sessions/Sessions.vue
@@ -104,7 +104,7 @@
first-number
last-number
:per-page="perPage"
- :total-rows="getTotalRowCount(allConnections.length)"
+ :total-rows="getTotalRowCount(filteredRows)"
aria-controls="table-session-logs"
/>
</b-col>