Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add proper pagination tio cluster health page
Browse files Browse the repository at this point in the history
bmario committed Mar 7, 2024
1 parent b8491d5 commit 59d8a9a
Showing 2 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion components/Navbar.vue
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@
</b-nav-item>
<b-nav-item
:to="{
name: 'cluster-health',
name: 'cluster-health-page',
}"
active-class="active"
>
22 changes: 19 additions & 3 deletions pages/cluster/health.vue → pages/cluster/health/_page.vue
Original file line number Diff line number Diff line change
@@ -184,7 +184,7 @@
type="number"
min="1"
:max="Math.ceil(matchingRows / perPage)"
:value="Math.ceil(matchingRows / perPage) / 2"
:value="Math.ceil(matchingRows / perPage / 2)"
/>
<b-input-group-append>
<b-button variant="primary" @click="jumpPage()">
@@ -200,9 +200,10 @@
:total-rows="matchingRows"
:per-page="perPage"
:disabled="isBusy"
limit="9"
first-number
last-number
class="justify-content-center"
align="center"
/>
</b-col>
<b-col class="text-right">
@@ -235,12 +236,27 @@ export default {
perPage: 20,
currentPage: params.page !== undefined ? params.page : 1,
totalRows: 0,
matchingRows: 0,
matchingRows: 99999999,
/* It look stupid, and it is even dumber. If matchingRows is initialized
with 0, null or undefined, the b-pagination will take in the
currentPage, realize that this is out of bounds and update it 1. So
effectively preventing me from setting the currentPage to anything.
Hence this stupid hack. I hate vue and bootstrap. */
scannerPolling: null,
scanRunning: false,
isBusy: false,
}
},
watch: {
currentPage(newPage) {
const resolved = this.$router.resolve({
name: 'cluster-health-page',
params: { page: newPage },
})
history.pushState({}, null, resolved.href)
},
},
beforeDestroy() {
clearInterval(this.scannerPolling)
},

0 comments on commit 59d8a9a

Please sign in to comment.