debian-mirror-gitlab/app/assets/javascripts/releases/components/releases_pagination.vue

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

38 lines
963 B
Vue
Raw Normal View History

2020-11-24 15:15:51 +05:30
<script>
2021-06-08 01:23:25 +05:30
import { GlKeysetPagination } from '@gitlab/ui';
2022-06-21 17:19:12 +05:30
import { isBoolean } from 'lodash';
2021-06-08 01:23:25 +05:30
import { historyPushState, buildUrlWithCurrentLocation } from '~/lib/utils/common_utils';
2020-11-24 15:15:51 +05:30
export default {
2022-06-21 17:19:12 +05:30
name: 'ReleasesPagination',
2021-06-08 01:23:25 +05:30
components: { GlKeysetPagination },
2022-06-21 17:19:12 +05:30
props: {
pageInfo: {
type: Object,
required: true,
validator: (info) => isBoolean(info.hasPreviousPage) && isBoolean(info.hasNextPage),
2021-06-08 01:23:25 +05:30
},
},
methods: {
onPrev(before) {
historyPushState(buildUrlWithCurrentLocation(`?before=${before}`));
},
onNext(after) {
historyPushState(buildUrlWithCurrentLocation(`?after=${after}`));
},
2020-11-24 15:15:51 +05:30
},
};
</script>
<template>
<div class="gl-display-flex gl-justify-content-center">
2021-06-08 01:23:25 +05:30
<gl-keyset-pagination
v-bind="pageInfo"
2022-06-21 17:19:12 +05:30
:prev-text="__('Prev')"
:next-text="__('Next')"
v-on="$listeners"
2021-06-08 01:23:25 +05:30
@prev="onPrev($event)"
@next="onNext($event)"
/>
2020-11-24 15:15:51 +05:30
</div>
</template>