35 lines
1,003 B
Vue
35 lines
1,003 B
Vue
<script>
|
|
import { mapActions, mapState } from 'vuex';
|
|
import { GlKeysetPagination } from '@gitlab/ui';
|
|
import { historyPushState, buildUrlWithCurrentLocation } from '~/lib/utils/common_utils';
|
|
|
|
export default {
|
|
name: 'ReleasesPaginationGraphql',
|
|
components: { GlKeysetPagination },
|
|
computed: {
|
|
...mapState('list', ['graphQlPageInfo']),
|
|
showPagination() {
|
|
return this.graphQlPageInfo.hasPreviousPage || this.graphQlPageInfo.hasNextPage;
|
|
},
|
|
},
|
|
methods: {
|
|
...mapActions('list', ['fetchReleasesGraphQl']),
|
|
onPrev(before) {
|
|
historyPushState(buildUrlWithCurrentLocation(`?before=${before}`));
|
|
this.fetchReleasesGraphQl({ before });
|
|
},
|
|
onNext(after) {
|
|
historyPushState(buildUrlWithCurrentLocation(`?after=${after}`));
|
|
this.fetchReleasesGraphQl({ after });
|
|
},
|
|
},
|
|
};
|
|
</script>
|
|
<template>
|
|
<gl-keyset-pagination
|
|
v-if="showPagination"
|
|
v-bind="graphQlPageInfo"
|
|
@prev="onPrev($event)"
|
|
@next="onNext($event)"
|
|
/>
|
|
</template>
|