From f7000cd6cee35434eca4d3eedc5ddb2ae853873e Mon Sep 17 00:00:00 2001
From: Sukanya Pandey <sukapan1@in.ibm.com>
Date: Thu, 26 Aug 2021 18:34:49 +0530
Subject: 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
---
 src/views/Logs/Dumps/Dumps.vue | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

(limited to 'src/views/Logs/Dumps/Dumps.vue')

diff --git a/src/views/Logs/Dumps/Dumps.vue b/src/views/Logs/Dumps/Dumps.vue
index 4538b305..00bbf7f8 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 @@ import BVTableSelectableMixin, {
   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 @@ export default {
   mixins: [
     BVTableSelectableMixin,
     BVToastMixin,
+    BVPaginationMixin,
     LoadingBarMixin,
     SearchFilterMixin,
     TableFilterMixin,
@@ -199,8 +231,11 @@ export default {
           label: this.$t('global.action.delete'),
         },
       ],
+      currentPage: currentPage,
       filterEndDate: null,
       filterStartDate: null,
+      itemsPerPageOptions: itemsPerPageOptions,
+      perPage: perPage,
       searchFilter,
       searchFilteredItemsCount: 0,
       selectedRows,
-- 
cgit v1.2.3

